hwtLib.amba.axi_comp.oooOp package

This package is dedicated to components and other utilities for out-of-order processing.

Submodules

hwtLib.amba.axi_comp.oooOp.outOfOrderCummulativeOp module

class hwtLib.amba.axi_comp.oooOp.outOfOrderCummulativeOp.OutOfOrderCummulativeOp(hdlName: str | None = None)[source]

Bases: HwModule

Out of order container of read-modify-write cummulative operation.

This is a component template for cumulative Out of Order operations with hihgh latency AXI. Suitable for counter arrays, hash tables and other data structures which are acessing data randomly and potential collision due read-modify-write operations may occure.

This component stores info about currently executed memory transactions which may be finished out of order. Potential memory access colisions are solved by write forwarding in main pipeline. In order to compensate for memory write latency the write history is utilised. The write history is a set of registers on the end of the pipeline.

Note that the write history is not meant as a main mechanism for write latency compensation. It is meant to be used for 3-4 items to componsate for latency of the cache/LSU.

If the main operation requires multiple clock cycles the operation is performed speculatively.

The most up-to-date version of the data is always selected on the input of WRITE_BACK stage.

_images/OutOfOrderCummulativeOp_pipeline.png

The STATE_LOAD stage is meant for all write forwarding. The value in this stage is always updated to the latest version (with an exception of WRITE_BACK stage, explained later). The WRITE_BACK stage contains the data which is written to RAM. From this stage the value is confirmed. And the first data in pipeline from this stage is the latest version of it. Because we can not predict the value for WRITE_STAGE when updating STATE_LOAD we have to consider 2 possible values. The value in STATE_LOAD which holds latest value except for WRITE_BACK stage and the WRITE_BACK stage which holds the lates data for a latest transaction.

Variables:
  • MAIN_STATE_T – a type of the state in main memory which is being updated by this component

  • TRANSACTION_STATE_T – a type of the transaction state, used to store additional data for transaction and can be used to modify the behavior of the pipeline

Note:

If MAIN_STATE_T.bit_length() is smaller than DATA_WIDTH each item is allocated in a single bus word separately in order to avoid alignment logic

Note:

provides axi aw and first w word in same clock cycle only

__annotations__ = {}
_axi_addr_defaults(a: Axi4_addr)[source]

Set default values for AXI address channel signals

_declr_io()[source]
_init_constants()[source]
apply_data_write_forwarding(st: OOOOpPipelineStage, st_load_en: RtlSignal, data_modifier=<function OutOfOrderCummulativeOp.<lambda>>)[source]
ar_dispatch()[source]

Send read request on AXI and store transaction in to state array and ooo_fifo for later wake up

can_write_forward(src_st: OOOOpPipelineStage, dst_st: OOOOpPipelineStage)[source]

Used when collision detector is build. (for next value of st WRITE_BACK-1)

collision_detector(pipeline: List[OOOOpPipelineStage]) List[List[RtlSignal]][source]

Search for address access collisions in pipeline and store the result of colision check to registers for data write forwarding in next clock cycle. The collision detector is build for STATE_LOAD (<P.WRITE_BACK) stages because we need to have collision information stored in registers in order to have enough time to do muxing in P.WRITE_BACK stage input.

data_load(r: Axi4_r, st0: OOOOpPipelineStage)[source]

Receive all data words from a bus and store them into stage of the pipeline.

data_store(st_data: HwIOStruct | RtlSignal, w: Axi4_w, ack: RtlSignal)[source]

Transceive all data words from stage of pipeline to the bus.

Parameters:

ack – signal which is 1 if the data word is transferred on this write channel

main_op(dst_st: OOOOpPipelineStage, src_st: OOOOpPipelineStage) RtlSignal[source]

Interpretation of main operatorion of the pipeline.

main_pipeline()[source]

Create all pipeline stages and connect them together.

propagate_trans_st(stage_from: OOOOpPipelineStage, stage_to: OOOOpPipelineStage)[source]

