aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/synth/issue1324
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-05-19 07:36:07 +0200
committerTristan Gingold <tgingold@free.fr>2020-05-19 07:36:07 +0200
commit42cbe9183ac8f2138ef827180baae4beaee2d3f1 (patch)
tree0f41b8bb176b00a7eaa97f8df2ed8b36e0917e19 /testsuite/synth/issue1324
parent5a1d83434d099fa39cb5e47a5679ed2fd89a3e74 (diff)
downloadghdl-42cbe9183ac8f2138ef827180baae4beaee2d3f1.tar.gz
ghdl-42cbe9183ac8f2138ef827180baae4beaee2d3f1.tar.bz2
ghdl-42cbe9183ac8f2138ef827180baae4beaee2d3f1.zip
testsuite/synth: add a test for #1324
Diffstat (limited to 'testsuite/synth/issue1324')
-rw-r--r--testsuite/synth/issue1324/foo.vhdl19
-rw-r--r--testsuite/synth/issue1324/pkg.vhdl11
-rw-r--r--testsuite/synth/issue1324/st.vhdl18
-rwxr-xr-xtestsuite/synth/issue1324/testsuite.sh10
4 files changed, 58 insertions, 0 deletions
diff --git a/testsuite/synth/issue1324/foo.vhdl b/testsuite/synth/issue1324/foo.vhdl
new file mode 100644
index 000000000..84c7698f6
--- /dev/null
+++ b/testsuite/synth/issue1324/foo.vhdl
@@ -0,0 +1,19 @@
+library ieee;
+use ieee.std_logic_1164.all;
+use ieee.numeric_std.all;
+use work.pkg.all;
+
+entity foo is
+ port (
+ bus_in : in bus_t(data(7 downto 0));
+ bus_out : out bus_t(data(7 downto 0))
+ );
+end foo;
+
+architecture foo of foo is
+
+begin
+
+ bus_out <= bus_in;
+
+end foo;
diff --git a/testsuite/synth/issue1324/pkg.vhdl b/testsuite/synth/issue1324/pkg.vhdl
new file mode 100644
index 000000000..956882663
--- /dev/null
+++ b/testsuite/synth/issue1324/pkg.vhdl
@@ -0,0 +1,11 @@
+library ieee;
+use ieee.std_logic_1164.all;
+use ieee.numeric_std.all;
+
+package pkg is
+ type bus_t is record
+ data : std_logic_vector;
+ valid : std_logic;
+ end record;
+
+end package pkg;
diff --git a/testsuite/synth/issue1324/st.vhdl b/testsuite/synth/issue1324/st.vhdl
new file mode 100644
index 000000000..640850e2b
--- /dev/null
+++ b/testsuite/synth/issue1324/st.vhdl
@@ -0,0 +1,18 @@
+entity st is
+end;
+
+architecture behav of st is
+ shared variable cnt : natural := 2;
+
+ impure function f return natural is
+ begin
+ cnt := cnt + 1;
+ return cnt;
+ end f;
+
+ signal s1, s2, s3 : bit_vector (1 to f) := (others => '0');
+begin
+ assert false report "s1'length=" & natural'image (s1'length);
+ assert false report "s2'length=" & natural'image (s2'length);
+ assert false report "s3'length=" & natural'image (s3'length);
+end behav;
diff --git a/testsuite/synth/issue1324/testsuite.sh b/testsuite/synth/issue1324/testsuite.sh
new file mode 100755
index 000000000..686b378dd
--- /dev/null
+++ b/testsuite/synth/issue1324/testsuite.sh
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+GHDL_STD_FLAGS=--std=08
+synth pkg.vhdl foo.vhdl -e > syn_foo.vhdl
+analyze pkg.vhdl syn_foo.vhdl
+clean
+
+echo "Test successful"