-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from DaveMcEwan/rule-procedural-continuous-assi…
…gnment Rule procedural continuous assignment
- Loading branch information
Showing
15 changed files
with
144 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 20 additions & 4 deletions
24
md/syntaxrules-explanation-procedural_continuous_assignment.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,21 @@ | ||
SystemVerilog continuous assignment (`assign x = y`) infers combinatorial logic | ||
that continuously drives the LHS and changes with any change on the RHS. | ||
Continuous assignment, e.g. `assign x = y;` outside of any `always` process, | ||
continuously drives the LHS and changes with any change on the RHS. | ||
The same keyword `assign` has different meaning when used within an `always` | ||
process (or `always_ff`, `always_comb`, `initial`, etc.) where it can be used | ||
to override procedural assignments. | ||
Using this construct in a procedural block (`always*`) which is only triggered | ||
on changes to signals in the sensitivity list may not be synthesizable. | ||
|
||
Such construct in a procedural (`always*`) block which is only triggered | ||
on the changes of the signals in the sensitivity list may not be synthesizable. | ||
This SystemVerilog language feature is being considered for deprecation, as | ||
noted in IEEE1800-2017 Annex C, because it is easily abused and difficult to | ||
implement while not providing additional capability. | ||
Users are strongly encouraged to migrate their cod to use one of the alternate | ||
methods of procedural or continuous assignments. | ||
|
||
See also: | ||
- **non_blocking_assignment_in_always_comb** - Useful companion rule. | ||
- **blocking_assignment_in_always_ff** - Useful companion rule. | ||
|
||
The most relevant clauses of IEEE1800-2017 are: | ||
- 10.6.1 The assign and deassign procedural statements | ||
- Annex C.4 Constructs identified for deprecation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 18 additions & 10 deletions
28
testcases/syntaxrules/fail/procedural_continuous_assignment.sv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,19 @@ | ||
module M ( | ||
input logic clk, | ||
input logic a, | ||
input logic b, | ||
output logic c | ||
); | ||
|
||
always_ff @(posedge clk) | ||
assign c = a + b; | ||
|
||
module M; | ||
always @* | ||
assign c = a + b; | ||
endmodule | ||
//////////////////////////////////////////////////////////////////////////////// | ||
module M; | ||
always_comb | ||
assign c = a + b; | ||
endmodule | ||
//////////////////////////////////////////////////////////////////////////////// | ||
module M; | ||
always_latch | ||
assign c = a + b; | ||
endmodule | ||
//////////////////////////////////////////////////////////////////////////////// | ||
module M; | ||
always_ff @(posedge clk) | ||
assign c = a + b; | ||
endmodule |
25 changes: 17 additions & 8 deletions
25
testcases/syntaxrules/pass/procedural_continuous_assignment.sv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
module M ( | ||
input logic a, | ||
input logic b, | ||
output logic c | ||
); | ||
|
||
assign c = a + b; | ||
|
||
module M; | ||
assign c = a + b; // Continuous assignment | ||
endmodule | ||
//////////////////////////////////////////////////////////////////////////////// | ||
module M; | ||
always_ff @(posedge clk) | ||
c <= a + b; // Procedural non-blocking assignment | ||
endmodule | ||
//////////////////////////////////////////////////////////////////////////////// | ||
module M; | ||
always_comb | ||
c = a + b; // Procedural blocking assignment | ||
endmodule | ||
//////////////////////////////////////////////////////////////////////////////// | ||
module M; | ||
always @* | ||
c = a + b; // Procedural blocking assignment, Verilog 2001 | ||
endmodule |