Skip to content

Commit 10dac0f

Browse files
delta_counter: Attach reset properly to overflow FF (#228)
* [delta_counter] Attach reset properly to overflow FF In the previous version of the code, the flip-flop was described non-idiomatically, using a ternary operator to implement the asynchronous reset. Some synthesis tools do not properly interpret this as a reset, resulting in gates being inserted on the reset network, which is undesirable. * Update delta_counter.sv Make the linter happy
1 parent a66efbd commit 10dac0f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/delta_counter.sv

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,16 @@ module delta_counter #(
2828
logic [WIDTH:0] counter_q, counter_d;
2929
if (STICKY_OVERFLOW) begin : gen_sticky_overflow
3030
logic overflow_d, overflow_q;
31-
always_ff @(posedge clk_i or negedge rst_ni) overflow_q <= ~rst_ni ? 1'b0 : overflow_d;
31+
32+
always_ff @(posedge clk_i or negedge rst_ni)
33+
begin
34+
if(rst_ni) begin
35+
overflow_q <= 1'b0;
36+
end else begin
37+
overflow_q <= overflow_d;
38+
end
39+
end
40+
3241
always_comb begin
3342
overflow_d = overflow_q;
3443
if (clear_i || load_i) begin

0 commit comments

Comments
 (0)