aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna/issue225
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2016-12-15 09:06:15 +0100
committerTristan Gingold <tgingold@free.fr>2016-12-15 09:06:15 +0100
commitba7b4c65e28fd3de9df3a3b61e3394cc470115d3 (patch)
tree5371ca1a1c49667dbb05f915fbb4600a57e9461f /testsuite/gna/issue225
parent60f245f0bc7046e8050162b9ab26571a490c2ac4 (diff)
downloadghdl-ba7b4c65e28fd3de9df3a3b61e3394cc470115d3.tar.gz
ghdl-ba7b4c65e28fd3de9df3a3b61e3394cc470115d3.tar.bz2
ghdl-ba7b4c65e28fd3de9df3a3b61e3394cc470115d3.zip
Add testcase for #225
Diffstat (limited to 'testsuite/gna/issue225')
-rw-r--r--testsuite/gna/issue225/repro.vhdl33
-rw-r--r--testsuite/gna/issue225/tb.vhdl41
-rwxr-xr-xtestsuite/gna/issue225/testsuite.sh13
3 files changed, 87 insertions, 0 deletions
diff --git a/testsuite/gna/issue225/repro.vhdl b/testsuite/gna/issue225/repro.vhdl
new file mode 100644
index 000000000..d23cccd36
--- /dev/null
+++ b/testsuite/gna/issue225/repro.vhdl
@@ -0,0 +1,33 @@
+entity foo is
+ port (
+ a0 : in bit_vector(1 downto 0)
+ );
+end entity;
+
+architecture bar of foo is
+begin
+ assert a0(0) = '0';
+end architecture;
+
+entity foo_tb is
+ generic
+ ( DEFAULT_X : bit_vector(1 downto 0) := (others => '0')
+ );
+end entity;
+
+architecture tb of foo_tb is
+
+ function compute_stuff_with_x(x : bit_vector) return bit_vector is
+ begin
+ return x;
+ end compute_stuff_with_x;
+
+begin
+
+ foo_inst:
+ entity work.foo
+ port map
+ ( a0 => compute_stuff_with_x(DEFAULT_X)
+ );
+
+end architecture;
diff --git a/testsuite/gna/issue225/tb.vhdl b/testsuite/gna/issue225/tb.vhdl
new file mode 100644
index 000000000..362533a79
--- /dev/null
+++ b/testsuite/gna/issue225/tb.vhdl
@@ -0,0 +1,41 @@
+library ieee;
+use ieee.std_logic_1164.all;
+use ieee.numeric_std.all;
+
+entity foo is
+ port (
+ a0 : in unsigned(1 downto 0)
+ );
+end entity;
+
+architecture bar of foo is
+begin
+ assert a0 = "01";
+end architecture;
+
+library ieee;
+use ieee.std_logic_1164.all;
+use ieee.numeric_std.all;
+
+entity foo_tb is
+ generic
+ ( DEFAULT_X : unsigned(1 downto 0) := (others => '0')
+ );
+end entity;
+
+architecture tb of foo_tb is
+
+ function compute_stuff_with_x(x : unsigned) return unsigned is
+ begin
+ return x + 1;
+ end compute_stuff_with_x;
+
+begin
+
+ foo_inst:
+ entity work.foo
+ port map
+ ( a0 => compute_stuff_with_x(DEFAULT_X)
+ );
+
+end architecture;
diff --git a/testsuite/gna/issue225/testsuite.sh b/testsuite/gna/issue225/testsuite.sh
new file mode 100755
index 000000000..fc2a108fc
--- /dev/null
+++ b/testsuite/gna/issue225/testsuite.sh
@@ -0,0 +1,13 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+analyze repro.vhdl
+elab_simulate foo_tb
+
+analyze tb.vhdl
+elab_simulate foo_tb
+
+clean
+
+echo "Test successful"