Skip to content

Commit

Permalink
hw: Make dcsr, dpc, and dscratch0 CSRs accessible
Browse files Browse the repository at this point in the history
  • Loading branch information
dbekatli authored and paulsc96 committed Sep 27, 2023
1 parent 58ba5cd commit f8f8a18
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions hw/snitch/src/snitch.sv
Original file line number Diff line number Diff line change
Expand Up @@ -2245,7 +2245,7 @@ module snitch import snitch_pkg::*; import riscv_instr::*; #(

// CSR logic
always_comb begin
csr_rvalue = 1'b0;
csr_rvalue = '0;
csr_dump = 1'b0;
illegal_csr = '0;
priv_lvl_d = priv_lvl_q;
Expand Down Expand Up @@ -2332,6 +2332,19 @@ module snitch import snitch_pkg::*; import riscv_instr::*; #(
CSR_MHARTID: begin
csr_rvalue = hart_id_i;
end
CSR_DCSR: begin
csr_rvalue = dcsr_q;
dcsr_d.ebreakm = alu_result[15];
dcsr_d.step = alu_result[2];
end
CSR_DPC: begin
csr_rvalue = dpc_q;
dpc_d = alu_result;
end
CSR_DSCRATCH0: begin
csr_rvalue = dscratch_q;
dscratch_d = alu_result;
end
`ifdef SNITCH_ENABLE_PERF
CSR_MCYCLE: begin
csr_rvalue = cycle_q[31:0];
Expand Down Expand Up @@ -2487,7 +2500,7 @@ module snitch import snitch_pkg::*; import riscv_instr::*; #(
csr_stall_d = 1'b1;
end
default: begin
csr_rvalue = 1'b0;
csr_rvalue = '0;
csr_dump = 1'b1;
end
endcase
Expand Down

0 comments on commit f8f8a18

Please sign in to comment.