logic conversion ignores LHSs in procedural assignment senses

This commit is contained in:
Zachary Snow 2022-02-15 17:49:50 +01:00
parent 5b5bed8c72
commit 3db72c4c2d
5 changed files with 34 additions and 0 deletions

View File

@ -17,6 +17,8 @@
* Fixed inadvertent design behavior changes caused by constant folding removing
intentional width-extending operations such as `+ 0` and `* 1`
* Fixed forced conversion to `reg` of data sensed in an edge-controlled
procedural assignment
## v0.0.9

View File

@ -186,6 +186,9 @@ traverseStmtM :: Stmt -> ST Stmt
traverseStmtM stmt@Timing{} =
-- ignore the timing LHSs
return stmt
traverseStmtM (Asgn op Just{} lhs expr) =
-- ignore the timing LHSs
traverseStmtM $ Asgn op Nothing lhs expr
traverseStmtM stmt@(Subroutine (Ident f) (Args (_ : Ident x : _) [])) =
when (f == "$readmemh" || f == "$readmemb") (collectLHSM $ LHSIdent x)
>> return stmt

View File

@ -0,0 +1,9 @@
module mod(input clk);
logic x, y, z;
initial begin
$display(x, y, z);
z = 1;
x = @(posedge y or posedge clk) z;
$display(x, y, z);
end
endmodule

View File

@ -0,0 +1,10 @@
module mod(input clk);
reg x, z;
wire y;
initial begin
$display(x, y, z);
z = 1;
x = @(posedge y or posedge clk) z;
$display(x, y, z);
end
endmodule

View File

@ -0,0 +1,10 @@
module top;
reg clk;
mod m(clk);
initial begin
$dumpvars(0, m);
clk = 0;
repeat (10)
#5 clk = ~clk;
end
endmodule