mirror of
https://github.com/openhwgroup/cva6.git
synced 2025-04-20 04:07:36 -04:00
document issue stage (#2598)
* Fill docs/design/design-manual/source/cva6_issue_stage.adoc * Add variables to docs/design/design-manual/source/design.adoc * Update port doc comments in core/issue_stage.sv, core/issue_read_operands.sv and core/scoreboard.sv
This commit is contained in:
parent
6a86ebd2af
commit
43edcd467e
5 changed files with 286 additions and 84 deletions
|
@ -33,63 +33,63 @@ module issue_read_operands
|
|||
input logic clk_i,
|
||||
// Asynchronous reset active low - SUBSYSTEM
|
||||
input logic rst_ni,
|
||||
// Flush - CONTROLLER
|
||||
// Prevent from issuing - CONTROLLER
|
||||
input logic flush_i,
|
||||
// Stall inserted by Acc dispatcher - ACC_DISPATCHER
|
||||
input logic stall_i,
|
||||
// TO_BE_COMPLETED - TO_BE_COMPLETED
|
||||
// Entry about the instruction to issue - SCOREBOARD
|
||||
input scoreboard_entry_t [CVA6Cfg.NrIssuePorts-1:0] issue_instr_i,
|
||||
// TO_BE_COMPLETED - TO_BE_COMPLETED
|
||||
// Instruction to issue - SCOREBOARD
|
||||
input logic [CVA6Cfg.NrIssuePorts-1:0][31:0] orig_instr_i,
|
||||
// TO_BE_COMPLETED - TO_BE_COMPLETED
|
||||
// Is there an instruction to issue - SCOREBOARD
|
||||
input logic [CVA6Cfg.NrIssuePorts-1:0] issue_instr_valid_i,
|
||||
// Issue stage acknowledge - TO_BE_COMPLETED
|
||||
// Issue stage acknowledge - SCOREBOARD
|
||||
output logic [CVA6Cfg.NrIssuePorts-1:0] issue_ack_o,
|
||||
// Forwarding - SCOREBOARD
|
||||
input forwarding_t fwd_i,
|
||||
// TO_BE_COMPLETED - TO_BE_COMPLETED
|
||||
// FU data useful to execute instruction - EX_STAGE
|
||||
output fu_data_t [CVA6Cfg.NrIssuePorts-1:0] fu_data_o,
|
||||
// Unregistered version of fu_data_o.operanda - TO_BE_COMPLETED
|
||||
// Unregistered version of fu_data_o.operanda - EX_STAGE
|
||||
output logic [CVA6Cfg.NrIssuePorts-1:0][CVA6Cfg.XLEN-1:0] rs1_forwarding_o,
|
||||
// Unregistered version of fu_data_o.operandb - TO_BE_COMPLETED
|
||||
// Unregistered version of fu_data_o.operandb - EX_STAGE
|
||||
output logic [CVA6Cfg.NrIssuePorts-1:0][CVA6Cfg.XLEN-1:0] rs2_forwarding_o,
|
||||
// Instruction pc - TO_BE_COMPLETED
|
||||
// Program Counter - EX_STAGE
|
||||
output logic [CVA6Cfg.VLEN-1:0] pc_o,
|
||||
// Is compressed instruction - TO_BE_COMPLETED
|
||||
// Is compressed instruction - EX_STAGE
|
||||
output logic is_compressed_instr_o,
|
||||
// Fixed Latency Unit ready to accept new request - TO_BE_COMPLETED
|
||||
// Fixed Latency Unit is ready - EX_STAGE
|
||||
input logic flu_ready_i,
|
||||
// ALU output is valid - TO_BE_COMPLETED
|
||||
// ALU output is valid - EX_STAGE
|
||||
output logic [CVA6Cfg.NrIssuePorts-1:0] alu_valid_o,
|
||||
// Branch instruction is valid - TO_BE_COMPLETED
|
||||
// Branch unit is valid - EX_STAGE
|
||||
output logic [CVA6Cfg.NrIssuePorts-1:0] branch_valid_o,
|
||||
// Transformed instruction - TO_BE_COMPLETED
|
||||
// Transformed trap instruction - EX_STAGE
|
||||
output logic [CVA6Cfg.NrIssuePorts-1:0][31:0] tinst_o,
|
||||
// TO_BE_COMPLETED - TO_BE_COMPLETED
|
||||
// Information of branch prediction - EX_STAGE
|
||||
output branchpredict_sbe_t branch_predict_o,
|
||||
// Load Store Unit is ready - TO_BE_COMPLETED
|
||||
// Load store unit FU is ready - EX_STAGE
|
||||
input logic lsu_ready_i,
|
||||
// Load Store Unit result is valid - TO_BE_COMPLETED
|
||||
// Load store unit FU is valid - EX_STAGE
|
||||
output logic [CVA6Cfg.NrIssuePorts-1:0] lsu_valid_o,
|
||||
// Mult result is valid - TO_BE_COMPLETED
|
||||
// Mult FU is valid - EX_STAGE
|
||||
output logic [CVA6Cfg.NrIssuePorts-1:0] mult_valid_o,
|
||||
// FPU is ready - TO_BE_COMPLETED
|
||||
// FPU FU is ready - EX_STAGE
|
||||
input logic fpu_ready_i,
|
||||
// FPU result is valid - TO_BE_COMPLETED
|
||||
// FPU FU is valid - EX_STAGE
|
||||
output logic [CVA6Cfg.NrIssuePorts-1:0] fpu_valid_o,
|
||||
// FPU fmt field from instruction - TO_BE_COMPLETED
|
||||
// FPU fmt field - EX_STAGE
|
||||
output logic [1:0] fpu_fmt_o,
|
||||
// FPU rm field from isntruction - TO_BE_COMPLETED
|
||||
// FPU rm field - EX_STAGE
|
||||
output logic [2:0] fpu_rm_o,
|
||||
// ALU output is valid - TO_BE_COMPLETED
|
||||
// ALU2 FU is valid - EX_STAGE
|
||||
output logic [CVA6Cfg.NrIssuePorts-1:0] alu2_valid_o,
|
||||
// CSR result is valid - TO_BE_COMPLETED
|
||||
// CSR is valid - EX_STAGE
|
||||
output logic [CVA6Cfg.NrIssuePorts-1:0] csr_valid_o,
|
||||
// CVXIF result is valid - TO_BE_COMPLETED
|
||||
// CVXIF FU is valid - EX_STAGE
|
||||
output logic [CVA6Cfg.NrIssuePorts-1:0] cvxif_valid_o,
|
||||
// CVXIF is ready - TO_BE_COMPLETED
|
||||
// CVXIF is FU ready - EX_STAGE
|
||||
input logic cvxif_ready_i,
|
||||
// CVXIF offloaded instruction - TO_BE_COMPLETED
|
||||
// CVXIF offloader instruction value - EX_STAGE
|
||||
output logic [31:0] cvxif_off_instr_o,
|
||||
// CVA6 Hart ID - SUBSYSTEM
|
||||
input logic [CVA6Cfg.XLEN-1:0] hart_id_i,
|
||||
|
@ -110,16 +110,16 @@ module issue_read_operands
|
|||
output logic x_transaction_rejected_o,
|
||||
output logic x_issue_writeback_o,
|
||||
output logic [CVA6Cfg.TRANS_ID_BITS-1:0] x_id_o,
|
||||
// TO_BE_COMPLETED - TO_BE_COMPLETED
|
||||
// Destination register in the register file - COMMIT_STAGE
|
||||
input logic [CVA6Cfg.NrCommitPorts-1:0][4:0] waddr_i,
|
||||
// TO_BE_COMPLETED - TO_BE_COMPLETED
|
||||
// Value to write to register file - COMMIT_STAGE
|
||||
input logic [CVA6Cfg.NrCommitPorts-1:0][CVA6Cfg.XLEN-1:0] wdata_i,
|
||||
// TO_BE_COMPLETED - TO_BE_COMPLETED
|
||||
// GPR write enable - COMMIT_STAGE
|
||||
input logic [CVA6Cfg.NrCommitPorts-1:0] we_gpr_i,
|
||||
// TO_BE_COMPLETED - TO_BE_COMPLETED
|
||||
// FPR write enable - COMMIT_STAGE
|
||||
input logic [CVA6Cfg.NrCommitPorts-1:0] we_fpr_i,
|
||||
|
||||
// Stall signal, we do not want to fetch any more entries - TO_BE_COMPLETED
|
||||
// Issue stall - PERF_COUNTERS
|
||||
output logic stall_issue_o
|
||||
);
|
||||
|
||||
|
|
|
@ -35,9 +35,9 @@ module issue_stage
|
|||
input logic rst_ni,
|
||||
// Is scoreboard full - PERF_COUNTERS
|
||||
output logic sb_full_o,
|
||||
// TO_BE_COMPLETED - CONTROLLER
|
||||
// Prevent from issuing - CONTROLLER
|
||||
input logic flush_unissued_instr_i,
|
||||
// TO_BE_COMPLETED - CONTROLLER
|
||||
// Flush whole scoreboard - CONTROLLER
|
||||
input logic flush_i,
|
||||
// Stall inserted by Acc dispatcher - ACC_DISPATCHER
|
||||
input logic stall_i,
|
||||
|
@ -65,7 +65,7 @@ module issue_stage
|
|||
output logic [CVA6Cfg.NrIssuePorts-1:0][31:0] tinst_o,
|
||||
// Fixed Latency Unit is ready - EX_STAGE
|
||||
input logic flu_ready_i,
|
||||
// ALU FU is valid - EX_STAGE
|
||||
// ALU output is valid - EX_STAGE
|
||||
output logic [CVA6Cfg.NrIssuePorts-1:0] alu_valid_o,
|
||||
// Branch unit is valid - EX_STAGE
|
||||
output logic [CVA6Cfg.NrIssuePorts-1:0] branch_valid_o,
|
||||
|
@ -125,25 +125,25 @@ module issue_stage
|
|||
output logic issue_instr_hs_o,
|
||||
// Transaction ID - EX_STAGE
|
||||
input logic [CVA6Cfg.NrWbPorts-1:0][CVA6Cfg.TRANS_ID_BITS-1:0] trans_id_i,
|
||||
// The branch engine uses the write back from the ALU - EX_STAGE
|
||||
// Result from branch unit - EX_STAGE
|
||||
input bp_resolve_t resolved_branch_i,
|
||||
// TO_BE_COMPLETED - EX_STAGE
|
||||
// Results to write back - EX_STAGE
|
||||
input logic [CVA6Cfg.NrWbPorts-1:0][CVA6Cfg.XLEN-1:0] wbdata_i,
|
||||
// exception from execute stage or CVXIF - EX_STAGE
|
||||
input exception_t [CVA6Cfg.NrWbPorts-1:0] ex_ex_i,
|
||||
// TO_BE_COMPLETED - EX_STAGE
|
||||
// Indicates valid results - EX_STAGE
|
||||
input logic [CVA6Cfg.NrWbPorts-1:0] wt_valid_i,
|
||||
// CVXIF write enable - EX_STAGE
|
||||
input logic x_we_i,
|
||||
// CVXIF destination register - ISSUE_STAGE
|
||||
// CVXIF destination register - EX_STAGE
|
||||
input logic [4:0] x_rd_i,
|
||||
// TO_BE_COMPLETED - EX_STAGE
|
||||
// Destination register in register file - COMMIT_STAGE
|
||||
input logic [CVA6Cfg.NrCommitPorts-1:0][4:0] waddr_i,
|
||||
// TO_BE_COMPLETED - EX_STAGE
|
||||
// Value to write to register file - COMMIT_STAGE
|
||||
input logic [CVA6Cfg.NrCommitPorts-1:0][CVA6Cfg.XLEN-1:0] wdata_i,
|
||||
// GPR write enable - EX_STAGE
|
||||
// GPR write enable - COMMIT_STAGE
|
||||
input logic [CVA6Cfg.NrCommitPorts-1:0] we_gpr_i,
|
||||
// FPR write enable - EX_STAGE
|
||||
// FPR write enable - COMMIT_STAGE
|
||||
input logic [CVA6Cfg.NrCommitPorts-1:0] we_fpr_i,
|
||||
// Instructions to commit - COMMIT_STAGE
|
||||
output scoreboard_entry_t [CVA6Cfg.NrCommitPorts-1:0] commit_instr_o,
|
||||
|
|
|
@ -25,68 +25,68 @@ module scoreboard #(
|
|||
input logic clk_i,
|
||||
// Asynchronous reset active low - SUBSYSTEM
|
||||
input logic rst_ni,
|
||||
// TO_BE_COMPLETED - TO_BE_COMPLETED
|
||||
// Is scoreboard full - PERF_COUNTERS
|
||||
output logic sb_full_o,
|
||||
// Flush only un-issued instructions - TO_BE_COMPLETED
|
||||
// Prevent from issuing - CONTROLLER
|
||||
input logic flush_unissued_instr_i,
|
||||
// Flush whole scoreboard - TO_BE_COMPLETED
|
||||
// Flush whole scoreboard - CONTROLLER
|
||||
input logic flush_i,
|
||||
// Writeback Handling of CVXIF
|
||||
// TO_BE_COMPLETED - TO_BE_COMPLETED
|
||||
// TO_BE_COMPLETED - ISSUE_READ_OPERANDS
|
||||
input logic x_transaction_accepted_i,
|
||||
// TO_BE_COMPLETED - TO_BE_COMPLETED
|
||||
// TO_BE_COMPLETED - ISSUE_READ_OPERANDS
|
||||
input logic x_issue_writeback_i,
|
||||
// TO_BE_COMPLETED - TO_BE_COMPLETED
|
||||
// TO_BE_COMPLETED - ISSUE_READ_OPERANDS
|
||||
input logic [CVA6Cfg.TRANS_ID_BITS-1:0] x_id_i,
|
||||
// advertise instruction to commit stage, if commit_ack_i is asserted advance the commit pointer
|
||||
// TO_BE_COMPLETED - TO_BE_COMPLETED
|
||||
// Instructions to commit - COMMIT_STAGE
|
||||
output scoreboard_entry_t [CVA6Cfg.NrCommitPorts-1:0] commit_instr_o,
|
||||
// TO_BE_COMPLETED - TO_BE_COMPLETED
|
||||
// Instruction is cancelled - COMMIT_STAGE
|
||||
output logic [CVA6Cfg.NrCommitPorts-1:0] commit_drop_o,
|
||||
// TO_BE_COMPLETED - TO_BE_COMPLETED
|
||||
// Commit acknowledge - COMMIT_STAGE
|
||||
input logic [CVA6Cfg.NrCommitPorts-1:0] commit_ack_i,
|
||||
|
||||
// instruction to put on top of scoreboard e.g.: top pointer
|
||||
// we can always put this instruction to the top unless we signal with asserted full_o
|
||||
// TO_BE_COMPLETED - TO_BE_COMPLETED
|
||||
// Handshake's data with decode stage - ID_STAGE
|
||||
input scoreboard_entry_t [CVA6Cfg.NrIssuePorts-1:0] decoded_instr_i,
|
||||
// TO_BE_COMPLETED - TO_BE_COMPLETED
|
||||
// instruction value - ID_STAGE
|
||||
input logic [CVA6Cfg.NrIssuePorts-1:0][31:0] orig_instr_i,
|
||||
// TO_BE_COMPLETED - TO_BE_COMPLETED
|
||||
// Handshake's valid with decode stage - ID_STAGE
|
||||
input logic [CVA6Cfg.NrIssuePorts-1:0] decoded_instr_valid_i,
|
||||
// TO_BE_COMPLETED - TO_BE_COMPLETED
|
||||
// Handshake's acknowlege with decode stage - ID_STAGE
|
||||
output logic [CVA6Cfg.NrIssuePorts-1:0] decoded_instr_ack_o,
|
||||
|
||||
// instruction to issue logic, if issue_instr_valid and issue_ready is asserted, advance the issue pointer
|
||||
// Issue scoreboard entry - ACC_DISPATCHER
|
||||
// Entry about the instruction to issue - ISSUE_READ_OPERANDS
|
||||
output scoreboard_entry_t [CVA6Cfg.NrIssuePorts-1:0] issue_instr_o,
|
||||
// TO_BE_COMPLETED - TO_BE_COMPLETED
|
||||
// Instruction to issue - ISSUE_READ_OPERANDS
|
||||
output logic [CVA6Cfg.NrIssuePorts-1:0][31:0] orig_instr_o,
|
||||
// TO_BE_COMPLETED - TO_BE_COMPLETED
|
||||
// Is there an instruction to issue - ISSUE_READ_OPERANDS
|
||||
output logic [CVA6Cfg.NrIssuePorts-1:0] issue_instr_valid_o,
|
||||
// TO_BE_COMPLETED - TO_BE_COMPLETED
|
||||
// Issue stage acknowledge - ISSUE_READ_OPERANDS
|
||||
input logic [CVA6Cfg.NrIssuePorts-1:0] issue_ack_i,
|
||||
// Forwarding - issue_read_operands
|
||||
// Forwarding - ISSUE_READ_OPERANDS
|
||||
output forwarding_t fwd_o,
|
||||
|
||||
// TO_BE_COMPLETED - TO_BE_COMPLETED
|
||||
// Result from branch unit - EX_STAGE
|
||||
input bp_resolve_t resolved_branch_i,
|
||||
// Transaction ID at which to write the result back - TO_BE_COMPLETED
|
||||
// Transaction ID at which to write the result back - EX_STAGE
|
||||
input logic [CVA6Cfg.NrWbPorts-1:0][CVA6Cfg.TRANS_ID_BITS-1:0] trans_id_i,
|
||||
// Results to write back - TO_BE_COMPLETED
|
||||
// Results to write back - EX_STAGE
|
||||
input logic [CVA6Cfg.NrWbPorts-1:0][CVA6Cfg.XLEN-1:0] wbdata_i,
|
||||
// Exception from a functional unit (e.g.: ld/st exception) - TO_BE_COMPLETED
|
||||
// Exception from a functional unit (e.g.: ld/st exception) - EX_STAGE
|
||||
input exception_t [CVA6Cfg.NrWbPorts-1:0] ex_i,
|
||||
// Indicates valid results - TO_BE_COMPLETED
|
||||
// Indicates valid results - EX_STAGE
|
||||
input logic [CVA6Cfg.NrWbPorts-1:0] wt_valid_i,
|
||||
// Cvxif we for writeback - TO_BE_COMPLETED
|
||||
// Cvxif we for writeback - EX_STAGE
|
||||
input logic x_we_i,
|
||||
// CVXIF destination register - ISSUE_STAGE
|
||||
input logic [4:0] x_rd_i,
|
||||
|
||||
// TO_BE_COMPLETED - RVFI
|
||||
// Issue pointer - RVFI
|
||||
output logic [ CVA6Cfg.NrIssuePorts-1:0][CVA6Cfg.TRANS_ID_BITS-1:0] rvfi_issue_pointer_o,
|
||||
// TO_BE_COMPLETED - RVFI
|
||||
// Commit pointer - RVFI
|
||||
output logic [CVA6Cfg.NrCommitPorts-1:0][CVA6Cfg.TRANS_ID_BITS-1:0] rvfi_commit_pointer_o
|
||||
);
|
||||
|
||||
|
|
|
@ -16,21 +16,31 @@ ISSUE_STAGE Module
|
|||
Description
|
||||
^^^^^^^^^^^
|
||||
|
||||
The execution can be roughly divided into four parts: issue(1), read
|
||||
operands(2), execute(3) and write-back(4). The ISSUE_STAGE module
|
||||
handles step one, two and four. The ISSUE_STAGE module receives the
|
||||
decoded instructions and issues them to the various functional units.
|
||||
ISSUE_STAGE issues instructions (1), reorders their results (2) and sends completed instructions in-order to COMMIT_STAGE (3).
|
||||
|
||||
A data structure called scoreboard is used to keep track of data related
|
||||
to the issue instruction: which functional unit and which destination
|
||||
register they are. The scoreboard handle the write-back data received
|
||||
from the COMMIT_STAGE module.
|
||||
(1) ISSUE_STAGE issues instructions in-order.
|
||||
It makes sure that instructions from ID_STAGE have everything they need to run.
|
||||
It waits until all requirements are met.
|
||||
Once an instruction is ready to run, ISSUE_STAGE sends it to EX_STAGE with its operands.
|
||||
|
||||
Furthermore it contains the CPU’s register file.
|
||||
(2) ISSUE_STAGE reorders instructions results.
|
||||
It gets results of instruction executions out-of-order from EX_STAGE.
|
||||
ISSUE_STAGE stores these results reordered.
|
||||
|
||||
(3) ISSUE_STAGE sends completed instructions in-order to COMMIT_STAGE.
|
||||
This is where architectural state is modified.
|
||||
|
||||
Scoreboard module keeps track of instructions and their results.
|
||||
Issue_read_operands module contains all the issue logic and the register file.
|
||||
|
||||
The module is connected to:
|
||||
|
||||
* TO BE COMPLETED
|
||||
* CONTROLLER module can request to flush the pipeline buffer at the end of ISSUE_STAGE.
|
||||
CONTROLLER module can also request to flush the whole Scoreboard.
|
||||
* ID_STAGE module delivers decoded instructions to ISSUE_STAGE.
|
||||
* EX_STAGE module gets instructions issued by ISSUE_STAGE to execute them.
|
||||
EX_STAGE module also returns results to ISSUE_STAGE.
|
||||
* COMMIT_STAGE module delivers ISSUE_STAGE clearance to remove the oldest instruction from Scoreboard.
|
||||
|
||||
include::port_issue_stage.adoc[]
|
||||
|
||||
|
@ -38,7 +48,23 @@ include::port_issue_stage.adoc[]
|
|||
Functionality
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
TO BE COMPLETED
|
||||
ISSUE_STAGE has three functionalities.
|
||||
|
||||
(1) ISSUE_STAGE issues instructions.
|
||||
Instructions from ID_STAGE are sent to Scoreboard module, which forwards them to Issue_read_operands module.
|
||||
Issue_read_operands queries Scoreboard module for data dependences (Scoreboard is also able to return forwarded values) and gets the list of busy functional units from EX_STAGE.
|
||||
Issue_read_operands sends to EX_STAGE the instructions to execute and acknowledges to Scoreboard so that it stores them: the instruction is issued.
|
||||
Issued instructions are acknowledged to ID_STAGE.
|
||||
Each of these steps can block its successors.
|
||||
The flush signal from CONTROLLER module is also sent to Scoreboard module to prevent from issuing.
|
||||
Instructions are issued in-order: an instruction cannot be issued unless all its predecessors are issued.
|
||||
|
||||
(2) ISSUE_STAGE reorders instructions results.
|
||||
Results from EX_STAGE are sent to Scoreboard module so that they are stored.
|
||||
|
||||
(3) ISSUE_STAGE sends completed instructions in-order to COMMIT_STAGE.
|
||||
The oldest instructions from Scoreboard are exposed to COMMIT_STAGE.
|
||||
When COMMIT_STAGE acknowledges a commit, the committed instruction is removed from Scoreboard and the register file in Issue_read_operands is updated with the instruction result.
|
||||
|
||||
[[issue_stage-submodules]]
|
||||
Submodules
|
||||
|
@ -50,9 +76,53 @@ image:issue_stage_modules.png[ISSUE_STAGE submodules]
|
|||
Scoreboard
|
||||
++++++++++
|
||||
|
||||
The scoreboard contains a FIFO to store the decoded instructions. Issued
|
||||
instruction is pushed to the FIFO if it is not full. It indicates which
|
||||
registers are going to be clobbered by a previously issued instruction.
|
||||
Scoreboard contains a FIFO which contains an entry for each issued instruction.
|
||||
Each entry is removed once the instruction is committed.
|
||||
Instruction results are inserted into Scoreboard when they are ready.
|
||||
The FIFO is flushed when requested by CONTROLLER.
|
||||
|
||||
Scoreboard is used in all three functionalities of ISSUE_STAGE.
|
||||
|
||||
(1) ISSUE_STAGE issues instructions.
|
||||
Up to {issue-width} instruction(s) can be received from ID_STAGE each cycle.
|
||||
They are transmitted to Issue_read_operands with incremental transaction IDs which wrap at {NrScoreboardEntries}.
|
||||
The result buses and Scoreboard entries are also transmitted to Issue_read_operands for it to detect data dependences and perform operand forwarding.
|
||||
When Issue_read_operands acknowledges an instruction, it is inserted into the FIFO.
|
||||
|
||||
Scoreboard has a capacity of {NrScoreboardEntries} entries.
|
||||
Instructions which would make Scoreboard overflow are not transmitted to Issue_read_operands (ISSUE_STAGE stalls).
|
||||
|
||||
The flush signal from CONTROLLER module removes all entries from the Scoreboard and prevents from issuing.
|
||||
The transaction ID of the next issued instruction is 0.
|
||||
|
||||
(2) ISSUE_STAGE reorders instructions results.
|
||||
Results are returned from functional units in the EX_STAGE to Scoreboard via result buses, with their transaction IDs.
|
||||
Scoreboard stores this result into the entry associated with this transaction ID.
|
||||
If an exception is returned, it is stored too.
|
||||
ifeval::[{SpeculativeSb} == true]
|
||||
If the result is a branch miss, the speculative instructions following it are cancelled.
|
||||
endif::[]
|
||||
|
||||
ifeval::[{RVZCMP} == true]
|
||||
FIXME Document behavior related to macro instructions
|
||||
endif::[]
|
||||
|
||||
ifeval::[{DebugEn} == true]
|
||||
FIXME Document behavior related to debug
|
||||
endif::[]
|
||||
|
||||
ifeval::[{CvxifEn} == true]
|
||||
FIXME Document behavior related to CV-X-IF
|
||||
endif::[]
|
||||
|
||||
ifeval::[{FpPresent} == true]
|
||||
FIXME Document behavior related to FPU
|
||||
endif::[]
|
||||
|
||||
(3) ISSUE_STAGE sends completed instructions in-order to COMMIT_STAGE.
|
||||
Each of the {commit-width} oldest entry(ies) in Scoreboard are exposed to COMMIT_STAGE, one per commit port.
|
||||
This makes commit happen in-order.
|
||||
When COMMIT_STAGE acknowledges on a commit port, the entry is removed from Scoreboard.
|
||||
|
||||
include::port_scoreboard.adoc[]
|
||||
|
||||
|
@ -60,6 +130,118 @@ include::port_scoreboard.adoc[]
|
|||
Issue_read_operands
|
||||
+++++++++++++++++++
|
||||
|
||||
TO BE COMPLETED
|
||||
Issue_read_operands tracks hazards and gets the input operands for the instructions to execute.
|
||||
The following hazards can prevent instructions from being issued.
|
||||
|
||||
* Data hazards: ISSUE_STAGE checks that the instruction operands are available.
|
||||
|
||||
** [[raw_hazard]] Read-After-Write (RAW): if one of the source registers of the instruction to issue is the destination register of one of the instructions in the Scoreboard, issue is blocked.
|
||||
However, CVA6 implements operand forwarding: instead of blocking the instruction, the operand is taken from either +
|
||||
a) a functional unit which returns a result which is not an exception, with a transaction ID which points to a Scoreboard entry whose destination register is the requested source register; +
|
||||
b) a Scoreboard entry whose destination register is the requested source register has a result which is not an exception. +
|
||||
Forwarding is not possible from CSR instructions.
|
||||
ifeval::[{RVS} == true]
|
||||
FIXME Document behavior related to SFENCE_VMA
|
||||
endif::[]
|
||||
+
|
||||
ifeval::[{SuperscalarEn} == true]
|
||||
The instruction in the second issue port is not issued when one of its source registers is the destination register of the instruction in the first issue port.
|
||||
No operand forwarding is possible between the two issue ports.
|
||||
endif::[]
|
||||
|
||||
** Write-After-Write (WAW): if the instruction to issue has the same destination register as one of the instructions in the Scoreboard, issue is blocked.
|
||||
Instructions being committed are ignored because the will not be in the scoreboard anymore since the next cycle.
|
||||
+
|
||||
ifeval::[{SuperscalarEn} == true]
|
||||
The instruction in the second issue port is not issued when it has the same destination register as the instruction in the first issue port.
|
||||
endif::[]
|
||||
|
||||
** Special case: there are no data hazards on `x0`.
|
||||
|
||||
ifeval::[{SpeculativeSb} == true]
|
||||
** Cancelled instructions are ignored by the hazard detection mechanism.
|
||||
endif::[]
|
||||
|
||||
ifeval::[{CvxifEn} == true]
|
||||
** FIXME hazards related to CV-X-IF
|
||||
endif::[]
|
||||
|
||||
* Structural hazards: ISSUE_STAGE checks that a functional unit (FU) and its result bus (RB) are ready to execute the instruction.
|
||||
|
||||
** Integer division instructions and some^[FIXME{sp}which?]^ CSR instructions have an unknown latency.
|
||||
When EX_STAGE reports that such an instruction is running, instructions using ALU, BRANCH, CSR or MULT are blocked.
|
||||
This is to avoid conflicts on the RB shared by these four FUs.
|
||||
ifeval::[{SuperscalarEn} == true]
|
||||
Note that ALU2 might still be available.
|
||||
endif::[]
|
||||
|
||||
** Multiplications have a fixed latency of 2 cycles.
|
||||
Instructions using ALU, BRANCH or CSR are blocked if an instruction using MULT was issued one cycle earlier.
|
||||
This is to avoid conflicts on the RB shared by these four FUs.
|
||||
ifeval::[{SuperscalarEn} == true]
|
||||
Note that ALU2 might still be available.
|
||||
endif::[]
|
||||
Instructions using MULT are not blocked because the multiplier is pipelined and can accept one instruction each cycle.
|
||||
|
||||
ifeval::[{FpPresent} == true]
|
||||
** FIXME hazards related to FPU
|
||||
endif::[]
|
||||
|
||||
** Instructions using LSU are blocked if LSU is not ready.
|
||||
|
||||
ifeval::[{SuperscalarEn} == true]
|
||||
** The second issue port cannot issue instructions using CSR.
|
||||
|
||||
ifeval::[{CvxifEn} == true]
|
||||
** The second issue port cannot issue instructions using CV-X-IF.
|
||||
endif::[]
|
||||
|
||||
** The second issue port cannot issue an instruction using a FU when the first port issues an instruction using the same FU.
|
||||
This is because a FU can only accept one instruction each cycle.
|
||||
|
||||
** When both ALU and ALU2 are available, ALU instructions use ALU2.
|
||||
|
||||
** The second issue port cannot issue an instruction using ALU, BRANCH or CSR when the first issue port is issuing an instruction using ALU, BRANCH or CSR.
|
||||
This is to avoid conflicts on the RB shared by these four FUs.
|
||||
Note that ALU2 might still be available.
|
||||
|
||||
* Control hazards: ISSUE_STAGE checks that no instruction is executed speculatively while it must not.
|
||||
|
||||
** The second issue port is completely blocked when the first port issues an instruction using CSR.
|
||||
|
||||
** The second issue port
|
||||
ifeval::[{SpeculativeSb} == true]
|
||||
cannot issue an instruction using LSU
|
||||
endif::[]
|
||||
ifeval::[{SpeculativeSb} == false]
|
||||
is completely blocked
|
||||
endif::[]
|
||||
when the first issue port issues an instruction using BRANCH, unless it is a JAL.
|
||||
|
||||
// {SuperscalarEn} == true
|
||||
endif::[]
|
||||
|
||||
Data hazards are ignored when an exception occurred earlier in the pipeline.
|
||||
As no FU is involved, there are no structural hazards either.
|
||||
|
||||
Instructions are issued in-order, which means that when an instruction makes ISSUE_STAGE stall, next instructions are blocked.
|
||||
ifeval::[{SuperscalarEn} == true]
|
||||
As a consequence, it is not possible to issue the instruction in the second issue port when the instruction in the first issue port is blocked.
|
||||
endif::[]
|
||||
|
||||
ifeval::[{SuperscalarEn} == true]
|
||||
However, it is possible that the instruction in the first issue port is issued while the instruction in the second issue port is not.
|
||||
In such case, ID_STAGE moves the instruction in the second issue port to the first issue port so that it is issued next.
|
||||
endif::[]
|
||||
|
||||
The input operands provided to EX_STAGE come from the register file by default.
|
||||
However, when one of the source registers has a RAW dependence, the corresponding input operand is replaced by the forwarded value (see <<raw_hazard,Data hazards/RAW hazards>> above).
|
||||
The register file is an instance of `ariane_regfile` where ach register stores {XLEN} bits and the register at index 0 is wired to zero.
|
||||
|
||||
ifeval::[{CvxifEn} == true]
|
||||
FIXME Document behavior related to CV-X-IF
|
||||
endif::[]
|
||||
|
||||
Instructions are sent to EX_STAGE via a register so they are visible in EX_STAGE one cycle after being issued.
|
||||
|
||||
include::port_issue_read_operands.adoc[]
|
||||
|
|
|
@ -15,11 +15,31 @@ ifeval::[{SuperscalarEn} == true]
|
|||
:ifetch-len: 64
|
||||
:instr-per-fetch: 4
|
||||
:issue-width: 2
|
||||
:commit-width: 2
|
||||
endif::[]
|
||||
ifeval::[{SuperscalarEn} == false]
|
||||
:ifetch-len: 32
|
||||
:instr-per-fetch: 2
|
||||
:issue-width: 1
|
||||
:commit-width: {NrCommmitPorts}
|
||||
endif::[]
|
||||
:SpeculativeSb: {SuperscalarEn}
|
||||
|
||||
:FpPresent: false
|
||||
ifeval::[{RVF} == true]
|
||||
:FpPresent: true
|
||||
endif::[]
|
||||
ifeval::[{RVD} == true]
|
||||
:FpPresent: true
|
||||
endif::[]
|
||||
ifeval::[{XF16} == true]
|
||||
:FpPresent: true
|
||||
endif::[]
|
||||
ifeval::[{XF16ALT} == true]
|
||||
:FpPresent: true
|
||||
endif::[]
|
||||
ifeval::[{XF8} == true]
|
||||
:FpPresent: true
|
||||
endif::[]
|
||||
|
||||
[[DesignDocument]]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue