Set correct value of mstatus[mpp]

The correct value of mstatus[mpp] for machine-mode is 11, but SERV
had this set to 00. Changes in the regression test suite uncovered
this error.
This commit is contained in:
Olof Kindgren 2024-08-22 22:11:24 +02:00
parent 830d8084b0
commit 1fc6e7da9b
3 changed files with 13 additions and 1 deletions

View file

@ -14,6 +14,8 @@ module serv_csr
input wire i_cnt0to3,
input wire i_cnt3,
input wire i_cnt7,
input wire i_cnt11,
input wire i_cnt12,
input wire i_cnt_done,
input wire i_mem_op,
input wire i_mtip,
@ -63,7 +65,7 @@ module serv_csr
(i_csr_source == CSR_SOURCE_CSR) ? csr_out :
{W{1'bx}};
assign csr_out = ({i_mstatus_en & mstatus_mie & i_cnt3 & i_en,{B{1'b0}}}) |
assign csr_out = (i_mstatus_en & i_en & ((mstatus_mie & i_cnt3) | (i_cnt11 | i_cnt12))) |
i_rf_csr_out |
({W{i_mcause_en & i_en}} & mcause);

View file

@ -20,6 +20,8 @@ module serv_state
output wire o_cnt2,
output wire o_cnt3,
output wire o_cnt7,
output wire o_cnt11,
output wire o_cnt12,
output wire o_cnt_done,
output wire o_bufreg_en,
output wire o_ctrl_pc_en,
@ -77,6 +79,8 @@ module serv_state
assign o_cnt2 = (o_cnt[4:2] == 3'd0) & cnt_r[2];
assign o_cnt3 = (o_cnt[4:2] == 3'd0) & cnt_r[3];
assign o_cnt7 = (o_cnt[4:2] == 3'd1) & cnt_r[3];
assign o_cnt11 = (o_cnt[4:2] == 3'd2) & cnt_r[3];
assign o_cnt12 = (o_cnt[4:2] == 3'd3) & cnt_r[0];
//Take branch for jump or branch instructions (opcode == 1x0xx) if
//a) It's an unconditional branch (opcode[0] == 1)

View file

@ -117,6 +117,8 @@ module serv_top
wire cnt2;
wire cnt3;
wire cnt7;
wire cnt11;
wire cnt12;
wire cnt_done;
@ -241,6 +243,8 @@ module serv_top
.o_cnt2 (cnt2),
.o_cnt3 (cnt3),
.o_cnt7 (cnt7),
.o_cnt11 (cnt11),
.o_cnt12 (cnt12),
.o_cnt_done (cnt_done),
.o_bufreg_en (bufreg_en),
.o_ctrl_pc_en (ctrl_pc_en),
@ -546,6 +550,8 @@ module serv_top
.i_cnt0to3 (cnt0to3),
.i_cnt3 (cnt3),
.i_cnt7 (cnt7),
.i_cnt11 (cnt11),
.i_cnt12 (cnt12),
.i_cnt_done (cnt_done),
.i_mem_op (!mtval_pc),
.i_mtip (i_timer_irq),