mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-23 00:55:32 +00:00
SystemVerilog support for implicit named port connections
This is the `foo foo(.port1, .port2);` SystemVerilog syntax introduced in IEEE1800-2005.
This commit is contained in:
parent
1332051f33
commit
88f5977093
5 changed files with 59 additions and 12 deletions
|
@ -17,4 +17,5 @@ if ! which iverilog > /dev/null ; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
exec ${MAKE:-make} -f ../tools/autotest.mk $seed *.v
|
||||
shopt -s nullglob
|
||||
exec ${MAKE:-make} -f ../tools/autotest.mk $seed *.{sv,v}
|
||||
|
|
|
@ -89,6 +89,13 @@ done
|
|||
|
||||
compile_and_run() {
|
||||
exe="$1"; output="$2"; shift 2
|
||||
ext=${1##*.}
|
||||
if [ "$ext" == "sv" ]; then
|
||||
language_gen="-g2012"
|
||||
else
|
||||
language_gen="-g2005"
|
||||
fi
|
||||
|
||||
if $use_modelsim; then
|
||||
altver=$( ls -v /opt/altera/ | grep '^[0-9]' | tail -n1; )
|
||||
/opt/altera/$altver/modelsim_ase/bin/vlib work
|
||||
|
@ -99,7 +106,7 @@ compile_and_run() {
|
|||
/opt/Xilinx/Vivado/$xilver/bin/xvlog $xinclude_opts -d outfile=\"$output\" "$@"
|
||||
/opt/Xilinx/Vivado/$xilver/bin/xelab -R work.testbench
|
||||
else
|
||||
iverilog $include_opts -Doutfile=\"$output\" -s testbench -o "$exe" "$@"
|
||||
iverilog $language_gen $include_opts -Doutfile=\"$output\" -s testbench -o "$exe" "$@"
|
||||
vvp -n "$exe"
|
||||
fi
|
||||
}
|
||||
|
@ -110,7 +117,7 @@ for fn
|
|||
do
|
||||
bn=${fn%.*}
|
||||
ext=${fn##*.}
|
||||
if [[ "$ext" != "v" ]] && [[ "$ext" != "aag" ]] && [[ "$ext" != "aig" ]]; then
|
||||
if [[ "$ext" != "v" ]] && [[ "$ext" != "sv" ]] && [[ "$ext" != "aag" ]] && [[ "$ext" != "aig" ]]; then
|
||||
echo "Invalid argument: $fn" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
@ -123,6 +130,10 @@ do
|
|||
echo -n "Test: $bn "
|
||||
fi
|
||||
|
||||
if [ "$ext" == sv ]; then
|
||||
frontend="$frontend -sv"
|
||||
fi
|
||||
|
||||
rm -f ${bn}.{err,log,skip}
|
||||
mkdir -p ${bn}.out
|
||||
rm -rf ${bn}.out/*
|
||||
|
|
19
tests/various/implicit_ports.sv
Normal file
19
tests/various/implicit_ports.sv
Normal file
|
@ -0,0 +1,19 @@
|
|||
// Test implicit port connections
|
||||
module alu (input [2:0] a, input [2:0] b, input cin, output cout, output [2:0] result);
|
||||
assign cout = cin;
|
||||
assign result = a + b;
|
||||
endmodule
|
||||
|
||||
module named_ports(output [2:0] alu_result, output cout);
|
||||
wire [2:0] a = 3'b010, b = 3'b100;
|
||||
wire cin = 1;
|
||||
|
||||
alu alu (
|
||||
.a(a),
|
||||
.b, // Implicit connection is equivalent to .b(b)
|
||||
.cin(), // Explicitely unconnected
|
||||
.cout(cout),
|
||||
.result(alu_result)
|
||||
);
|
||||
endmodule
|
||||
|
8
tests/various/implicit_ports.ys
Normal file
8
tests/various/implicit_ports.ys
Normal file
|
@ -0,0 +1,8 @@
|
|||
read_verilog -sv implicit_ports.sv
|
||||
proc; opt
|
||||
|
||||
flatten
|
||||
select -module named_ports
|
||||
|
||||
sat -verify -prove alu_result 6
|
||||
sat -verify -set-all-undef cout
|
Loading…
Add table
Add a link
Reference in a new issue