Propagate transaction state between two pipeline stages.

write_cancel(st: OOOOpPipelineStage)[source]
Returns:

A signal/value which if it is 1 it means that the write back of this state should not be performed.

write_forwarding_en(dst_st_load: RtlSignal, dst_st: OOOOpPipelineStage, dst_prev_st: OOOOpPipelineStage, src_st_i: int)[source]

hwtLib.amba.axi_comp.oooOp.reorder_buffer module

class hwtLib.amba.axi_comp.oooOp.reorder_buffer.HwIOStructRdVldWithId(masterDir=DIRECTION.OUT, hdlName: str | dict[str, str] | None = None, loadConfig=True)[source]

Bases: HwIOStructRdVld

__annotations__ = {}
_initSimAgent(sim: HdlSimulator)[source]
class hwtLib.amba.axi_comp.oooOp.reorder_buffer.HwIOStructRdVldWithIdAgent(sim: HdlSimulator, hwIO: HwIODataRdVld, allowNoReset=False)[source]

Bases: HwIODataRdVldAgent

__annotations__ = {}
get_data()[source]

extract data from interface

set_data(data)[source]

write data to interface

class hwtLib.amba.axi_comp.oooOp.reorder_buffer.ReorderBuffer(hdlName: str | None = None)[source]

Bases: HwModule

Serialize an unordered input sequence to continuous output sequence.

HDL params:
HDL IO:
  • clk - of type hwt.hwIOs.std.HwIOClk with dtype=<HBits, 1bit> - SLAVE

  • rst_n - of type hwt.hwIOs.std.HwIORst_n with dtype=<HBits, 1bit, n> - SLAVE

  • dataIn - of type hwtLib.amba.axi_comp.oooOp.reorder_buffer.HwIOStructRdVldWithId with dtype=<HBits, 16bits, unsigned> - SLAVE an input interface with an id signal which is used to reconstruct the sequence

  • dataOut - of type hwt.hwIOs.hwIOStruct.HwIOStructRdVld with dtype=<HBits, 16bits, unsigned> - MASTER an output interface with a data from dataIn which is ordered according to its id

HDL components:
schematic
__annotations__ = {}
item_occupancy_reg() Tuple[RtlSignal, RtlSignal, RtlSignal][source]

hwtLib.amba.axi_comp.oooOp.utils module

class hwtLib.amba.axi_comp.oooOp.utils.HwIOOutOfOrderCummulativeOp(masterDir=DIRECTION.OUT, hdlName: str | dict[str, str] | None = None, loadConfig=True)[source]

Bases: HwIODataRdVld

HDL params:
HDL IO:
  • addr - of type hwt.hwIOs.std.HwIOSignal with dtype=<HBits, 8bits> - UNKNOWN

  • data - of type hwt.hwIOs.std.HwIOSignal with dtype=<HBits, 8bits, unsigned> - UNKNOWN

  • transaction_state - of type hwt.hwIOs.std.HwIOSignal with dtype=<HBits, 8bits, unsigned> - UNKNOWN

  • vld - of type hwt.hwIOs.std.HwIOSignal with dtype=<HBits, 1bit> - UNKNOWN

  • rd - of type hwt.hwIOs.std.HwIOSignal with dtype=<HBits, 1bit> - UNKNOWN (Master=IN)

__annotations__ = {}
_initSimAgent(sim: HdlSimulator)[source]
class hwtLib.amba.axi_comp.oooOp.utils.HwIOOutOfOrderCummulativeOpAgent(sim: HdlSimulator, hwIO: HwIOOutOfOrderCummulativeOp, allowNoReset=False)[source]

Bases: HwIODataRdVldAgent

Note:

if TRANSACTION_STATE_T is None the data should be only int for address else data should be tuple of int for address and a value of the state state value depends on state type, for simple bit vector it is just int, for struct it is tuple, …

