mirror of
https://github.com/lowRISC/ibex.git
synced 2025-04-22 04:47:25 -04:00
Fixed issue that hardware loops with same endpoint did not work
This commit is contained in:
parent
116379e098
commit
45ceee59f7
2 changed files with 18 additions and 8 deletions
|
@ -73,10 +73,11 @@ module riscv_hwloop_controller
|
|||
hwlp_targ_addr_o = 'x;
|
||||
hwlp_dec_cnt_o = '0;
|
||||
|
||||
for (j = N_REGS-1; j >= 0; j--) begin
|
||||
for (j = 0; j < N_REGS; j++) begin
|
||||
if (pc_is_end_addr[j]) begin
|
||||
hwlp_targ_addr_o = hwlp_start_addr_i[j];
|
||||
hwlp_dec_cnt_o[j] = 1'b1;
|
||||
break;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -115,18 +115,27 @@ module riscv_hwloop_regs
|
|||
begin
|
||||
hwlp_counter_q <= '{default: 32'b0};
|
||||
end
|
||||
else if (hwlp_we_i[2] == 1'b1) // potential contention problem here!
|
||||
begin
|
||||
hwlp_counter_q[hwlp_regid_i] <= hwlp_cnt_data_i;
|
||||
end
|
||||
else
|
||||
begin
|
||||
for (i = 0; i < N_REGS; i++)
|
||||
if (hwlp_we_i[2] == 1'b1) // potential contention problem here!
|
||||
begin
|
||||
if (hwlp_dec_cnt_i[i] && valid_i)
|
||||
hwlp_counter_q[i] <= hwlp_counter_n;
|
||||
hwlp_counter_q[hwlp_regid_i] <= hwlp_cnt_data_i;
|
||||
end else begin
|
||||
for (i = 0; i < N_REGS; i++)
|
||||
begin
|
||||
if (hwlp_dec_cnt_i[i] && valid_i)
|
||||
hwlp_counter_q[i] <= hwlp_counter_n[i];
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Assertions
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
// do not decrement more than one counter at once
|
||||
assert property (
|
||||
@(posedge clk) (valid_i) |-> ($countones(hwlp_dec_cnt_i) <= 1) );
|
||||
|
||||
endmodule
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue