Skip to content

Commit d88b6c7

Browse files
committed
describe a clock signal must be generated by blocking assignment
Signed-off-by: Hiroo HAYASHI <24754036+hirooih@users.noreply.github.com>
1 parent acfc714 commit d88b6c7

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

VerilogCodingStyle.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1900,6 +1900,28 @@ separate combinational (`always_comb`) block. Ideally, sequential blocks should
19001900
contain only a register instantiation, with perhaps a load enable or an
19011901
increment.
19021902

1903+
***All clock signals should be generated using blocking assignment even
1904+
for clock dividers.***
1905+
1906+
See #44 for details.
1907+
1908+
&#x1f44d;
1909+
```systemverilog {.good}
1910+
// only for test bench code
1911+
logic clk;
1912+
initial begin
1913+
clk <= 1'b0;
1914+
forever #5 clk = ~clk; // blocking assignment
1915+
end
1916+
1917+
// for both synthesizable and test bench code
1918+
logic clk_div2;
1919+
always_ff @(posedge clk or negedge rst_ni) begin
1920+
if (!rst_ni) clk_div2 = 1'b0;
1921+
else clk_div2 = ~clk_div2; // blocking assignment
1922+
end
1923+
```
1924+
19031925
### Don't Cares (`X`'s)
19041926

19051927
***The use of `X` literals in RTL code is strongly discouraged. RTL must not

0 commit comments

Comments
 (0)