File tree Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -221,6 +221,7 @@ module cv32e40x_wrapper
221
221
.prefetch_valid_if_i (core_i.if_stage_i.prefetch_valid),
222
222
.prefetch_is_tbljmp_ptr_if_i (core_i.if_stage_i.prefetch_is_tbljmp_ptr),
223
223
.lsu_trans_valid_i (core_i.load_store_unit_i.trans_valid),
224
+ .csr_en_id_i (core_i.id_stage_i.csr_en),
224
225
.* );
225
226
bind cv32e40x_cs_registers:
226
227
core_i.cs_registers_i
Original file line number Diff line number Diff line change @@ -131,10 +131,10 @@ module cv32e40x_controller_bypass import cv32e40x_pkg::*;
131
131
// todo:low:Above loop reasoning only applies to halt_id; for other pipeline stages a local instr_valid signal can maybe be used.
132
132
133
133
// Detect when a CSR insn in in EX or WB
134
- // mret and dret implicitly writes to CSR. (dret is killing IF/ID/EX once it is in WB and can be disregarded here.
134
+ // mret, dret and CLIC pointers implicitly writes to CSR. (dret is killing IF/ID/EX once it is in WB and can be disregarded here.
135
135
assign csr_write_in_ex_wb = (
136
- (id_ex_pipe_i.instr_valid && (id_ex_pipe_i.csr_en || (id_ex_pipe_i.sys_en && id_ex_pipe_i.sys_mret_insn))) ||
137
- (ex_wb_pipe_i.instr_valid && (ex_wb_pipe_i.csr_en || (ex_wb_pipe_i.sys_en && ex_wb_pipe_i.sys_mret_insn)))
136
+ (id_ex_pipe_i.instr_valid && (id_ex_pipe_i.csr_en || (id_ex_pipe_i.sys_en && id_ex_pipe_i.sys_mret_insn) || id_ex_pipe_i.instr_meta.clic_ptr )) ||
137
+ (ex_wb_pipe_i.instr_valid && (ex_wb_pipe_i.csr_en || (ex_wb_pipe_i.sys_en && ex_wb_pipe_i.sys_mret_insn) || ex_wb_pipe_i.instr_meta.clic_ptr ))
138
138
);
139
139
140
140
// Stall ID when WFI or WFE is active in EX.
Original file line number Diff line number Diff line change @@ -97,7 +97,8 @@ module cv32e40x_controller_fsm_sva
97
97
input logic wu_wfe_i,
98
98
input logic sys_en_id_i,
99
99
input logic sys_mret_id_i,
100
- input logic clic_ptr_in_wb
100
+ input logic clic_ptr_in_wb,
101
+ input logic csr_en_id_i
101
102
);
102
103
103
104
794
795
| - >
795
796
! ctrl_fsm_o.halt_wb)
796
797
else `uvm_error (" controller" , " csr_restore_mret when WB is halted" )
798
+
799
+ // CSR instructions should be stalled in ID if there is a CLIC pointer in EX or WB (RAW hazard)
800
+ a_csr_stall_on_ptr:
801
+ assert property (@ (posedge clk) disable iff (! rst_n)
802
+ (csr_en_id_i && if_id_pipe_i.instr_valid) &&
803
+ ((id_ex_pipe_i.instr_meta.clic_ptr && id_ex_pipe_i.instr_valid) ||
804
+ (ex_wb_pipe_i.instr_meta.clic_ptr && ex_wb_pipe_i.instr_valid))
805
+ | - >
806
+ ! id_valid_i)
807
+ else `uvm_error (" controller" , " CSR* not stalled in ID when CLIC pointer is in EX or WB" )
797
808
endmodule
798
809
You can’t perform that action at this time.
0 commit comments