Skip to content

Commit 1dbb288

Browse files
committed
Add FU-CDB pipeline: adapter, ALU shim, MUL/DIV shim into tomasulo_wrapper
Phase A: fu_cdb_adapter — one-deep holding register between FU and CDB arbiter. Combinational pass-through when granted same cycle, latches and re-presents otherwise. Includes formal properties and 11 cocotb tests. Standalone SymbiYosys config in formal/. Phase B: Add `pc` field to rs_dispatch_t / rs_issue_t so shims can compute AUIPC/JAL link addresses. Plumbed through RS, testbench wrappers, and cocotb interfaces/models. Phase C: int_alu_shim + fu_cdb_adapter integrated into tomasulo_wrapper. INT_RS issues internally through the ALU shim and adapter to CDB arbiter slot 0, replacing the external i_fu_complete[0] path. fu_ready gated by adapter back-pressure. All 26 wrapper tests updated (backward-compat CDB methods moved from FU_ALU to FU_MUL). Phase D: int_muldiv_shim integrated into tomasulo_wrapper. MUL_RS issues internally through the muldiv shim (standalone multiplier + divider instances) to two fu_cdb_adapters driving CDB arbiter slots 1 and 2. Per-FU in-flight tracking with flush suppression. fu_ready gated by busy + both adapter pending signals. Tests updated: CDB backward-compat methods moved from FU_MUL to FU_MEM (slot 3), arbitration contention test uses external-only slots (MEM/FP_ADD/ FP_DIV), MANUAL_CDB_RS_TYPES excludes MUL_RS. After this commit, CDB slots 0-2 are driven by internal FU pipelines (ALU, MUL, DIV). Slots 3-6 remain external (MEM, FP_ADD, FP_MUL, FP_DIV).
1 parent f0d57b7 commit 1dbb288

26 files changed

+2613
-82
lines changed

formal/fu_cdb_adapter.sby

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[tasks]
2+
bmc
3+
cover
4+
5+
[options]
6+
bmc: mode bmc
7+
bmc: depth 8
8+
cover: mode cover
9+
cover: depth 12
10+
11+
[engines]
12+
smtbmc boolector
13+
14+
[script]
15+
read -formal -sv riscv_pkg.sv
16+
read -formal -sv fu_cdb_adapter.sv
17+
prep -top fu_cdb_adapter
18+
19+
[files]
20+
../hw/rtl/cpu_and_mem/cpu/riscv_pkg.sv
21+
../hw/rtl/cpu_and_mem/cpu/tomasulo/fu_cdb_adapter/fu_cdb_adapter.sv

formal/tomasulo_wrapper.sby

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ read -sv reorder_buffer.sv
1919
read -sv register_alias_table.sv
2020
read -sv reservation_station.sv
2121
read -sv cdb_arbiter.sv
22+
read -sv fu_cdb_adapter.sv
23+
read -sv int_alu_shim.sv
24+
read -sv int_muldiv_shim.sv
25+
read -sv divider.sv
26+
read -sv dsp_tiled_multiplier_unsigned.sv
27+
read -sv multiplier.sv
28+
read -sv alu.sv
2229
read -formal -sv tomasulo_wrapper.sv
2330
prep -top tomasulo_wrapper
2431

@@ -30,4 +37,11 @@ prep -top tomasulo_wrapper
3037
../hw/rtl/cpu_and_mem/cpu/tomasulo/register_alias_table/register_alias_table.sv
3138
../hw/rtl/cpu_and_mem/cpu/tomasulo/reservation_station/reservation_station.sv
3239
../hw/rtl/cpu_and_mem/cpu/tomasulo/cdb_arbiter/cdb_arbiter.sv
40+
../hw/rtl/cpu_and_mem/cpu/tomasulo/fu_cdb_adapter/fu_cdb_adapter.sv
41+
../hw/rtl/cpu_and_mem/cpu/tomasulo/fu_shims/int_alu_shim.sv
42+
../hw/rtl/cpu_and_mem/cpu/tomasulo/fu_shims/int_muldiv_shim.sv
43+
../hw/rtl/cpu_and_mem/cpu/ex_stage/alu/divider.sv
44+
../hw/rtl/cpu_and_mem/cpu/ex_stage/dsp_tiled_multiplier_unsigned.sv
45+
../hw/rtl/cpu_and_mem/cpu/ex_stage/alu/multiplier.sv
46+
../hw/rtl/cpu_and_mem/cpu/ex_stage/alu/alu.sv
3347
../hw/rtl/cpu_and_mem/cpu/tomasulo/tomasulo_wrapper/tomasulo_wrapper.sv

hw/rtl/cpu_and_mem/cpu/riscv_pkg.sv

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,6 +1420,8 @@ package riscv_pkg;
14201420
// CSR info
14211421
logic [11:0] csr_addr;
14221422
logic [4:0] csr_imm;
1423+
// Program counter (for ALU: AUIPC, JAL/JALR link address)
1424+
logic [XLEN-1:0] pc;
14231425
} rs_dispatch_t;
14241426

14251427
// RS issue signals (from RS to functional unit)
@@ -1443,6 +1445,8 @@ package riscv_pkg;
14431445
// CSR info
14441446
logic [11:0] csr_addr;
14451447
logic [4:0] csr_imm;
1448+
// Program counter (for ALU: AUIPC, JAL/JALR link address)
1449+
logic [XLEN-1:0] pc;
14461450
} rs_issue_t;
14471451

14481452
// ---------------------------------------------------------------------------
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# FU CDB Adapter
2+
3+
One-deep holding register that sits between a functional unit and the CDB
4+
arbiter. Provides back-pressure signaling, zero-latency combinational
5+
pass-through when the arbiter grants immediately, and pipeline flush support.
6+
7+
## Ports
8+
9+
| Port | Dir | Type | Description |
10+
|------|-----|------|-------------|
11+
| `i_clk` | in | logic | Clock |
12+
| `i_rst_n` | in | logic | Active-low reset |
13+
| `i_fu_result` | in | `fu_complete_t` | FU result (level signal) |
14+
| `o_fu_complete` | out | `fu_complete_t` | To CDB arbiter |
15+
| `i_grant` | in | logic | CDB arbiter grant |
16+
| `o_result_pending` | out | logic | Back-pressure to RS |
17+
| `i_flush` | in | logic | Pipeline flush |
18+
19+
## State Machine
20+
21+
- **IDLE**: Pass-through from `i_fu_result` to `o_fu_complete`
22+
- **PENDING**: Output from held register, waiting for grant
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# FU CDB Adapter file list
2+
# One-deep holding register between FU output and CDB arbiter
3+
4+
# Package dependency
5+
$(ROOT)/hw/rtl/cpu_and_mem/cpu/riscv_pkg.sv
6+
7+
# Module
8+
$(ROOT)/hw/rtl/cpu_and_mem/cpu/tomasulo/fu_cdb_adapter/fu_cdb_adapter.sv

0 commit comments

Comments
 (0)