Load Store Unit

image

The Load Store Unit handles memory operations issued by the core. Functionally, it's purpose is to translate memory instructions into transactions on the appropriate subsystem.

Slots

The Kelvin LSU uses a concept called slots to handle memory transactions. A slot is a data structure which manages the state of a single dispatched LSU operation and determines what memory transaction should be performed. At its core, there exists a table in each slot which tracks which part of the memory operation has been completed.

For example, below is the slot table for a word-store into address 0xDEADBEEF:

IndexActiveAddressData
010xDEADBEEF0x01
110xDEADBEF00x23
210xDEADBEF10x45
310xDEADBEF20x67
400xDEADBEF30x00
...
n00xDEADBEF30x00

Memory transactions over TCM or AXI busses will read/write data in the slot table and flip the active bits to 0 as they are made.

The typical lifetime of a slot is as follows:

  1. Idle: An idle slot will dequeue a LsuOperation from the command queue. Scalar operations will move directly into Transfer Memory while vector operations will go to the Vector Update state.
  2. Vector Update: For vector operations masks, addresses (for indexed ops) and data (for store ops) need to be received from the RvvCore. This stage is bypassed for scalar operations.
  3. Transfer Memory: While there are still active entries in the slot table, the active entry with the lowest “index” will be selected for a memory transaction. A scatter/gather unit will then select all other active entries (although not necessarily contiguous) that will be bundled with the transaction. The appropriate memory bus (ibus, dbus, ebus) will then be selected and a memory transaction will be conducted. When there are no active entries, the slot moves into the next state (Writeback).
  4. Writeback: Once all memory transactions are completed, the result must be written back to register files. Additionally, vector stores are “acknowledged” back to the RvvCore. Scalar and floating point scores bypass this stage. Once writeback is completed, the slot moves back into the Vector Update state for LMUL > 1, or the Idle state.

Kelvin currently uses one “slot” in the LSU. In the future, multiple slots maybe added to allow multiple operations to partake in the same transaction.

Interfaces

LSU Command Interface

The LSU has a command interface coming from the dispatch unit and register file.

Signal NameTypeDescription
req.validBoolIf the LSU command is valid.
req.opThe LSU operation to execute.
req.addrUInt(5)The RegFile address to write the result to for loads.
req.pcUInt(32)The PC of the LSU instruction. Use for fault reporting.
req.elemWidthUInt(32)Used in the RVV only. The EEW for strided loads.
req.readyBool (output)If the command is accepted. Used in a ready-valid hand-shake.

Bus Interfaces

Signal NameTypeDescription
ibus.validBoolIf the ibus transaction is valid.
ibus.addrUInt(32)The address of the ibus transaction.
ibus.rdataUInt(128) (input)The data read from the ibus. Arrives one cycle after hand-shake.
ibus.readyBool (input)If the transaction is accepted. Used in a ready-valid hand-shake.
Signal NameTypeDescription
dbus.validBoolIf the dbus transaction is valid.
dbus.addrUInt(32)The address of the dbus transaction.
dbus.sizeUInt(5)The size of this transaction in bytes.
dbus.pcUInt(32)The PC of the LSU instruction. Use for fault reporting.
dbus.rdataUInt(128) (input)The data read from the dbus. Arrives one cycle after hand-shake.
dbus.wdataUInt(128)The data to write from the dbus.
dbus.wmaskUInt(16)A byte write mask for this transaction.
dbus.readyBool (input)If the transaction is accepted. Used in a ready-valid hand-shake.
Signal NameTypeDescription
ebus.validBoolIf the ebus transaction is valid.
ebus.addrUInt(32)The address of the ebus transaction.
ebus.sizeUInt(5)The size of this transaction in bytes.
ebus.pcUInt(32)The PC of the LSU instruction. Use for fault reporting.
ebus.rdataUInt(128) (input)The data read from the ebus. Arrives one cycle after hand-shake.
ebus.wdataUInt(128)The data to write from the ebus.
ebus.wmaskUInt(16)A byte write mask for this transaction.
ebus.readyBool (input)If the transaction is accepted. Used in a ready-valid hand-shake.
ebus.fault.validBool (input)Raised if a fault occurs on the external bus.
ebus.fault.writeBool (input)If the fault occured on a write operation.
ebus.fault.addrBool (input)The address of the memory transaction when the fault occurred.
ebus.fault.epcBool (input)The PC of the instruction that triggered the fault.
ebus.internalBoolNot used.

Writeback Interfaces

Signal NameTypeDescription
rd.validBoolIf the writeback to the scalar regfile is valid.
rd.addrUInt(5)The address of the scalar register file to writeback to.
rd.dataUInt(32)The data to write to the scalar register file.
Signal NameTypeDescription
rd_flt.validBoolIf the writeback to the floating point regfile is valid.
rd_flt.addrUInt(5)The address of the floating point register file to writeback to.
rd_flt.dataUInt(32)The data to write to the floating point register file.

RVV Interfaces

For the RVVCore, the LSU contains the following interfaces:

Signal NameTypeDescription
rvv2lsu.validBoolIf the rvv2lsu transaction is valid.
rvv2lsu.idx.validBoolIf there is valid index data from the vector register file.
rvv2lsu.idx.addrUInt(5)The address of the indices from the vector register file.
rvv2lsu.idx.dataUInt(128)The indices from the vector register file index.
rvv2lsu.vregfile.validUInt(128)If there is valid data from the vector register file.
rvv2lsu.vregfile.addrUInt(5)The address of the data from the vector register file.
rvv2lsu.vregfile.dataUInt(128)The vector data to write back for this operation.
rvv2lsu.maskUInt(16)A byte activity mask for this transaction.
rvv2lsu.readyBool (input)If the transaction is accepted. Used in a ready-valid hand-shake.
Signal NameTypeDescription
lsu2rvv.validBoolIf the lsu2rvv transaction is valid.
lsu2rvv.addrUInt(5)The destination vector register file index.
lsu2rvv.dataUInt(128)The vector data to write back for load operations.
lsu2rvv.lastBoolIf this transaction is a store or not.
lsu2rvv.readyBool (input)If the transaction is accepted. Used in a ready-valid hand-shake.