Load Store Unit model. More...
#include <LoadStoreUnit.h>
Data Structures | |
struct | LSSlot |
Slot record. | |
Public Member Functions | |
LoadStoreUnit (unsigned int numSlots, unsigned int maxOpsPerCycle, MemoryModel *memModel, OffCpuIF *extIF) | |
Constructor: create slots and initialize as empty. | |
~LoadStoreUnit () | |
Destructor: delete slot array. | |
unsigned int | add (Token *token, CycleCount atCycle) |
Add a load or store token to the LSQ. | |
void | updateStatus (CycleCount currentCycle) |
Update LSQ status (called each cycle). |
Load Store Unit model.
This class is responsible for simulating the load-store queue. It keeps track of instructions in the LSQ, calls to the memory module to get the cycles needed to serve the instruction's memop once an address is available, and notify's instructions with a load that the load is satisfied. We don't do any actual address tracking so it does not do an store-load forwarding, but relies on the probabilities given to the memory model to take care of that.
LoadStoreUnit::LoadStoreUnit | ( | unsigned int | numSlots, | |
unsigned int | maxOpsPerCycle, | |||
MemoryModel * | memModel, | |||
OffCpuIF * | extIF | |||
) |
Constructor: create slots and initialize as empty.
numSlots | is the total number of instruction slots | |
maxOpsPerCycle | is the total number of memory ops allowed per cycle | |
memModel | is a ptr to the memory model object, used to perform memops |
unsigned int LoadStoreUnit::add | ( | Token * | token, | |
CycleCount | atCycle | |||
) |
Add a load or store token to the LSQ.
token | is the instruction token to add | |
atCycle | is the cycle count at which it is being added |
void LoadStoreUnit::updateStatus | ( | CycleCount | currentCycle | ) |
Update LSQ status (called each cycle).
This does two things: 1) cycles through the LSQ and for any memop that has an address newly ready it asks the memory model to serve that memop (just calculate cycles to serve); and 2) it purges memops that have finished; stores just go away quietly but loads have a token callback that indicates the load is satisfied (so that the instruction can continue).
currentCycle | is the active cycle |
References MemoryModel::serveLoad(), and MemoryModel::serveStore().
Referenced by McOpteron::simCycle().