@@ -159,6 +159,7 @@ module ibex_core import ibex_pkg::*; #(
159159 output logic [31 : 0 ] rvfi_ext_mhpmcountersh [10 ],
160160 output logic rvfi_ext_ic_scr_key_valid,
161161 output logic rvfi_ext_irq_valid,
162+ output logic [15 : 0 ] rvfi_ext_expanded_insn,
162163 `endif
163164
164165 // CPU Control Signals
@@ -186,6 +187,7 @@ module ibex_core import ibex_pkg::*; #(
186187 logic [15 : 0 ] instr_rdata_c_id; // Compressed instruction sampled inside IF stage
187188 logic instr_is_compressed_id;
188189 instr_exp_e instr_gets_expanded_id;
190+ logic [15 : 0 ] instr_expanded_id;
189191 logic instr_perf_count_id;
190192 logic instr_bp_taken_id;
191193 logic instr_fetch_err; // Bus error on instr fetch
@@ -474,6 +476,7 @@ module ibex_core import ibex_pkg::*; #(
474476 .instr_rdata_c_id_o (instr_rdata_c_id),
475477 .instr_is_compressed_id_o (instr_is_compressed_id),
476478 .instr_gets_expanded_id_o (instr_gets_expanded_id),
479+ .instr_expanded_id_o (instr_expanded_id),
477480 .instr_bp_taken_o (instr_bp_taken_id),
478481 .instr_fetch_err_o (instr_fetch_err),
479482 .instr_fetch_err_plus2_o (instr_fetch_err_plus2),
@@ -1318,6 +1321,9 @@ module ibex_core import ibex_pkg::*; #(
13181321 logic [31 : 0 ] rvfi_ext_stage_mhpmcountersh [RVFI_STAGES ][10 ];
13191322 logic rvfi_ext_stage_ic_scr_key_valid [RVFI_STAGES ];
13201323 logic rvfi_ext_stage_irq_valid [RVFI_STAGES + 1 ];
1324+ logic [15 : 0 ] rvfi_ext_stage_expanded_insn [RVFI_STAGES ];
1325+
1326+ logic [15 : 0 ] rvfi_expanded_insn;
13211327
13221328
13231329 logic rvfi_stage_valid_d [RVFI_STAGES ];
@@ -1379,6 +1385,7 @@ module ibex_core import ibex_pkg::*; #(
13791385 assign rvfi_ext_mhpmcountersh = rvfi_ext_stage_mhpmcountersh [RVFI_STAGES - 1 ];
13801386 assign rvfi_ext_ic_scr_key_valid = rvfi_ext_stage_ic_scr_key_valid [RVFI_STAGES - 1 ];
13811387 assign rvfi_ext_irq_valid = rvfi_ext_stage_irq_valid [RVFI_STAGES ];
1388+ assign rvfi_ext_expanded_insn = rvfi_ext_stage_expanded_insn [RVFI_STAGES - 1 ];
13821389
13831390 // When an instruction takes a trap the `rvfi_trap` signal will be set. Instructions that take
13841391 // traps flush the pipeline so ordinarily wouldn't be seen to be retire. The RVFI tracking
@@ -1596,6 +1603,7 @@ module ibex_core import ibex_pkg::*; #(
15961603 rvfi_ext_stage_debug_mode[i] <= '0 ;
15971604 rvfi_ext_stage_mcycle[i] <= '0 ;
15981605 rvfi_ext_stage_ic_scr_key_valid[i] <= '0 ;
1606+ rvfi_ext_stage_expanded_insn[i] <= '0 ;
15991607 // DSim does not properly support array assignment in for loop, so unroll
16001608 rvfi_ext_stage_mhpmcounters[i][0 ] <= '0 ;
16011609 rvfi_ext_stage_mhpmcountersh[i][0 ] <= '0 ;
@@ -1647,6 +1655,7 @@ module ibex_core import ibex_pkg::*; #(
16471655 rvfi_ext_stage_debug_mode[i] <= debug_mode;
16481656 rvfi_ext_stage_mcycle[i] <= cs_registers_i.mcycle_counter_i.counter_val_o;
16491657 rvfi_ext_stage_ic_scr_key_valid[i] <= cs_registers_i.cpuctrlsts_ic_scr_key_valid_q;
1658+ rvfi_ext_stage_expanded_insn[i] <= rvfi_expanded_insn;
16501659 // DSim does not properly support array assignment in for loop, so unroll
16511660 rvfi_ext_stage_mhpmcounters[i][0 ] <= cs_registers_i.mhpmcounter[3 ][31 : 0 ];
16521661 rvfi_ext_stage_mhpmcountersh[i][0 ] <= cs_registers_i.mhpmcounter[3 ][63 : 32 ];
@@ -1716,6 +1725,7 @@ module ibex_core import ibex_pkg::*; #(
17161725 rvfi_ext_stage_ic_scr_key_valid[i] <= rvfi_ext_stage_ic_scr_key_valid[i- 1 ];
17171726 rvfi_ext_stage_mhpmcounters[i] <= rvfi_ext_stage_mhpmcounters[i- 1 ];
17181727 rvfi_ext_stage_mhpmcountersh[i] <= rvfi_ext_stage_mhpmcountersh[i- 1 ];
1728+ rvfi_ext_stage_expanded_insn[i] <= rvfi_ext_stage_expanded_insn[i- 1 ];
17191729 end
17201730
17211731 // Some of the rvfi_ext_* signals are used to provide an interrupt notification (signalled
@@ -1784,6 +1794,14 @@ module ibex_core import ibex_pkg::*; #(
17841794 end
17851795 end
17861796
1797+ always_comb begin
1798+ if (instr_gets_expanded_id == INSTR_NOT_EXPANDED ) begin
1799+ rvfi_expanded_insn = '0 ;
1800+ end else begin
1801+ rvfi_expanded_insn = instr_expanded_id;
1802+ end
1803+ end
1804+
17871805 // Source registers 1 and 2 are read in the first instruction cycle
17881806 // Source register 3 is read in the second instruction cycle.
17891807 always_comb begin
0 commit comments