3 trap 'echo "ERROR in sv_implicit_ports.sh" >&2; exit 1' ERR
6 ..
/..
/yosys
-f "verilog -sv" -qp "prep -flatten -top top; select -assert-count 1 t:\$add" - <<EOT
7 module add(input [7:0] a, input [7:0] b, output [7:0] q);
11 module top(input [7:0] a, output [7:0] q);
18 ..
/..
/yosys
-f "verilog -sv" -qp "prep -flatten -top top; select -assert-count 1 t:\$add" - <<EOT
19 module add(input [7:0] a, input [7:0] b, output [7:0] q);
23 module top(input [7:0] a, output [7:0] q);
34 ((..
/..
/yosys
-f "verilog -sv" -qp "hierarchy -top top" - || true
) <<EOT
35 module add(input [7:0] a, input [7:0] b, output [7:0] q);
39 module top(input [7:0] a, output [7:0] q);
43 ) 2>&1 |
grep -F "ERROR: No matching wire for implicit port connection \`b' of cell top.add_i (add)." > /dev
/null
45 # Incorrectly sized wire
46 ((..
/..
/yosys
-f "verilog -sv" -qp "hierarchy -top top" - || true
) <<EOT
47 module add(input [7:0] a, input [7:0] b, output [7:0] q);
51 module top(input [7:0] a, output [7:0] q);
56 ) 2>&1 |
grep -F "ERROR: Width mismatch between wire (7 bits) and port (8 bits) for implicit port connection \`b' of cell top.add_i (add)." > /dev
/null
59 ..
/..
/yosys
-f "verilog -sv" -qp "prep -flatten -top top; select -assert-count 1 t:\$add" - <<EOT
60 module add(input [7:0] a = 8'd00, input [7:0] b = 8'd01, output [7:0] q);
64 module top(input [7:0] a, output [7:0] q);
69 # Parameterised module
70 ..
/..
/yosys
-f "verilog -sv" -qp "prep -flatten -top top; select -assert-count 1 t:\$add" - <<EOT
71 module add #(parameter N=3) (input [N-1:0] a = 8'd00, input [N-1:0] b = 8'd01, output [N-1:0] q);
75 module top(input [7:0] a, output [7:0] q);
76 add #(.N(8)) add_i(.*);
80 # Parameterised blackbox module
81 ..
/..
/yosys
-f "verilog -sv" -qp "prep -flatten -top top; select -assert-count 1 t:add" - <<EOT
83 module add #(parameter N=3) (input [N-1:0] a, b, output [N-1:0] q);
86 module top(input [7:0] a, b, output [7:0] q);
87 add #(.N(8)) add_i(.*);
91 # Parameterised blackbox module - incorrect width
92 ((..
/..
/yosys
-f "verilog -sv" -qp "prep -flatten -top top; select -assert-count 1 t:add" - || true
) <<EOT
94 module add #(parameter N=3) (input [N-1:0] a, b, output [N-1:0] q);
97 module top(input [7:0] a, b, output [7:0] q);
98 add #(.N(6)) add_i(.*);
101 ) 2>&1 |
grep -F "ERROR: Width mismatch between wire (8 bits) and port (6 bits) for implicit port connection \`q' of cell top.add_i (add)." > /dev
/null
103 # Mixed implicit and explicit 1
104 ..
/..
/yosys
-f "verilog -sv" -qp "prep -flatten -top top; select -assert-count 1 t:\$add" - <<EOT
105 module add(input [7:0] a, input [7:0] b, output [7:0] q);
109 module top(input [7:0] a, output [7:0] q);
110 add add_i(.b(8'd42), .*);
114 # Mixed implicit and explicit 2
115 (..
/..
/yosys
-f "verilog -sv" -qp "prep -flatten -top top; select -assert-count 1 t:\$add" - <<EOT
116 module add(input [7:0] a, input [7:0] b, output [7:0] q);
120 module top(input [7:0] a, input [9:0] b, output [7:0] q);
124 ) 2>&1 |
grep -F "Warning: Resizing cell port top.add_i.b from 10 bits to 8 bits." > /dev
/null