From 36ae5c1f75b11a36fad9ef95881a99128db19f26 Mon Sep 17 00:00:00 2001 From: tmeissner Date: Thu, 31 Dec 2020 22:28:43 +0100 Subject: synth: add option to treat asserts as assumes and vice-versa --- testsuite/synth/assertassumes0/assert0.vhdl | 21 +++++++++++++++++ testsuite/synth/assertassumes0/testsuite.sh | 36 +++++++++++++++++++++++++++++ testsuite/synth/assumeasserts0/assume0.vhdl | 21 +++++++++++++++++ testsuite/synth/assumeasserts0/testsuite.sh | 36 +++++++++++++++++++++++++++++ 4 files changed, 114 insertions(+) create mode 100644 testsuite/synth/assertassumes0/assert0.vhdl create mode 100755 testsuite/synth/assertassumes0/testsuite.sh create mode 100644 testsuite/synth/assumeasserts0/assume0.vhdl create mode 100755 testsuite/synth/assumeasserts0/testsuite.sh (limited to 'testsuite') diff --git a/testsuite/synth/assertassumes0/assert0.vhdl b/testsuite/synth/assertassumes0/assert0.vhdl new file mode 100644 index 000000000..8e25ec87d --- /dev/null +++ b/testsuite/synth/assertassumes0/assert0.vhdl @@ -0,0 +1,21 @@ +library ieee; +use ieee.std_logic_1164.all; + +entity assert0 is + port ( + clk : in std_logic; + i : out integer + ); +end assert0; + +architecture behav of assert0 is + +begin + + i <= 1; + + default clock is rising_edge(clk); + + psl_a : assert always i = 1; + +end behav; diff --git a/testsuite/synth/assertassumes0/testsuite.sh b/testsuite/synth/assertassumes0/testsuite.sh new file mode 100755 index 000000000..68d3ae989 --- /dev/null +++ b/testsuite/synth/assertassumes0/testsuite.sh @@ -0,0 +1,36 @@ +#! /bin/sh + +. ../../testenv.sh + +UNIT=assert0 +GHDL_STD_FLAGS=--std=08 + +synth_only $UNIT + +# There should be no assume gate without assert-assume option. +if grep -q -e "-- assume" syn_$UNIT.vhdl; then + exit 1 +fi + +# There should be an assert gate without assert-assume option. +if ! grep -q -e "-- assert" syn_$UNIT.vhdl; then + exit 1 +fi + +GHDL_FLAGS=--assert-assumes + +synth_only $UNIT + +# There should be an assume gate with assert-assume option. +if ! grep -q -e "-- assume" syn_$UNIT.vhdl; then + exit 1 +fi + +# There should be no assert gate with assert-assume option. +if grep -q -e "-- assert" syn_$UNIT.vhdl; then + exit 1 +fi + +clean + +echo "Test successful" diff --git a/testsuite/synth/assumeasserts0/assume0.vhdl b/testsuite/synth/assumeasserts0/assume0.vhdl new file mode 100644 index 000000000..a2b9ff409 --- /dev/null +++ b/testsuite/synth/assumeasserts0/assume0.vhdl @@ -0,0 +1,21 @@ +library ieee; +use ieee.std_logic_1164.all; + +entity assume0 is + port ( + clk : in std_logic; + i : out integer + ); +end assume0; + +architecture behav of assume0 is + +begin + + i <= 1; + + default clock is rising_edge(clk); + + psl_a : assume always i = 1; + +end behav; diff --git a/testsuite/synth/assumeasserts0/testsuite.sh b/testsuite/synth/assumeasserts0/testsuite.sh new file mode 100755 index 000000000..bc0544ae2 --- /dev/null +++ b/testsuite/synth/assumeasserts0/testsuite.sh @@ -0,0 +1,36 @@ +#! /bin/sh + +. ../../testenv.sh + +UNIT=assume0 +GHDL_STD_FLAGS=--std=08 + +synth_only $UNIT + +# There should be no assert gate without assert-assume option. +if grep -q -e "-- assert" syn_$UNIT.vhdl; then + exit 1 +fi + +# There should be an assume gate with assume-assert option. +if ! grep -q -e "-- assume" syn_$UNIT.vhdl; then + exit 1 +fi + +GHDL_FLAGS=--assume-asserts + +synth_only $UNIT + +# There should be an assert gate with assume-assert option. +if ! grep -q -e "-- assert" syn_$UNIT.vhdl; then + exit 1 +fi + +# There should be no assume gate with assert-assume option. +if grep -q -e "-- assume" syn_$UNIT.vhdl; then + exit 1 +fi + +clean + +echo "Test successful" -- cgit v1.2.3