From a210675d71b30e97bad728d7f418c14ea0eb28ba Mon Sep 17 00:00:00 2001 From: David Shah Date: Fri, 22 Nov 2019 09:16:37 +0000 Subject: sv: Add tests for wildcard port connections Signed-off-by: David Shah --- tests/various/sv_implicit_ports.sh | 56 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 tests/various/sv_implicit_ports.sh (limited to 'tests') diff --git a/tests/various/sv_implicit_ports.sh b/tests/various/sv_implicit_ports.sh new file mode 100755 index 000000000..13d39cf8b --- /dev/null +++ b/tests/various/sv_implicit_ports.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +trap 'echo "ERROR in sv_implicit_ports.sh" >&2; exit 1' ERR + +# Simple case +../../yosys -f "verilog -sv" -qp "prep -flatten -top top; select -assert-count 1 t:\$add" - <&1 | grep -F "ERROR: No matching wire for implicit port connection \`b' of cell top.add_i (add)." > /dev/null + +# Incorrectly sized wire +((../../yosys -f "verilog -sv" -qp "hierarchy -top top" - || true) <&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 -- cgit v1.2.3 From 7e741714df62338a2037d24721ef99ca8a0c6763 Mon Sep 17 00:00:00 2001 From: David Shah Date: Fri, 22 Nov 2019 09:21:35 +0000 Subject: hierarchy: Correct handling of wildcard port connections with default values Signed-off-by: David Shah --- tests/various/sv_implicit_ports.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests') diff --git a/tests/various/sv_implicit_ports.sh b/tests/various/sv_implicit_ports.sh index 13d39cf8b..2faac2e85 100755 --- a/tests/various/sv_implicit_ports.sh +++ b/tests/various/sv_implicit_ports.sh @@ -54,3 +54,14 @@ module top(input [7:0] a, output [7:0] q); endmodule EOT ) 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 + +# Defaults +../../yosys -f "verilog -sv" -qp "prep -flatten -top top; select -assert-count 1 t:\$add" - < Date: Fri, 22 Nov 2019 12:57:51 +0000 Subject: sv: More tests for wildcard port connections Signed-off-by: David Shah --- tests/various/sv_implicit_ports.sh | 57 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'tests') diff --git a/tests/various/sv_implicit_ports.sh b/tests/various/sv_implicit_ports.sh index 2faac2e85..9a01447f7 100755 --- a/tests/various/sv_implicit_ports.sh +++ b/tests/various/sv_implicit_ports.sh @@ -65,3 +65,60 @@ module top(input [7:0] a, output [7:0] q); add add_i(.*); endmodule EOT + +# Parameterised module +../../yosys -f "verilog -sv" -qp "prep -flatten -top top; select -assert-count 1 t:\$add" - <&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 + +# Mixed implicit and explicit 1 +../../yosys -f "verilog -sv" -qp "prep -flatten -top top; select -assert-count 1 t:\$add" - <&1 | grep -F "Warning: Resizing cell port top.add_i.b from 10 bits to 8 bits." > /dev/null -- cgit v1.2.3