hwtLib.examples.builders package

Example of usage of builder classes. Builder class is something which takes interface as an input and can be used to automatically instantiate, configure and connect various component to that interface. Components like buffers, CDC, parsers, inteconects, decoders, interface adapters can be easily instantiated using such a class.

Submodules

hwtLib.examples.builders.ethAddrUpdater module

class hwtLib.examples.builders.ethAddrUpdater.EthAddrUpdater(hdl_name_override: Optional[str] = None)[source]

Bases: Unit

This is example unit which reads dst and src addresses(MAC and IPv4) from ethernet frame stored in memory and writes this addresses in reverse direction into second frame.

HDL params
  • ADDR_WIDTH - default value 32 of type int

  • DATA_WIDTH - default value 64 of type int

  • ID_WIDTH - default value 6 of type int

  • ADDR_USER_WIDTH - default value 0 of type int

  • ALIGNAS - default value 64 of type int

HDL IO
HDL components
schematic

hwtLib.examples.builders.handshakedBuilderSimple module

class hwtLib.examples.builders.handshakedBuilderSimple.HandshakedBuilderSimple(hdl_name_override: Optional[str] = None)[source]

Bases: Unit

Simple example of HsBuilder which can build components for Handshaked interfaces

HDL IO
HDL components
schematic
class hwtLib.examples.builders.handshakedBuilderSimple.HandshakedBuilderSimpleTC(methodName='runTest')[source]

Bases: SimTestCase

classmethod setUpClass()[source]

Hook method for setting up class fixture before running tests in the class.

test_passData()[source]

hwtLib.examples.builders.hsBuilderSplit module

class hwtLib.examples.builders.hsBuilderSplit.HsBuilderSplit(hdl_name_override: Optional[str] = None)[source]

Bases: Unit

Example of HsBuilder.split_* functions

HDL IO
HDL components
schematic

hwtLib.examples.builders.hwException module

exception hwtLib.examples.builders.hwException.ExampleHwException0(hw_args=None, *args, **kwargs)[source]

Bases: InHwError

An example of InHwError error. This object behaves as a regular python exception and can be used in hwtLib.abstract.hwExceptionCtx.HwExceptionCtx functions which are construction an exception raising/catching logic.

exception hwtLib.examples.builders.hwException.ExampleHwException1(hw_args=None, *args, **kwargs)[source]

Bases: InHwError

class hwtLib.examples.builders.hwException.HwExceptionCatch(hdl_name_override: Optional[str] = None)[source]

Bases: Unit

An example of hwtLib.abstract.hwExceptionCtx.HwExceptionCtx usage.

(a handshaked wire which will stall until reset if 0,1 or 2 appears in data,

only exception caused by value 1 can be handled)

class hwtLib.examples.builders.hwException.HwExceptionRaise(hdl_name_override: Optional[str] = None)[source]

Bases: Unit

An example of hwtLib.abstract.hwExceptionCtx.HwExceptionCtx usage.

(a handshaked wire which will stall until exception is handled, however only exception caused by value 1

has an interface for handlig and thus all other exceptions will cause stall until reset)

hwtLib.examples.builders.pingResponder module

class hwtLib.examples.builders.pingResponder.PingResponder(hdl_name_override: Optional[str] = None)[source]

Bases: Unit

Listen for echo request on rx axi stream interface and respond with echo response on tx interface

HDL params
  • DATA_WIDTH - default value 32 of type int

  • IS_BIGENDIAN - default value True of type bool

  • USE_STRB - default value True of type bool

HDL IO
HDL components
  • gen_rx_parser_0 - of type hwtLib.amba.axis_comp.frame_parser._parser.AxiS_frameParser

  • deparsed_deparser_0 - of type hwtLib.amba.axis_comp.frame_deparser._deparser.AxiS_frameDeparser

schematic
connect_resp(resp, deparserIn, sendingReply)[source]

Connect response data on inputs of frame deparser

Parameters
  • resp – registers with response data

  • deparserIn – input interface of frame deparser

  • sendingRepply – flag which signalizes that data should be deparsed into frame and send

icmp_checksum(header)[source]
Note

we do not need to care about endianity because parser/deparser will swap it for us and we can work with little endians only

Returns

checksum for icmp header

req_load(parsed, regs, freeze)[source]

Load request from parser input into registers

Parameters
  • parsed – input interface with parsed fields of ICPM frame

  • regs – registers for ICMP frame

  • freeze – signal to freeze value in registers

  • def_val – dictionary item from regs: default value

Attention

dst and src are swapped