-
Notifications
You must be signed in to change notification settings - Fork 16
RS_impl
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.
This is a buffer which has R
rows. Each row has the following structure:
v | opcode | id_out |
id_ROB |
id_rs1 |
val_rs1 |
id_rs2 |
val_rs2 |
---|
-
v
- "valid" - it is 1 if entry is a correct instruction which waits to be filled with operands/dispatched -
id_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_rsX
field and we put zero toid_rsX
- The instruction is ready to be dispatched if
v
is1
and bothid_rs1
,id_rs2
are0
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
.
Input:
-
tag
- identifier of field in RF which should be compared withid_rsX
to check if there is need to storevalue
-
value
- value which should be stored in RS field if tag matches -
position
- position in RS on which comparison and replacement should take place
Output:
- null
Side effects:
- When
tag
matches one ofid_rsX
saved in RS onposition
thenid_rsX
is cleared (set to 0) andvalue
is saved inval_rsX
Input:
-
position
- which RS row should be read
Output:
-
opcode
- instruction opcode for FU -
val_rs1
- value of first operand -
val_rs2
- value of second operand -
id_out
- id of RF field where instruction output should be stored -
id_ROB
- id of ROB entry which is allocated for this instruction
Side effects:
- null
Input:
-
position
- RS row which should be cleaned
Output:
- null
Side effects:
-
v
bit for entry onposition
set to0
Input:
- null
Output:
-
position
- of the free slot in the RS
Side effects:
- null
Input:
-
position
- of slot which should be marked as used
Output:
- null
Side effects:
-
position
slot in RS marked as used
"Get free slot" position and call "Mark slot as used" with it.
Invokes "Compare and substitute" for each row of RS.
For given row r
atomically "Read row" and "Clean row"