hwtLib.abstract.frame_utils package

Submodules

hwtLib.abstract.frame_utils.alignment_utils module

class hwtLib.abstract.frame_utils.alignment_utils.FrameAlignmentUtils(word_bytes: int, out_offset=0)[source]

Bases: object

Variables

~.word_bytes – number of bytes in 1 output word

__init__(word_bytes: int, out_offset=0)[source]
_resolve_input_bytes_destinations(frames, input_cnt)[source]
Parameters
  • frames – list of all possible frame formats generated from streams_to_all_possible_frame_formats

  • input_cnt – number of input streams

static can_produce_zero_len_frame(streams: List[HStream])[source]
create_frame(stream_i: int, byte_cnt: int, offset_out: int, offset_in: int) Tuple[Tuple[ByteSrcInfo]][source]
Parameters
  • byte_cnt – number of bytes in this frame

  • offset_out – how many empty bytes should be put before data in frame

  • offset_in – how many bytes skip from imput stream

get_bytes_in_frame_info(offset_out, offset_in, chunk_size, chunk_cnt, already_has_body_words)[source]
get_important_byte_cnts(offset_out: int, offset_in: int, chunk_size: int, chunk_cnt_min: Union[int, float], chunk_cnt_max: Union[int, float])[source]

Filter chunk cnt range, let only those values which affect the number of valid bytes in first/last word of frame and presence of words in body frame

join_streams(stream_data: Tuple[Tuple[Tuple[ByteSrcInfo, ...], ...], ...], offset)[source]

Create output frame with specified offset from input stream

Parameters
  • stream_data – list of data for each stream input (stream data is list of data words, data word is a tuple of ByteSrcInfo)

  • offset – offset of output stream

resolve_input_bytes_destinations(streams: List[HStream])[source]
stream_to_all_possible_frame_formats(t: HStream, stream_i: int, offset_out: int)[source]

Generate all possible frame formats with unique features (related to masks, last and data mux)

streams_to_all_possible_frame_formats(streams: List[HStream], offset: int)[source]
See

FrameJoinUtils.stream_to_all_possible_frame_formats() for multiple input streams

hwtLib.abstract.frame_utils.alignment_utils.count_not_none(items: List[Optional[ByteSrcInfo]])[source]
hwtLib.abstract.frame_utils.alignment_utils.freeze_frame(f: List[List[ByteSrcInfo]]) Tuple[Tuple[ByteSrcInfo, ...], ...][source]
hwtLib.abstract.frame_utils.alignment_utils.next_frame_offsets(f0_t: HStream, data_width: int)[source]

hwtLib.abstract.frame_utils.byte_src_info module

class hwtLib.abstract.frame_utils.byte_src_info.ByteSrcInfo(stream_i: int, word_i: int, byte_i: int, is_from_last_input_word: bool)[source]

Bases: object

Container for informations about byte in stream data

Variables
  • ~.stream_i – index of stream

  • ~.word_i – index of word in frame

  • ~.byte_i – index of byte in word

  • ~.is_from_last_input_word – true if this byte comes from last word in input frame

__eq__(other)[source]

Return self==value.

__hash__()[source]

Return hash(self).

__init__(stream_i: int, word_i: int, byte_i: int, is_from_last_input_word: bool)[source]
__lt__(other)[source]

Return self<value.

__repr__()[source]

Return repr(self).

as_tuple()[source]