mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-23 00:55:32 +00:00
opt_expr: Propagate constants to port connections.
This adds one simple piece of functionality to opt_expr: when a cell port is connected to a fully-constant signal (as determined by sigmap), the port is reconnected directly to the constant value. This is just enough optimization to fix the "non-constant $meminit input" problem without requiring a full opt_clean or a separate pass.
This commit is contained in:
parent
9600f20be8
commit
436d42c00c
3 changed files with 37 additions and 3 deletions
8
tests/opt/opt_expr_constconn.v
Normal file
8
tests/opt/opt_expr_constconn.v
Normal file
|
@ -0,0 +1,8 @@
|
|||
module top(...);
|
||||
|
||||
input [7:0] A;
|
||||
output [7:0] B;
|
||||
wire [7:0] C = 3;
|
||||
assign B = A + C;
|
||||
|
||||
endmodule
|
7
tests/opt/opt_expr_constconn.ys
Normal file
7
tests/opt/opt_expr_constconn.ys
Normal file
|
@ -0,0 +1,7 @@
|
|||
read_verilog opt_expr_constconn.v
|
||||
select -assert-count 1 t:$add
|
||||
select -assert-count 1 t:$add %ci w:C %i
|
||||
equiv_opt -assert opt_expr
|
||||
design -load postopt
|
||||
select -assert-count 1 t:$add
|
||||
select -assert-count 0 t:$add %ci w:C %i
|
Loading…
Add table
Add a link
Reference in a new issue