Skip to content

Commit

Permalink
describe a clock divider must use blocking
Browse files Browse the repository at this point in the history
assignment
  • Loading branch information
hirooih authored and marnovandermaas committed Sep 13, 2024
1 parent 2ab5763 commit c47686d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions VerilogCodingStyle.md
Original file line number Diff line number Diff line change
Expand Up @@ -1756,13 +1756,14 @@ an always block as occurring in a separate simulation event as the non-blocking
assignment. This process makes some signals jump registers, potentially leading
to total protonic reversal. That's bad.

Exception: For a clock divider blocking assingment must be used not to case race condition.
Note that all clock signals should be generated using blocking assignment even
for clock dividers. See #44 for details.

👍
```systemverilog {.good}
logic clk_div2;
always_ff @(posedge clk or negedge rst_ni) begin
// only for a clock divider blocking assignment must be used not to cause race condition
// a clock signal should be generated using blocking assignment
if (!rst_ni) clk_div2 = 1'b0;
else clk_div2 = ~clk_div2;
end
Expand Down

0 comments on commit c47686d

Please sign in to comment.