Proposition of Reservation Station implementation
Here is an example proposition how to implement RS using transaction framework for internal communication. If you want you can follow this proposition, if you don’t, feel free to change anything you want.
Internal data
Actual Reservation Station
This is a buffer which has R rows. Each row has the following structure:
v |
opcode |
|
|
|
|
|
|
|---|
v- “valid” - it is 1 if entry is a correct instruction which waits to be filled with operands/dispatchedid_rsX- is 0 when the source value is ready (and is stored in the appropriateval_rsX) or not needed. It is non-zero when we wait for an operand to be ready.When the operand is ready we insert it to the appropriate
val_rsXfield and we put zero toid_rsXThe instruction is ready to be dispatched if
vis1and bothid_rs1,id_rs2are0
Used slots table
It is a table with R one-bit fields. Each field is 1 if this slot is used or is reserved to be used in the near
future (there is instruction in pipeline which will be saved to this slot).
When an entry in the RS is released, the corresponding entry in this table is switched from 1 to 0.
Internal methods
Compare and substitute
Input:
tag- identifier of field in RF which should be compared withid_rsXto check if there is need to storevaluevalue- value which should be stored in RS field if tag matchesposition- position in RS on which comparison and replacement should take place
Output:
null
Side effects:
When
tagmatches one ofid_rsXsaved in RS onpositionthenid_rsXis cleared (set to 0) andvalueis saved inval_rsX
Read row
Input:
position- which RS row should be read
Output:
opcode- instruction opcode for FUval_rs1- value of first operandval_rs2- value of second operandid_out- id of RF field where instruction output should be storedid_ROB- id of ROB entry which is allocated for this instruction
Side effects:
null
Clean row
Input:
position- RS row which should be cleaned
Output:
null
Side effects:
vbit for entry onpositionset to0
Mark slot as used
Input:
position- of slot which should be marked as used
Output:
null
Side effects:
positionslot in RS marked as used
Proposition of implementation of external interfaces
Get slot and mark as used
“Get free slot” position and call “Mark slot as used” with it.
Compare and substitute all
Invokes “Compare and substitute” for each row of RS.
Read and clean row
For given row r atomically “Read row” and “Clean row”