Skip to content

Commit 8725ac4

Browse files
committed
heed 'clicptr' in 'is_instr_bus_valid' (and clean a bit)
Signed-off-by: Robin Pedersen <[email protected]>
1 parent 76311ec commit 8725ac4

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

Diff for: lib/uvm_agents/uvma_rvfi/uvma_rvfi_instr_if.sv

+21-17
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,9 @@ interface uvma_rvfi_instr_if_t
197197

198198

199199
// -------------------------------------------------------------------
200-
// Local variables
200+
// Signals
201201
// -------------------------------------------------------------------
202+
202203
int unsigned irq_cnt; // number of taken interrupts
203204
int unsigned nmi_instr_cnt; // number of instructions after nmi
204205
int unsigned single_step_cnt; // number of instructions stepped
@@ -275,6 +276,10 @@ interface uvma_rvfi_instr_if_t
275276

276277
asm_t instr_asm;
277278

279+
wire is_exception_cause_instr_acc_fault = (rvfi_trap.exception_cause == EXC_CAUSE_INSTR_ACC_FAULT);
280+
wire is_exception_cause_integrity_fault = (rvfi_trap.exception_cause == EXC_CAUSE_INSTR_INTEGRITY_FAULT);
281+
wire is_exception_cause_bus_fault = (rvfi_trap.exception_cause == EXC_CAUSE_INSTR_BUS_FAULT);
282+
278283
// -------------------------------------------------------------------
279284
// Begin module code
280285
// -------------------------------------------------------------------
@@ -335,7 +340,7 @@ interface uvma_rvfi_instr_if_t
335340
end
336341

337342
always_comb begin
338-
is_mret = is_mret_f();
343+
is_mret = match_instr(INSTR_OPCODE_MRET, INSTR_MASK_FULL);
339344
end
340345

341346
always_comb begin
@@ -437,7 +442,14 @@ interface uvma_rvfi_instr_if_t
437442
end
438443

439444
always_comb begin
440-
is_instr_bus_valid = is_instr_bus_valid_f();
445+
is_instr_bus_valid = (
446+
(
447+
!is_exception_cause_bus_fault &&
448+
!is_exception_cause_integrity_fault &&
449+
!is_exception_cause_instr_acc_fault
450+
) ||
451+
rvfi_trap.clicptr
452+
);
441453
end
442454

443455
always_comb begin
@@ -623,6 +635,7 @@ interface uvma_rvfi_instr_if_t
623635

624636
modport passive_mp (clocking mon_cb);
625637

638+
626639
// -------------------------------------------------------------------
627640
// Functions
628641
// -------------------------------------------------------------------
@@ -637,9 +650,11 @@ interface uvma_rvfi_instr_if_t
637650
logic [ XLEN-1:0] instr_ref,
638651
logic [ XLEN-1:0] instr_mask
639652
);
640-
641-
return rvfi_valid && is_instr_bus_valid && ((rvfi_insn & instr_mask) == instr_ref);
642-
653+
return (
654+
rvfi_valid &&
655+
is_instr_bus_valid &&
656+
((rvfi_insn & instr_mask) == instr_ref)
657+
);
643658
endfunction : match_instr
644659

645660
// Check if instruction is of a certain type, without verifying the instr word is valid
@@ -841,10 +856,6 @@ function automatic logic is_dret_f();
841856
return match_instr(INSTR_OPCODE_DRET, INSTR_MASK_FULL);
842857
endfunction : is_dret_f
843858

844-
function automatic logic is_mret_f();
845-
return match_instr(INSTR_OPCODE_MRET, INSTR_MASK_FULL);
846-
endfunction : is_mret_f
847-
848859
function automatic logic is_uret_f();
849860
return match_instr(INSTR_OPCODE_URET, INSTR_MASK_FULL);
850861
endfunction : is_uret_f
@@ -967,13 +978,6 @@ function automatic logic is_pma_fault_f();
967978
(rvfi_trap.cause_type == 'h 0);
968979
endfunction : is_pma_fault_f
969980

970-
function automatic logic is_instr_bus_valid_f();
971-
return !( (rvfi_trap.exception_cause == EXC_CAUSE_INSTR_ACC_FAULT) ||
972-
(rvfi_trap.exception_cause == EXC_CAUSE_INSTR_INTEGRITY_FAULT) ||
973-
(rvfi_trap.exception_cause == EXC_CAUSE_INSTR_BUS_FAULT)
974-
);
975-
endfunction : is_instr_bus_valid_f
976-
977981
function automatic logic [31:0] rvfi_mem_addr_word0highbyte_f();
978982
logic [31:0] addr = rvfi_mem_addr[31:0];
979983
case (1)

0 commit comments

Comments
 (0)