Add PICORV32_TESTBUG_nnn ifdefs for testing purposes

Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
Clifford Wolf 2019-06-30 11:30:18 +02:00
parent 18cd609853
commit d046cbfa49
1 changed files with 18 additions and 0 deletions

View File

@ -1326,7 +1326,13 @@ module picorv32 #(
`ifndef PICORV32_REGS `ifndef PICORV32_REGS
always @(posedge clk) begin always @(posedge clk) begin
if (resetn && cpuregs_write && latched_rd) if (resetn && cpuregs_write && latched_rd)
`ifdef PICORV32_TESTBUG_001
cpuregs[latched_rd ^ 1] <= cpuregs_wrdata;
`elsif PICORV32_TESTBUG_002
cpuregs[latched_rd] <= cpuregs_wrdata ^ 1;
`else
cpuregs[latched_rd] <= cpuregs_wrdata; cpuregs[latched_rd] <= cpuregs_wrdata;
`endif
end end
always @* begin always @* begin
@ -1995,8 +2001,16 @@ module picorv32 #(
rvfi_rd_wdata <= 0; rvfi_rd_wdata <= 0;
end else end else
if (cpuregs_write && !irq_state) begin if (cpuregs_write && !irq_state) begin
`ifdef PICORV32_TESTBUG_003
rvfi_rd_addr <= latched_rd ^ 1;
`else
rvfi_rd_addr <= latched_rd; rvfi_rd_addr <= latched_rd;
`endif
`ifdef PICORV32_TESTBUG_004
rvfi_rd_wdata <= latched_rd ? cpuregs_wrdata ^ 1 : 0;
`else
rvfi_rd_wdata <= latched_rd ? cpuregs_wrdata : 0; rvfi_rd_wdata <= latched_rd ? cpuregs_wrdata : 0;
`endif
end else end else
if (rvfi_valid) begin if (rvfi_valid) begin
rvfi_rd_addr <= 0; rvfi_rd_addr <= 0;
@ -2037,7 +2051,11 @@ module picorv32 #(
end end
always @* begin always @* begin
`ifdef PICORV32_TESTBUG_005
rvfi_pc_wdata = (dbg_irq_call ? dbg_irq_ret : dbg_insn_addr) ^ 4;
`else
rvfi_pc_wdata = dbg_irq_call ? dbg_irq_ret : dbg_insn_addr; rvfi_pc_wdata = dbg_irq_call ? dbg_irq_ret : dbg_insn_addr;
`endif
rvfi_csr_mcycle_rmask = 0; rvfi_csr_mcycle_rmask = 0;
rvfi_csr_mcycle_wmask = 0; rvfi_csr_mcycle_wmask = 0;