You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
module bar (d, q, clk, rst);
input wire d;
output wire q;
input wire clk;
input wire rst;
always @(posedge clk or posedge rst)
if (rst) q <= 1'd0;
else q <= d;
endmodule
module foo (d, q, clk, rst);
input wire d;
output wire q;
input wire clk;
input wire rst;
bar bar_instance (d, q, clk, rst);
endmodule
It contains an obvious error, the signal q in the module bar declared as wire instead of reg and used as l-value for procedural assignment in the always block.
Warning: wire '\q' is assigned in a block at foo.v:8.
Warning: wire '\q' is assigned in a block at foo.v:9.
This was decided when this feature was added to mitigate against false positives (given the complexity of the Verilog standard and frontend), and because Yosys has incorrectly accepted this without any warning for some time beforehand (several other tools do accept this too). If you really need this to be an error, you can use -e 'is assigned in a block' to make this warning into an error.
In my opinion it should be an error by default and there should be the -w option to make it a warning. But since you are aware of that issue than I leave it up to you.
Consider the following Verilog design.
It contains an obvious error, the signal
q
in the modulebar
declared as wire instead of reg and used as l-value for procedural assignment in the always block.Expected behavior
For the following call:
Yosys should throw an error that the nonblocking procedural assignment cannot be used on a non-memory signal (eg. wire)
Actual behavior
Yosys infers that the signal
q
is a register and throws no error.When the design is written to Verilog again using the
write_verilog
command, the signalq
appears as reg:The text was updated successfully, but these errors were encountered: