aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2018-02-18 07:39:30 +0100
committerTristan Gingold <tgingold@free.fr>2018-02-18 07:40:17 +0100
commit047a8c2a033ac21ac17b5d05584795f83cfcd776 (patch)
tree9ed101041529d6390c814964f30a84d28875c86a /testsuite
parentc95389e1c44b5ad2b54b3b7d4eeb666a0a87a1ac (diff)
downloadghdl-047a8c2a033ac21ac17b5d05584795f83cfcd776.tar.gz
ghdl-047a8c2a033ac21ac17b5d05584795f83cfcd776.tar.bz2
ghdl-047a8c2a033ac21ac17b5d05584795f83cfcd776.zip
Add reproducer for #529
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/gna/issue529/impure1.vhdl38
-rw-r--r--testsuite/gna/issue529/impure2.vhdl27
-rwxr-xr-xtestsuite/gna/issue529/testsuite.sh14
3 files changed, 79 insertions, 0 deletions
diff --git a/testsuite/gna/issue529/impure1.vhdl b/testsuite/gna/issue529/impure1.vhdl
new file mode 100644
index 000000000..7cd3181d2
--- /dev/null
+++ b/testsuite/gna/issue529/impure1.vhdl
@@ -0,0 +1,38 @@
+library ieee;
+ use ieee.std_logic_1164.all;
+
+entity impure_ex is
+port (
+ clk : in std_logic;
+ arg : in std_logic;
+ res : out std_logic
+);
+end impure_ex;
+
+architecture rtl of impure_ex is
+
+ -- An impure function called from a combinatorial process with "all"
+ -- sensitivity triggers an exception.
+ impure function foo return std_logic is
+ begin
+ return arg;
+ end function foo;
+
+ signal ns : std_logic;
+
+begin
+
+ --comb_process : process(res) -- this works
+ comb_process : process(all)
+ begin
+ ns <= res XOR foo;
+ end process;
+
+ process(clk)
+ begin
+ if rising_edge(clk) then
+ res <= ns;
+ end if;
+ end process;
+
+end rtl;
diff --git a/testsuite/gna/issue529/impure2.vhdl b/testsuite/gna/issue529/impure2.vhdl
new file mode 100644
index 000000000..83f37ccc0
--- /dev/null
+++ b/testsuite/gna/issue529/impure2.vhdl
@@ -0,0 +1,27 @@
+entity impure_ex2 is
+port (
+ clk : in bit;
+ arg : in bit;
+ res : out bit
+);
+end impure_ex2;
+
+architecture rtl of impure_ex2 is
+
+ -- An impure function called from a combinatorial process with "all"
+ -- sensitivity triggers an exception.
+ impure function foo return bit is
+ begin
+ return arg;
+ end function foo;
+
+ signal ns : bit;
+
+begin
+
+ --comb_process : process(res) -- this works
+ comb_process : process(all)
+ begin
+ ns <= res XOR foo;
+ end process;
+end rtl;
diff --git a/testsuite/gna/issue529/testsuite.sh b/testsuite/gna/issue529/testsuite.sh
new file mode 100755
index 000000000..d5acb6a05
--- /dev/null
+++ b/testsuite/gna/issue529/testsuite.sh
@@ -0,0 +1,14 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+export GHDL_STD_FLAGS=--std=08
+analyze impure1.vhdl
+elab_simulate impure_ex
+
+analyze impure2.vhdl
+elab_simulate impure_ex2
+
+clean
+
+echo "Test successful"