hwtLib.amba.axi_comp.lsu package¶
This package is dedicated to AXI Load/Store Units (LSU) a others like.
Other LSU implementations:
https://github.com/riscv-boom/riscv-boom - has RISC-V LSU in chisel3, read kill, MSHRs
https://github.com/rsd-devel/rsd - has N issue RISC-V LSU
https://github.com/bluespec/Toooba - has RISC-V LSU in BlueSpecVerilog
https://github.com/openhwgroup/cv32e40p - has RISC-V LSU for in order pipeline
Submodules¶
hwtLib.amba.axi_comp.lsu.fifo_oooread module¶
- class hwtLib.amba.axi_comp.lsu.fifo_oooread.FifoOutOfOrderRead(hdlName: str | None = None)[source]¶
Bases:
HwModuleContainer of FIFO pointers and flags where the items can be discarded in out of order manner.
Item state control scheme:
write_confirm: the item is now allocated in the FIFO and ready to be read
read_execute: the item is locked for updates and is currently being read
read_confirm: the item is entirely read and it is ready to be deallocated
- HDL params:
ITEMS - default value 4 of type int
KEY_WIDTH - default value 0 of type int
INIT_DATA - default value () of type tuple
- 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
write_confirm - of type hwt.hwIOs.std.HwIORdVldSync - SLAVE
read_execute - of type hwtLib.commonHwIO.index_key_hs.HwIOIndexKeyRdVld - MASTER
read_confirm - of type hwt.hwIOs.std.HwIODataRdVld - SLAVE
- __annotations__ = {}¶
- class hwtLib.amba.axi_comp.lsu.fifo_oooread.FifoOutOfOrderReadFiltered(hdlName: str | None = None)[source]¶
Bases:
FifoOutOfOrderReadFifoOutOfOrderReadwith an additional cam to filter transactions by same key :attention: this component does not contains the item storage, it is just container of such a FIFO logic
Item state control scheme:
write_execute: preallocate the item for writing (and add key to CAM for filtering)
write_confirm: the item is now allocated in the fifo and ready to be read
read_execute: the item is locked for updates and is currently being read
read_confirm: the item is entirely readed and it is ready to be deallocated
- HDL params:
ITEMS - default value 4 of type int
KEY_WIDTH - default value 8 of type int
INIT_DATA - default value () of type tuple
HAS_READ_LOOKUP - default value False of type bool
- 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
write_confirm - of type hwt.hwIOs.std.HwIORdVldSync - SLAVE
read_execute - of type hwtLib.commonHwIO.index_key_hs.HwIOIndexKeyRdVld - MASTER
read_confirm - of type hwt.hwIOs.std.HwIODataRdVld - SLAVE
write_pre_lookup - of type hwt.hwIOs.std.HwIODataRdVld - SLAVE
write_pre_lookup_res - of type hwt.hwIOs.std.HwIODataRdVld - MASTER
item_valid - of type hwt.hwIOs.std.HwIOSignal with dtype=<HBits, 4bits> - MASTER
item_write_lock - of type hwt.hwIOs.std.HwIOSignal with dtype=<HBits, 4bits> - MASTER
write_execute - of type hwtLib.commonHwIO.index_key_hs.HwIOIndexKeyInRdVld - MASTER
- HDL components:
tag_cam - of type hwtLib.amba.axi_comp.cache.utils.CamWithReadPort
- __annotations__ = {}¶
hwtLib.amba.axi_comp.lsu.hIOs module¶
- class hwtLib.amba.axi_comp.lsu.hIOs.HwIOAxiWriteAggregatorRead(masterDir=DIRECTION.OUT, hdlName: str | dict[str, str] | None = None, loadConfig=True)[source]¶
Bases:
HwIOAn interface which is used to speculatively read data from AxiWriteAggregator
- HDL params:
ADDR_WIDTH - default value 32 of type int
DATA_WIDTH - default value 64 of type int
- HDL IO:
a - of type hwtLib.amba.axi3Lite.Axi3Lite_addr - UNKNOWN
r_data_available - of type hwt.hwIOs.std.HwIODataRdVld - UNKNOWN
r - of type hwtLib.amba.axi3Lite.Axi3Lite_r - UNKNOWN
- __annotations__ = {}¶
- class hwtLib.amba.axi_comp.lsu.hIOs.HwIOAxiWriteAggregatorWriteTmp(masterDir=DIRECTION.OUT, hdlName: str | dict[str, str] | None = None, loadConfig=True)[source]¶
Bases:
Axi4StreamHwIO for tmp input register on store buffer write input
- HDL params:
IS_BIGENDIAN - default value False of type bool
USE_STRB - default value True of type bool
USE_KEEP - default value False of type bool
ID_WIDTH - default value 0 of type int
DEST_WIDTH - default value 0 of type int
DATA_WIDTH - default value 64 of type int
USER_WIDTH - default value 0 of type int
ADDR_WIDTH - default value 32 of type int
ITEMS - default value 64 of type int
- HDL IO:
addr - of type hwt.hwIOs.std.HwIOSignal with dtype=<HBits, 32bits> - UNKNOWN
data - of type hwt.hwIOs.std.HwIOSignal with dtype=<HBits, 64bits> - UNKNOWN
strb - of type hwt.hwIOs.std.HwIOSignal with dtype=<HBits, 8bits> - UNKNOWN
last - of type hwt.hwIOs.std.HwIOSignal with dtype=<HBits, 1bit> - UNKNOWN
ready - of type hwt.hwIOs.std.HwIOSignal with dtype=<HBits, 1bit> - UNKNOWN (Master=IN)
valid - of type hwt.hwIOs.std.HwIOSignal with dtype=<HBits, 1bit> - UNKNOWN
colides_with_last_addr - of type hwt.hwIOs.std.HwIOSignal with dtype=<HBits, 1bit> - UNKNOWN
cam_lookup - of type hwt.hwIOs.std.HwIOSignal with dtype=<HBits, 64bits> - UNKNOWN HwIOVectSignal with value of lookup from item cam (1 if cacheline present in store buffer)
mask_byte_unaligned - of type hwt.hwIOs.std.HwIOSignal with dtype=<HBits, 1bit> - UNKNOWN HwIOSignal 1 if any byte of mask is 0 or all 1
- __annotations__ = {}¶
hwtLib.amba.axi_comp.lsu.read_aggregator module¶
- class hwtLib.amba.axi_comp.lsu.read_aggregator.AxiReadAggregator(hdlName: str | None = None)[source]¶
Bases:
HwModuleThis is a component which reduces reads from same address.
This component has several slots for read transactions, Each slot has it’s own address record in CAM which is used to detect reads from same address, if the read is from same address which is currently being loaded. The read thread is put to sleep until data for previous read is received. After data is received it is copied as a response also for this transaction.
- HDL params:
ADDR_WIDTH - default value 32 of type int
DATA_WIDTH - default value 64 of type int
ID_WIDTH - default value 2 of type int
ADDR_USER_WIDTH - default value 0 of type int
CACHE_LINE_SIZE - default value 64 of type int
- 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
s - of type hwtLib.amba.axi4.Axi4 - SLAVE
m - of type hwtLib.amba.axi4.Axi4 - MASTER
- HDL components:
frame_buff - of type hwtLib.amba.axis_comp.fifoCopy.Axi4SFifoCopy
addr_cam - of type hwtLib.mem.cam.CamMultiPort
addr_cam_out_reg - of type hwtLib.handshaked.reg.HandshakedReg
s_ar_tmp - of type hwtLib.amba.axis_comp.reg.Axi4SReg
- __annotations__ = {}¶
hwtLib.amba.axi_comp.lsu.store_queue_write_propagating module¶
- class hwtLib.amba.axi_comp.lsu.store_queue_write_propagating.Axi4StoreQueueWritePropagating(hdlName: str | None = None)[source]¶
Bases:
AxiWriteAggregatorAn extension of
hwtLib.amba.axi_comp.lsu.write_aggregator.AxiWriteAggregatorwith an IO for a communication with anhwtLib.amba.axi_comp.lsu.load_queue.AxiLoadQueueDoes the same thing and allowshwtLib.amba.axi_comp.lsu.load_queue_write_propagating.AxiLoadQueueWritePropagatingto speculatively read the data and listen for write transactions. The component allows for write to bypass read, which makes it suitable for cumulative operations, but more complicated for a generic use.- Variables:
speculative_read_addr – port used for load buffer to speculatively read the data from this component. If data is not present the speculative_read_data returns RESP_EXOKAY error. The data may also be flushed during the read this is marked with RESP_SLVERR error.
speculative_read_data – Read data for speculative read.
- __annotations__ = {}¶
- speculative_read_handler()[source]¶
Connect the speculative_read port to internal storages of the
AxiWriteAggregatorWe need to handle several cases:
the data is currently stuck in tmp register (we need to wait)
the data was in tmp register and now is in data_ram
the data was and is in data_ram
the data was in data_ram and now it is in main memory
the data was not found in this component (is in main memory)
Handling of speculative read has following stages:
search input register and main address CAM for data
optionaly load the data from ram
send data to speculative_read_data and set resp to error if was not found it may also happen that the data was flushed in the mean time we can not blok other channel and we need to have a buffer for 1 transaction to prevent data loose where we would need to ask main memory
- Note:
speculative read never block the write channel and thus data may be invalid if the speculative read data is stalled. This should be handled in master of speculative read port (Other component which is using this component).
hwtLib.amba.axi_comp.lsu.write_aggregator module¶
- class hwtLib.amba.axi_comp.lsu.write_aggregator.AxiWriteAggregator(hdlName: str | None = None)[source]¶
Bases:
HwModuleA buffer which is used for write data from cache.
It manages:
out of order write acknowledge
write transaction merging
- HDL params:
ADDR_WIDTH - default value 32 of type int
DATA_WIDTH - default value 32 of type int
ID_WIDTH - default value 2 of type inta parameter which specifies width of axi id signal, it also specifies the number of items in this buffer (2**ID_WIDTH)
CACHE_LINE_SIZE - default value 4 of type int
MAX_BLOCK_DATA_WIDTH - default value 8 of type intspecifies maximum data width of RAM (used to prevent synthesis problems for tools which can not handle too wide memories with byte enable)
- 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
s - of type hwtLib.amba.axi4.Axi4 - SLAVE
m - of type hwtLib.amba.axi4.Axi4 - MASTER
- HDL components:
write_dispatch - of type hwtLib.amba.axi_comp.lsu.write_aggregator_write_dispatcher.AxiWriteAggregatorWriteDispatcher
ooo_fifo - of type hwtLib.amba.axi_comp.lsu.fifo_oooread.FifoOutOfOrderReadFiltered
data_ram - of type hwtLib.mem.ramCumulativeMask.RamCumulativeMask
gen_b_reg_0 - of type hwtLib.amba.axis_comp.reg.Axi4SReg
w_in_reg - of type hwtLib.amba.axis_comp.reg.Axi4SReg
- __annotations__ = {}¶
- data_insert(items: BramPort_withReadMask_withoutClk)[source]¶
if it is possible to update data in data_ram of this buffer
else allocate new data (insert to address CAM of ooo_fifo) and store data to w_in_reg
- resolve_cam_index(w_tmp_out: HwIOAxiWriteAggregatorWriteTmp)[source]¶
- w_in_tmp_reg_load() HwIOAxiWriteAggregatorWriteTmp[source]¶
check if this address is already present in address CAM or w_in_reg
hwtLib.amba.axi_comp.lsu.write_aggregator_write_dispatcher module¶
- class hwtLib.amba.axi_comp.lsu.write_aggregator_write_dispatcher.AxiWriteAggregatorWriteDispatcher(hdlName: str | None = None)[source]¶
Bases:
HwModuleUse
hwtLib.amba.axi_comp.lsu.fifo_oooread.FifoOutOfOrderReadFilteredread ports to query an AXI transaction info and copy paste this transaction from BRAM to AXI.- 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
CACHE_LINE_SIZE - default value 64 of type int
- 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
data - of type hwtLib.mem.ramCumulativeMask.BramPort_withReadMask_withoutClk - MASTER
read_execute - of type hwtLib.commonHwIO.index_key_hs.HwIOIndexKeyRdVld - SLAVE
read_confirm - of type hwt.hwIOs.std.HwIODataRdVld - MASTER
m - of type hwtLib.amba.axi4.Axi4 - MASTER
- __annotations__ = {}¶
- data_ram_read_to_bus_w(items: BramPort_withReadMask_withoutClk, item_last: RtlSignal, w_out: Axi4_w)[source]¶
Read write data from data_ram
- Parameters:
item_last – the signal with last flag for data (notes a last beat in burst) sampled in the same time as an read address
- dispatch_addr(id_to_use: RtlSignal, addr: RtlSignal, a: Axi4_addr)[source]¶
if there is a valid item in buffer dispatch read request