forked from github/verilator
Commentary on MULTIDRIVEN (#2972).
This commit is contained in:
parent
9699192de8
commit
aba3883092
11
docs/gen/ex_MULTIDRIVEN_faulty.rst
Normal file
11
docs/gen/ex_MULTIDRIVEN_faulty.rst
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
.. comment: generated by t_lint_multidriven_bad
|
||||||
|
.. code-block:: sv
|
||||||
|
:linenos:
|
||||||
|
:emphasize-lines: 2,5
|
||||||
|
|
||||||
|
always @(posedge clk) begin
|
||||||
|
out2[7:0] <= d0; // <--- Warning
|
||||||
|
end
|
||||||
|
always @(negedge clk) begin
|
||||||
|
out2[15:8] <= d0; // <--- Warning
|
||||||
|
end
|
6
docs/gen/ex_MULTIDRIVEN_msg.rst
Normal file
6
docs/gen/ex_MULTIDRIVEN_msg.rst
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
.. comment: generated by t_lint_multidriven_bad
|
||||||
|
.. code-block::
|
||||||
|
|
||||||
|
%Warning-MULTIDRIVEN: example.v:1:22 Signal has multiple driving blocks with different clocking: 'out2'
|
||||||
|
example.v:1:7 ... Location of first driving block
|
||||||
|
example.v:1:7 ... Location of other driving block
|
@ -803,15 +803,25 @@ List Of Warnings
|
|||||||
|
|
||||||
.. option:: MULTIDRIVEN
|
.. option:: MULTIDRIVEN
|
||||||
|
|
||||||
.. TODO better example
|
Warns that the specified signal comes from multiple always blocks each
|
||||||
|
with different clocking. This warning does not look at individual bits
|
||||||
|
(see example below).
|
||||||
|
|
||||||
Warns that the specified signal comes from multiple always blocks. This
|
This is considered bad style, as the consumer of a given signal may be
|
||||||
is often unsupported by synthesis tools, and is considered bad style.
|
unaware of the inconsistent clocking, causing clock domain crossing
|
||||||
It will also cause longer simulation runtimes due to reduced
|
bugs.
|
||||||
optimizations.
|
|
||||||
|
Faulty example:
|
||||||
|
|
||||||
|
.. include:: ../../docs/gen/ex_MULTIDRIVEN_faulty.rst
|
||||||
|
|
||||||
|
Results in:
|
||||||
|
|
||||||
|
.. include:: ../../docs/gen/ex_MULTIDRIVEN_msg.rst
|
||||||
|
|
||||||
Ignoring this warning will only slow simulations, it will simulate
|
Ignoring this warning will only slow simulations, it will simulate
|
||||||
correctly.
|
correctly. It may however cause longer simulation runtimes due to
|
||||||
|
reduced optimizations.
|
||||||
|
|
||||||
|
|
||||||
.. option:: MULTITOP
|
.. option:: MULTITOP
|
||||||
|
@ -2449,10 +2449,12 @@ sub _lineno_match {
|
|||||||
my $lineno = shift;
|
my $lineno = shift;
|
||||||
my $lines = shift;
|
my $lines = shift;
|
||||||
return 1 if !defined $lines;
|
return 1 if !defined $lines;
|
||||||
if ($lines =~ /^(\d+)$/) {
|
foreach my $lc (split /,/, $lines) {
|
||||||
return $1 == $lineno;
|
if ($lc =~ /^(\d+)$/) {
|
||||||
} elsif ($lines =~ /^(\d+)-(\d+)$/) {
|
return 1 if $1 == $lineno;
|
||||||
return $1 <= $lineno && $2 >= $lineno;
|
} elsif ($lc =~ /^(\d+)-(\d+)$/) {
|
||||||
|
return 1 if $1 <= $lineno && $2 >= $lineno;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -15,5 +15,15 @@ lint(
|
|||||||
expect_filename => $Self->{golden_filename},
|
expect_filename => $Self->{golden_filename},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
extract(
|
||||||
|
in => $Self->{top_filename},
|
||||||
|
out => "../docs/gen/ex_MULTIDRIVEN_faulty.rst",
|
||||||
|
lines => "31-36");
|
||||||
|
|
||||||
|
extract(
|
||||||
|
in => $Self->{golden_filename},
|
||||||
|
out => "../docs/gen/ex_MULTIDRIVEN_msg.rst",
|
||||||
|
lines => "10,11,14");
|
||||||
|
|
||||||
ok(1);
|
ok(1);
|
||||||
1;
|
1;
|
||||||
|
@ -21,18 +21,18 @@ module t (/*AUTOARG*/
|
|||||||
reg [7:0] mem [4];
|
reg [7:0] mem [4];
|
||||||
|
|
||||||
always @(posedge clk) begin
|
always @(posedge clk) begin
|
||||||
mem[a0] <= d0;
|
mem[a0] <= d0; // <--- Warning
|
||||||
end
|
end
|
||||||
always @(negedge clk) begin
|
always @(negedge clk) begin
|
||||||
mem[a0] <= d1;
|
mem[a0] <= d1; // <--- Warning
|
||||||
end
|
end
|
||||||
assign out = {mem[3],mem[2],mem[1],mem[0]};
|
assign out = {mem[3],mem[2],mem[1],mem[0]};
|
||||||
|
|
||||||
always @(posedge clk) begin
|
always @(posedge clk) begin
|
||||||
out2[7:0] <= d0;
|
out2[7:0] <= d0; // <--- Warning
|
||||||
end
|
end
|
||||||
always @(negedge clk) begin
|
always @(negedge clk) begin
|
||||||
out2[15:8] <= d0;
|
out2[15:8] <= d0; // <--- Warning
|
||||||
end
|
end
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
Loading…
Reference in New Issue
Block a user