3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-23 00:55:32 +00:00

Merge branch 'master' into eddie/muxpack

This commit is contained in:
Eddie Hung 2019-06-07 15:47:28 -07:00
commit 58f4b106f3
39 changed files with 532 additions and 323 deletions

View file

@ -1,3 +0,0 @@
aig 3 2 0 1 1
6


View file

@ -3,3 +3,6 @@ aag 3 2 0 1 1
4
6
6 2 4
i0 pi0
i1 pi1
o0 po0

5
tests/aiger/and_.aig Normal file
View file

@ -0,0 +1,5 @@
aig 3 2 0 1 1
6
i0 pi0
i1 pi1
o0 po0

View file

@ -1,3 +1,5 @@
aag 1 1 0 1 0
2
2
i0 pi0
o0 po0

View file

@ -1,2 +1,4 @@
aig 1 1 0 1 0
2
i0 pi0
o0 po0

View file

@ -1,3 +1,4 @@
aag 1 0 1 0 0 1
2 3
2
b0 po0

View file

@ -1,3 +1,4 @@
aig 1 0 1 0 0 1
3
2
b0 po0

View file

@ -6,3 +6,4 @@ aag 5 1 1 0 3 1
8 4 2
10 9 7
b0 AIGER_NEVER
i0 po0

View file

@ -1,4 +1,5 @@
aig 5 1 1 0 3 1
10
4
b0 AIGER_NEVER
i0 po0
b0 AIGER_NEVER

View file

@ -1,2 +1,3 @@
aag 0 0 0 1 0
0
o0 po0

View file

@ -1,2 +1,3 @@
aig 0 0 0 1 0
0
o0 po0

View file

@ -1,3 +1,5 @@
aag 1 1 0 1 0
2
3
i0 pi0
o0 po0

View file

@ -1,2 +1,4 @@
aig 1 1 0 1 0
3
i0 pi0
o0 po0

View file

@ -6,3 +6,4 @@ aag 5 1 1 0 3 1
8 4 2
10 9 7
b0 AIGER_NEVER
i0 pi0

View file

@ -1,4 +1,5 @@
aig 5 1 1 0 3 1
10
5
b0 AIGER_NEVER
i0 pi0
b0 AIGER_NEVER

View file

@ -1,3 +0,0 @@
aig 3 2 0 1 1
7


View file

@ -3,3 +3,6 @@ aag 3 2 0 1 1
4
7
6 3 5
i0 pi0
i1 pi1
o0 po0

5
tests/aiger/or_.aig Normal file
View file

@ -0,0 +1,5 @@
aig 3 2 0 1 1
7
i0 pi0
i1 pi1
o0 po0

View file

@ -1,24 +1,37 @@
#!/bin/bash
OPTIND=1
seed="" # default to no seed specified
while getopts "S:" opt
do
case "$opt" in
S) arg="${OPTARG#"${OPTARG%%[![:space:]]*}"}" # remove leading space
seed="SEED=$arg" ;;
esac
set -e
for aag in *.aag; do
# Since ABC cannot read *.aag, read the *.aig instead
# (which would have been created by the reference aig2aig utility)
../../yosys-abc -c "read -c ${aag%.*}.aig; write ${aag%.*}_ref.v"
../../yosys -p "
read_verilog ${aag%.*}_ref.v
prep
design -stash gold
read_aiger -clk_name clock $aag
prep
design -stash gate
design -import gold -as gold
design -import gate -as gate
miter -equiv -flatten -make_assert -make_outputs gold gate miter
sat -verify -prove-asserts -show-ports -seq 16 miter
"
done
shift "$((OPTIND-1))"
# check for Icarus Verilog
if ! which iverilog > /dev/null ; then
echo "$0: Error: Icarus Verilog 'iverilog' not found."
exit 1
fi
echo "===== AAG ======"
${MAKE:-make} -f ../tools/autotest.mk $seed *.aag EXTRA_FLAGS="-f aiger"
echo "===== AIG ======"
exec ${MAKE:-make} -f ../tools/autotest.mk $seed *.aig EXTRA_FLAGS="-f aiger"
for aig in *.aig; do
../../yosys-abc -c "read -c $aig; write ${aig%.*}_ref.v"
../../yosys -p "
read_verilog ${aig%.*}_ref.v
prep
design -stash gold
read_aiger -clk_name clock $aig
prep
design -stash gate
design -import gold -as gold
design -import gate -as gate
miter -equiv -flatten -make_assert -make_outputs gold gate miter
sat -verify -prove-asserts -show-ports -seq 16 miter
"
done

View file

@ -2,3 +2,5 @@ aag 1 0 1 2 0
2 3
2
3
o0 po0
o1 po1

View file

@ -2,3 +2,5 @@ aig 1 0 1 2 0
3
2
3
o0 po0
o1 po1

View file

@ -1,2 +1,3 @@
aag 0 0 0 1 0
1
o0 po0

View file

@ -1,2 +1,3 @@
aig 0 0 0 1 0
1
o0 po0

View file

@ -0,0 +1,16 @@
// 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(input [2:0] a, b, output [2:0] alu_result, output cout);
wire cin = 1;
alu alu (
.a(a),
.b, // Implicit connection is equivalent to .b(b)
.cin(), // Explicitely unconnected
.cout(cout),
.result(alu_result)
);
endmodule

View file

@ -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}

View file

@ -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/*
@ -135,9 +146,10 @@ do
rm -f ${bn}_ref.fir
if [[ "$ext" == "v" ]]; then
egrep -v '^\s*`timescale' ../$fn > ${bn}_ref.${ext}
elif [[ "$ext" == "aig" ]] || [[ "$ext" == "aag" ]]; then
"$toolsdir"/../../yosys-abc -c "read_aiger ../${fn}; write ${bn}_ref.v"
else
"$toolsdir"/../../yosys -f "$frontend $include_opts" -b "verilog" -o ${bn}_ref.v ../${fn}
frontend="verilog -noblackbox"
cp ../${fn} ${bn}_ref.${ext}
fi
if [ ! -f ../${bn}_tb.v ]; then

View file

@ -0,0 +1,30 @@
module test;
localparam X=1;
genvar i;
generate
if (X == 1)
$info("X is 1");
if (X == 1)
$warning("X is 1");
else
$error("X is not 1");
case (X)
1: $info("X is 1 in a case statement");
endcase
//case (X-1)
// 1: $warn("X is 2");
// default: $warn("X might be anything in a case statement");
//endcase
for (i = 0; i < 3; i = i + 1)
begin
case(i)
0: $info;
1: $warning;
default: $info("default case statemnent");
endcase
end
$info("This is a standalone $info(). Next $info has no parameters");
$info;
endgenerate
endmodule

View file

@ -0,0 +1 @@
read_verilog -sv elab_sys_tasks.sv