diff options
author | Clifford Wolf <clifford@clifford.at> | 2017-05-18 17:19:08 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2017-05-18 17:19:08 +0200 |
commit | bb9ebeb9e37bc6103f527b434a13d9b4889a796b (patch) | |
tree | 377f88c15006a17a59447902abbf89b3247042b1 /picorv32.v | |
parent | 436544ccab9dcef61d074feda19e52c94fdb5c1b (diff) | |
download | picorv32-bb9ebeb9e37bc6103f527b434a13d9b4889a796b.tar.gz picorv32-bb9ebeb9e37bc6103f527b434a13d9b4889a796b.zip |
Fixed jalr, c_jalr, and c_jr insns (bug discovered by riscv-formal)
Diffstat (limited to 'picorv32.v')
-rw-r--r-- | picorv32.v | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1175,7 +1175,7 @@ module picorv32 #( reg [regindex_bits-1:0] latched_rd; reg [31:0] current_pc; - assign next_pc = latched_store && latched_branch ? reg_out : reg_next_pc; + assign next_pc = latched_store && latched_branch ? reg_out & ~1 : reg_next_pc; reg [3:0] pcpi_timeout_counter; reg pcpi_timeout; @@ -1430,7 +1430,7 @@ module picorv32 #( (* parallel_case *) case (1'b1) latched_branch: begin - current_pc = latched_store ? (latched_stalu ? alu_out_q : reg_out) : reg_next_pc; + current_pc = latched_store ? (latched_stalu ? alu_out_q : reg_out) & ~1 : reg_next_pc; `debug($display("ST_RD: %2d 0x%08x, BRANCH 0x%08x", latched_rd, reg_pc + (latched_compr ? 2 : 4), current_pc);) end latched_store && !latched_branch: begin |