__annotations__ = {}
__init__(sim: HdlSimulator, hwIO: HwIOOutOfOrderCummulativeOp, allowNoReset=False)[source]
Parameters:

rst – tuple (rst signal, rst_negated flag)

getDrivers()[source]
Note:

use only before running simulator

getMonitors()[source]
Note:

use only before running simulator

get_data()[source]

extract data from interface

set_data(d)[source]

write data to interface

class hwtLib.amba.axi_comp.oooOp.utils.OOOOpPipelineStage(index, name: str, parent: OutOfOrderCummulativeOp, has_transaction_state)[source]

Bases: object

Variables:
  • index – index of the register in pipeline

  • id – an id of an axi transaction (and index of item in state_array)

  • addr – an address which is beeing processed in this stage

  • state – state loaded from the state_array (current meta state)

  • data – currently loaded data from the bus

  • valid – validity flag for whole stage

  • ready – if 1 the stage can receive data on next clock edge, otherwise the stage stalls

  • collision_detect – the list of flags (sotored in register) if flag is 1 it means that the value should be updated from stage on that index

  • load_en – if 1 the stage will load the data from previous stage in this clock cycle

__annotations__ = {'collision_detect': 'Optional[List[Union[int, RtlSignal]]]'}
__init__(index, name: str, parent: OutOfOrderCummulativeOp, has_transaction_state)[source]
__repr__()[source]

Return repr(self).

collision_detect: List[int | RtlSignal] | None
class hwtLib.amba.axi_comp.oooOp.utils.OutOfOrderCummulativeOpPipelineConfig(READ_DATA_RECEIVE, STATE_LOAD, WRITE_BACK, WAIT_FOR_WRITE_ACK, WRITE_HISTORY_SIZE)[source]

Bases: NamedTuple

READ_DATA_RECEIVE: int

Alias for field number 0

STATE_LOAD: int

Alias for field number 1

WAIT_FOR_WRITE_ACK: int

Alias for field number 3

WRITE_BACK: int

Alias for field number 2

WRITE_HISTORY_SIZE: int

Alias for field number 4

__annotations__ = {'READ_DATA_RECEIVE': <class 'int'>, 'STATE_LOAD': <class 'int'>, 'WAIT_FOR_WRITE_ACK': <class 'int'>, 'WRITE_BACK': <class 'int'>, 'WRITE_HISTORY_SIZE': <class 'int'>}
__getnewargs__()

Return self as a plain tuple. Used by copy and pickle.

__match_args__ = ('READ_DATA_RECEIVE', 'STATE_LOAD', 'WRITE_BACK', 'WAIT_FOR_WRITE_ACK', 'WRITE_HISTORY_SIZE')
static __new__(_cls, READ_DATA_RECEIVE: int, STATE_LOAD: int, WRITE_BACK: int, WAIT_FOR_WRITE_ACK: int, WRITE_HISTORY_SIZE: int)

Create new instance of OutOfOrderCummulativeOpPipelineConfig(READ_DATA_RECEIVE, STATE_LOAD, WRITE_BACK, WAIT_FOR_WRITE_ACK, WRITE_HISTORY_SIZE)

__orig_bases__ = (<function NamedTuple>,)
__repr__()

Return a nicely formatted representation string

__slots__ = ()
_asdict()

Return a new dict which maps field names to their values.

_field_defaults = {}
_fields = ('READ_DATA_RECEIVE', 'STATE_LOAD', 'WRITE_BACK', 'WAIT_FOR_WRITE_ACK', 'WRITE_HISTORY_SIZE')
classmethod _make(iterable)

Make a new OutOfOrderCummulativeOpPipelineConfig object from a sequence or iterable

_replace(**kwds)

Return a new OutOfOrderCummulativeOpPipelineConfig object replacing specified fields with new values

classmethod new_config(WRITE_TO_WRITE_ACK_LATENCY: int, WRITE_ACK_TO_READ_DATA_LATENCY: int)[source]