11// Copyright 2017-2019 ETH Zurich and University of Bologna.
22// Copyright 2025 Bruno Sá and Zero-Day Labs.
3+ // Copyright 2025 Capabilities Limited.
34// Copyright and related rights are licensed under the Solderpad Hardware
45// License, Version 0.51 (the "License"); you may not use this file except in
56// compliance with the License. You may obtain a copy of the License at
@@ -30,7 +31,6 @@ module cva6
3031 logic csr;
3132 rvfi_probes_instr_t instr;
3233 } ,
33- parameter type rvfi_dii_inst_pack_t = `RVFI_DII_INSTR_T (CVA6Cfg),
3434
3535 // branchpredict scoreboard entry
3636 // this is the struct which we will inject into the pipeline to guide the various
@@ -66,6 +66,7 @@ module cva6
6666 // I$ data requests
6767 localparam type icache_dreq_t = struct packed {
6868 logic req; // we request a new word
69+ logic [CVA6Cfg.DIIIDLEN - 1 : 0 ] dii_id; // next requested DII ID in instruction stream
6970 logic kill_s1; // kill the current request
7071 logic kill_s2; // kill the last request
7172 logic spec; // request is speculative
@@ -78,13 +79,15 @@ module cva6
7879 logic [CVA6Cfg.FETCH_WIDTH - 1 : 0 ] data; // 2+ cycle out: tag
7980 logic [CVA6Cfg.FETCH_USER_WIDTH - 1 : 0 ] user; // User bits
8081 logic [CVA6Cfg.VLEN - 1 : 0 ] vaddr; // virtual address out
82+ logic [CVA6Cfg.DIIIDLEN - 1 : 0 ] dii_id; // First DII ID in the returned data
8183 exception_t ex; // we've encountered an exception
8284 } ,
8385
8486 // IF/ID Stage
8587 // store the decompressed instruction
8688 localparam type fetch_entry_t = struct packed {
8789 logic [CVA6Cfg.PCLEN - 1 : 0 ] address; // the address of the instructions from below
90+ logic [CVA6Cfg.DIIIDLEN - 1 : 0 ] dii_id; // the DII ID of the instruction in the stream
8891 logic [31 : 0 ] instruction; // instruction word
8992 branchpredict_sbe_t branch_predict; // this field contains branch prediction information regarding the forward branch path
9093 exception_t ex; // this field contains exceptions which might have happened earlier, e.g.: fetch exceptions
@@ -93,6 +96,7 @@ module cva6
9396 // ID/EX/WB Stage
9497 localparam type scoreboard_entry_t = struct packed {
9598 logic [CVA6Cfg.PCLEN - 1 : 0 ] pc; // PC of instruction
99+ logic [CVA6Cfg.DIIIDLEN - 1 : 0 ] dii_id; // DII ID of the instruction in the stream
96100 logic [CVA6Cfg.REGLEN - 1 : 0 ] ddc;
97101 logic [CVA6Cfg.TRANS_ID_BITS - 1 : 0 ] trans_id; // this can potentially be simplified, we could index the scoreboard entry
98102 // with the transaction id in any case make the width more generic
@@ -130,6 +134,7 @@ module cva6
130134 localparam type bp_resolve_t = struct packed {
131135 logic valid; // prediction with all its values is valid
132136 logic [CVA6Cfg.VLEN - 1 : 0 ] pc; // PC of predict or mis-predict
137+ logic [CVA6Cfg.DIIIDLEN - 1 : 0 ] dii_id; // dii id of branch
133138 logic [CVA6Cfg.PCLEN - 1 : 0 ] target_address; // target address at which to jump, or not
134139 logic is_mispredict; // set if this was a mis-predict
135140 logic is_taken; // branch is taken
@@ -311,9 +316,6 @@ module cva6
311316 input logic debug_req_i,
312317 // Probes to build RVFI, can be left open when not used - RVFI
313318 output rvfi_probes_t rvfi_probes_o,
314- input logic rvfi_dii_rtrn_vld_i,
315- input rvfi_dii_inst_pack_t rvfi_dii_inst_pack_i,
316- output logic rvfi_dii_data_ready_o,
317319 // CVXIF request - SUBSYSTEM
318320 output cvxif_req_t cvxif_req_o,
319321 // CVXIF response - SUBSYSTEM
@@ -359,6 +361,7 @@ module cva6
359361 exception_t ex_commit; // exception from commit stage
360362 bp_resolve_t resolved_branch;
361363 logic [ CVA6Cfg.PCLEN - 1 : 0 ] pc_commit;
364+ logic [ CVA6Cfg.DIIIDLEN - 1 : 0 ] dii_id_commit;
362365 logic eret;
363366 logic [CVA6Cfg.NrCommitPorts- 1 : 0 ] commit_ack;
364367 logic [CVA6Cfg.NrCommitPorts- 1 : 0 ] commit_macro_ack;
@@ -396,6 +399,7 @@ module cva6
396399
397400 fu_data_t fu_data_id_ex;
398401 logic [CVA6Cfg.PCLEN - 1 : 0 ] pc_id_ex;
402+ logic [CVA6Cfg.DIIIDLEN - 1 : 0 ] dii_id_id_ex;
399403 logic is_compressed_instr_id_ex;
400404 logic [31 : 0 ] tinst_ex;
401405 // fixed latency units
@@ -564,6 +568,7 @@ module cva6
564568 logic flush_csr_ctrl;
565569 logic flush_unissued_instr_ctrl_id;
566570 logic flush_ctrl_if;
571+ logic [CVA6Cfg.DIIIDLEN - 1 : 0 ] flush_ctrl_dii_id_if;
567572 logic flush_ctrl_id;
568573 logic flush_ctrl_ex;
569574 logic flush_ctrl_bp;
@@ -634,6 +639,7 @@ module cva6
634639 .icache_dreq_o (icache_dreq_if_cache),
635640 .resolved_branch_i (resolved_branch),
636641 .pc_commit_i (pc_commit),
642+ .dii_id_commit_i (dii_id_commit),
637643 .set_pc_commit_i (set_pc_ctrl_pcgen),
638644 .set_debug_pc_i (set_debug_pc),
639645 .epc_i (epc_commit_pcgen),
@@ -785,6 +791,7 @@ module cva6
785791 .rs2_forwarding_o (rs2_forwarding_id_ex),
786792 .fu_data_o (fu_data_id_ex),
787793 .pc_o (pc_id_ex),
794+ .dii_id_o (dii_id_id_ex),
788795 .is_compressed_instr_o (is_compressed_instr_id_ex),
789796 .tinst_o (tinst_ex),
790797 // fixed latency unit ready
@@ -866,6 +873,7 @@ module cva6
866873 .rs2_forwarding_i (rs2_forwarding_id_ex),
867874 .fu_data_i (fu_data_id_ex),
868875 .pc_i (pc_id_ex),
876+ .dii_id_i (dii_id_id_ex),
869877 .is_compressed_instr_i (is_compressed_instr_id_ex),
870878 .tinst_i (tinst_ex),
871879 // fixed latency units
@@ -1015,6 +1023,7 @@ module cva6
10151023 .amo_resp_i (amo_resp),
10161024 .commit_csr_o (csr_commit_commit_ex),
10171025 .pc_o (pc_commit),
1026+ .dii_id_o (dii_id_commit),
10181027 .csr_op_o (csr_op_commit_csr),
10191028 .csr_wdata_o (csr_wdata_commit_csr),
10201029 .csr_rdata_i (csr_rdata_csr_commit),
@@ -1248,7 +1257,6 @@ module cva6
12481257 .dcache_req_i_t (dcache_req_i_t),
12491258 .dcache_req_o_t (dcache_req_o_t),
12501259 .exception_t (exception_t),
1251- .rvfi_dii_inst_pack_t (rvfi_dii_inst_pack_t),
12521260 .NumPorts (NumPorts),
12531261 .noc_req_t (noc_req_t),
12541262 .noc_resp_t (noc_resp_t)
@@ -1284,10 +1292,7 @@ module cva6
12841292 .noc_resp_i (noc_resp_i),
12851293 .inval_addr_i (inval_addr),
12861294 .inval_valid_i (inval_valid),
1287- .inval_ready_o (inval_ready),
1288- .rvfi_dii_rtrn_vld_i (rvfi_dii_rtrn_vld_i),
1289- .rvfi_dii_inst_pack_i (rvfi_dii_inst_pack_i),
1290- .rvfi_dii_data_ready_o (rvfi_dii_data_ready_o)
1295+ .inval_ready_o (inval_ready)
12911296 );
12921297 end else if (CVA6Cfg.DCacheType == config_pkg :: HPDCACHE ) begin : gen_cache_hpd
12931298 cva6_hpdcache_subsystem # (
0 commit comments