diff options
author | Tristan Gingold <tgingold@free.fr> | 2022-04-15 11:42:06 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2022-04-15 11:42:06 +0200 |
commit | d71a4391c20867d7e7ccc3a71a90cc4743fef610 (patch) | |
tree | 93623f40aa6d45899e7cd022f2d6cd02236e09d3 /testsuite/gna/bug0129/repro1.vhdl | |
parent | a7714952ffaf31d700dc25694fb3f6ebd5ecf320 (diff) | |
download | ghdl-d71a4391c20867d7e7ccc3a71a90cc4743fef610.tar.gz ghdl-d71a4391c20867d7e7ccc3a71a90cc4743fef610.tar.bz2 ghdl-d71a4391c20867d7e7ccc3a71a90cc4743fef610.zip |
testsuite/gna: add a test for previous commit
Diffstat (limited to 'testsuite/gna/bug0129/repro1.vhdl')
-rw-r--r-- | testsuite/gna/bug0129/repro1.vhdl | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/testsuite/gna/bug0129/repro1.vhdl b/testsuite/gna/bug0129/repro1.vhdl new file mode 100644 index 000000000..0f91edfac --- /dev/null +++ b/testsuite/gna/bug0129/repro1.vhdl @@ -0,0 +1,52 @@ +library IEEE; +use IEEE.std_logic_1164.all; + +entity repro1 is + port (tready : inout std_logic); +end; + +architecture RTL of repro1 is + +-- signal tready : std_logic; + signal cnt : natural; + signal cnt_next : natural; +begin + + p_main: process (all) + + procedure count ( + constant r_ctr : in natural; + variable v_ctr : out natural + ) is + begin + if tready = '1' then + v_ctr := r_ctr + 1; + else + v_ctr := r_ctr; + end if; + end procedure; + + variable v : natural; + + begin + report "execution of process p_main, cnt=" & natural'image(cnt); + count (cnt, v); + + cnt_next <= v; + end process p_main; + + process + begin + tready <= '1'; + cnt <= 1; + wait for 1 ns; + assert cnt_next = 2 severity failure; + cnt <= 2; + wait for 1 ns; + assert cnt_next = 3 severity failure; + tready <= '0'; + wait for 1 ns; + assert cnt_next = 2 severity failure; + wait; + end process; +end; |