diff options
author | Eddie Hung <eddieh@ece.ubc.ca> | 2019-02-06 14:31:11 -0800 |
---|---|---|
committer | Eddie Hung <eddieh@ece.ubc.ca> | 2019-02-06 14:31:11 -0800 |
commit | 4167b15de5f8d72b965d1ea2908c886f9703700a (patch) | |
tree | 581cf9b62272305401c1b4f47c279d533757100a /tests | |
parent | 3f87cf86ccefe6e66f768fbf19c34db97cf7246d (diff) | |
parent | c373640a3ac6c2f76f0a8dce4e44236154ca24bc (diff) | |
download | yosys-4167b15de5f8d72b965d1ea2908c886f9703700a.tar.gz yosys-4167b15de5f8d72b965d1ea2908c886f9703700a.tar.bz2 yosys-4167b15de5f8d72b965d1ea2908c886f9703700a.zip |
Merge branch 'dff_init' of https://github.com/eddiehung/yosys into xaig
Diffstat (limited to 'tests')
-rw-r--r-- | tests/simple/dff_init.v | 42 | ||||
-rwxr-xr-x | tests/simple_defparam/run-test.sh | 21 | ||||
-rwxr-xr-x | tests/tools/autotest.sh | 6 |
3 files changed, 67 insertions, 2 deletions
diff --git a/tests/simple/dff_init.v b/tests/simple/dff_init.v new file mode 100644 index 000000000..be947042e --- /dev/null +++ b/tests/simple/dff_init.v @@ -0,0 +1,42 @@ +module dff0_test(n1, n1_inv, clk); + input clk; + output n1; + reg n1 = 32'd0; + output n1_inv; + always @(posedge clk) + n1 <= n1_inv; + assign n1_inv = ~n1; +endmodule + +module dff1_test(n1, n1_inv, clk); + input clk; + (* init = 32'd1 *) + output n1; + reg n1 = 32'd1; + output n1_inv; + always @(posedge clk) + n1 <= n1_inv; + assign n1_inv = ~n1; +endmodule + +module dff0a_test(n1, n1_inv, clk); + input clk; + (* init = 32'd0 *) // Must be consistent with reg initialiser below + output n1; + reg n1 = 32'd0; + output n1_inv; + always @(posedge clk) + n1 <= n1_inv; + assign n1_inv = ~n1; +endmodule + +module dff1a_test(n1, n1_inv, clk); + input clk; + (* init = 32'd1 *) // Must be consistent with reg initialiser below + output n1; + reg n1 = 32'd1; + output n1_inv; + always @(posedge clk) + n1 <= n1_inv; + assign n1_inv = ~n1; +endmodule diff --git a/tests/simple_defparam/run-test.sh b/tests/simple_defparam/run-test.sh new file mode 100755 index 000000000..137e15076 --- /dev/null +++ b/tests/simple_defparam/run-test.sh @@ -0,0 +1,21 @@ +#!/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 +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 + +cp ../simple/*.v . +exec ${MAKE:-make} -f ../tools/autotest.mk $seed *.v EXTRA_FLAGS="-B \"-defparam\"" diff --git a/tests/tools/autotest.sh b/tests/tools/autotest.sh index 3bce003e1..3e1325b33 100755 --- a/tests/tools/autotest.sh +++ b/tests/tools/autotest.sh @@ -22,7 +22,7 @@ if [ ! -f $toolsdir/cmp_tbdata -o $toolsdir/cmp_tbdata.c -nt $toolsdir/cmp_tbdat ( set -ex; ${CC:-gcc} -Wall -o $toolsdir/cmp_tbdata $toolsdir/cmp_tbdata.c; ) || exit 1 fi -while getopts xmGl:wkjvref:s:p:n:S:I: opt; do +while getopts xmGl:wkjvref:s:p:n:S:I:B: opt; do case "$opt" in x) use_xsim=true ;; @@ -59,8 +59,10 @@ while getopts xmGl:wkjvref:s:p:n:S:I: opt; do include_opts="$include_opts -I $OPTARG" xinclude_opts="$xinclude_opts -i $OPTARG" minclude_opts="$minclude_opts +incdir+$OPTARG" ;; + B) + backend_opts="$backend_opts $OPTARG" ;; *) - echo "Usage: $0 [-x|-m] [-G] [-w] [-k] [-j] [-v] [-r] [-e] [-l libs] [-f frontend] [-s script] [-p cmdstring] [-n iters] [-S seed] [-I incdir] verilog-files\n" >&2 + echo "Usage: $0 [-x|-m] [-G] [-w] [-k] [-j] [-v] [-r] [-e] [-l libs] [-f frontend] [-s script] [-p cmdstring] [-n iters] [-S seed] [-I incdir] [-B backend_opt] verilog-files\n" >&2 exit 1 esac done |