Source code for hwtLib.amba.axis_comp.frame_parser.footer_split
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from math import ceil
from typing import Tuple, List
from hwt.code import If, SwitchLogic, Concat
from hwt.code_utils import rename_signal
from hwt.hdl.types.bits import Bits
from hwt.hdl.types.defs import BIT
from hwt.hdl.types.struct import HStruct
from hwt.interfaces.utils import addClkRstn
from hwt.pyUtils.arrayQuery import iter_with_last
from hwt.synthesizer.hObjList import HObjList
from hwt.synthesizer.param import Param
from hwt.synthesizer.rtlLevel.rtlSignal import RtlSignal
from hwtLib.amba.axis_comp.base import AxiSCompBase
from pyMathBitPrecise.bit_utils import mask, set_bit_range, get_bit_range
# Examples of configurations and states which may appear
#
# DW = 2*8, footer= 2 * 8
# 1. the footer is alligned in the way it appears on minimal number of words
# and the dataOut[0] and [1] are always in separate words
# +------------------+----+----+
# | word_i | B0 | B1 |
# +------------------+----+----+
# | last -1 (dataIn) | f | f |
# +------------------+----+----+
# | last (reg[0]) | d | d |
# +------------------+----+----+
# 2. the footer is not alligned in the way it takes +1 words
# +------------------+----+----+
# | word_i | B0 | B1 |
# +------------------+----+----+
# | last -1 (dataIn) | f | X |
# +------------------+----+----+
# | last (reg[0]) | d | f |
# +------------------+----+----+
# DW = 2*8, footer=1*8
# 1. footer, data in separate words
# +------------------+----+----+
# | word_i | B0 | B1 |
# +------------------+----+----+
# | last -1 (dataIn) | f | X |
# +------------------+----+----+
# | last (reg[0]) | d | d |
# +------------------+----+----+
#
# 2. footer and data on minimal number of words
# +------------------+----+----+
# | word_i | B0 | B1 |
# +------------------+----+----+
# | last -1 (dataIn) | d | f |
# +------------------+----+----+
# | last (reg[0]) | X | X |
# +------------------+----+----+
# 3. same as 2. but the last word in reg[0] does belongs to this input frame
# +------------------+----+----+
# | word_i | B0 | B1 |
# +------------------+----+----+
# | last -1 (dataIn) | d | f |
# +------------------+----+----+
# | last (reg[0]) | d | d |
# +------------------+----+----+
# DW = 3*8, footer=2*8
# +------------------+----+----+----+
# | word_i | B0 | B1 | B2 |
# +------------------+----+----+----+
# | last -1 (dataIn) | d | f | f |
# +------------------+----+----+----+
# | last (reg[0]) | X | X | X |
# +------------------+----+----+----+
#
# +------------------+----+----+----+
# | word_i | B0 | B1 | B2 |
# +------------------+----+----+----+
# | last -1 (dataIn) | f | f | X |
# +------------------+----+----+----+
# | last (reg[0]) | d | d | d |
# +------------------+----+----+----+
# +------------------+----+----+----+
# | word_i | B0 | B1 | B2 |
# +------------------+----+----+----+
# | last -1 (dataIn) | f | X | X |
# +------------------+----+----+----+
# | last (reg[0]) | d | d | f |
# +------------------+----+----+----+
if __name__ == '__main__':
from hwt.synthesizer.utils import to_rtl_str
u = _example_AxiS_footerSplit()
print(to_rtl_str(u))