aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/synth/issue662
diff options
context:
space:
mode:
authortmeissner <programming@goodcleanfun.de>2020-06-06 15:52:25 +0200
committertgingold <tgingold@users.noreply.github.com>2020-06-06 16:49:30 +0200
commitb829552e0601c169d982864891777f69b9019395 (patch)
tree22acf0385bb2f938c9b3d001c5efb5037161005d /testsuite/synth/issue662
parent2416376cabc3dd03413a5038ce59ccfab569414c (diff)
downloadghdl-b829552e0601c169d982864891777f69b9019395.tar.gz
ghdl-b829552e0601c169d982864891777f69b9019395.tar.bz2
ghdl-b829552e0601c169d982864891777f69b9019395.zip
testsuite/synth: add a test of PSL built-in function rose() for #662
Diffstat (limited to 'testsuite/synth/issue662')
-rw-r--r--testsuite/synth/issue662/psl_rose.vhdl25
-rw-r--r--testsuite/synth/issue662/tb_psl_rose.vhdl37
-rwxr-xr-xtestsuite/synth/issue662/testsuite.sh2
3 files changed, 63 insertions, 1 deletions
diff --git a/testsuite/synth/issue662/psl_rose.vhdl b/testsuite/synth/issue662/psl_rose.vhdl
new file mode 100644
index 000000000..83e9a6c04
--- /dev/null
+++ b/testsuite/synth/issue662/psl_rose.vhdl
@@ -0,0 +1,25 @@
+library ieee;
+use ieee.std_logic_1164.all;
+
+entity psl_rose is
+ port (clk, a, b : in std_logic
+ );
+end entity psl_rose;
+
+
+architecture psl of psl_rose is
+begin
+
+ -- All is sensitive to rising edge of clk
+ default clock is rising_edge(clk);
+
+ -- This assertion holds
+ ROSE_0_a : assert always {not a; a} |-> rose(a);
+
+ -- This assertion holds
+ ROSE_1_a : assert always (rose(a) -> (prev(a) = '0' and a = '1'));
+
+ -- This assertion should fail at cycle 11
+ ROSE_2_a : assert always rose(a) -> b;
+
+end architecture psl;
diff --git a/testsuite/synth/issue662/tb_psl_rose.vhdl b/testsuite/synth/issue662/tb_psl_rose.vhdl
new file mode 100644
index 000000000..80babc56e
--- /dev/null
+++ b/testsuite/synth/issue662/tb_psl_rose.vhdl
@@ -0,0 +1,37 @@
+library ieee;
+ use ieee.std_logic_1164.all;
+
+entity tb_psl_rose is
+end entity tb_psl_rose;
+
+
+architecture psl of tb_psl_rose is
+
+ procedure seq (s : string; signal clk : std_logic; signal o : out std_logic)
+ is
+ begin
+ for i in s'range loop
+ wait until rising_edge(clk);
+ case s(i) is
+ when '0' | '_' => o <= '0';
+ when '1' | '-' => o <= '1';
+ when others => o <= 'X';
+ end case;
+ end loop;
+ wait;
+ end seq;
+
+ signal a, b : std_logic := '0';
+ signal clk : std_logic := '1';
+
+begin
+
+ dut: entity work.psl_rose port map (clk, a, b);
+
+ clk <= not clk after 500 ps;
+
+ -- 012345678901234
+ SEQ_A : seq ("__-__---___--__", clk, a);
+ SEQ_B : seq ("__-__-______-__", clk, b);
+
+end architecture psl;
diff --git a/testsuite/synth/issue662/testsuite.sh b/testsuite/synth/issue662/testsuite.sh
index 62e06f718..1047b853e 100755
--- a/testsuite/synth/issue662/testsuite.sh
+++ b/testsuite/synth/issue662/testsuite.sh
@@ -4,7 +4,7 @@
GHDL_STD_FLAGS=--std=08
-for test in psl_prev psl_stable; do
+for test in psl_prev psl_stable psl_rose; do
synth_analyze $test
analyze tb_${test}.vhdl
elab_simulate_failure tb_${test} --stop-time=20ns --asserts=disable-at-0 --assert-level=error