Skip to content

Commit

Permalink
Merge pull request #28 from Wren6991/fix-21
Browse files Browse the repository at this point in the history
Coding style change for Verilator compatibility (fixes #21)
  • Loading branch information
Wren6991 authored Dec 9, 2024
2 parents 8272910 + c57e9f4 commit 787da13
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion hdl/hazard3_frontend.v
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ always @ (*) begin: boundary_conditions
fifo_mem[FIFO_DEPTH] = mem_data;
fifo_predbranch[FIFO_DEPTH] = 2'b00;
fifo_err[FIFO_DEPTH] = 1'b0;
fifo_valid_hw[FIFO_DEPTH] = 2'b00;
for (i = 0; i < FIFO_DEPTH; i = i + 1) begin
fifo_valid[i] = |EXTENSION_C ? |fifo_valid_hw[i] : fifo_valid_hw[i][0];
// valid-to-right condition: i == 0 || fifo_valid[i - 1], but without
Expand All @@ -158,6 +157,10 @@ always @ (posedge clk or negedge rst_n) begin: fifo_update
fifo_err[i] <= 1'b0;
fifo_predbranch[i] <= 2'b00;
end
// This exists only for loop boundary conditions, but is tied off in
// this synchronous process to work around a Verilator scheduling
// issue (see issue #21)
fifo_valid_hw[FIFO_DEPTH] <= 2'b00;
end else begin
for (i = 0; i < FIFO_DEPTH; i = i + 1) begin
if (fifo_pop || (fifo_push && !fifo_valid[i])) begin
Expand All @@ -183,6 +186,7 @@ always @ (posedge clk or negedge rst_n) begin: fifo_update
fifo_predbranch[0] <= 2'b00;
fifo_valid_hw[0] <= jump_now ? 2'b00 : 2'b11;
end
fifo_valid_hw[FIFO_DEPTH] <= 2'b00;
`ifdef HAZARD3_ASSERTIONS
// FIFO validity must be compact, so we can always consume from the end
if (!fifo_valid[0]) begin
Expand Down

0 comments on commit 787da13

Please sign in to comment.