We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4f04e9d commit 1c5d44eCopy full SHA for 1c5d44e
rtl/serv_csr.v
@@ -65,7 +65,17 @@ module serv_csr
65
(i_csr_source == CSR_SOURCE_CSR) ? csr_out :
66
{W{1'bx}};
67
68
- assign csr_out = (i_mstatus_en & i_en & ((mstatus_mie & i_cnt3) | (i_cnt11 | i_cnt12))) |
+ wire [B:0] mstatus;
69
+
70
+ generate
71
+ if (W==1) begin : gen_mstatus_w1
72
+ assign mstatus = ((mstatus_mie & i_cnt3) | (i_cnt11 | i_cnt12));
73
+ end else if (W==4) begin : gen_mstatus_w4
74
+ assign mstatus = {i_cnt11 | (mstatus_mie & i_cnt3), 2'b00, i_cnt12};
75
+ end
76
+ endgenerate
77
78
+ assign csr_out = ({W{i_mstatus_en & i_en}} & mstatus) |
79
i_rf_csr_out |
80
({W{i_mcause_en & i_en}} & mcause);
81
0 commit comments