From ba7b4c65e28fd3de9df3a3b61e3394cc470115d3 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Thu, 15 Dec 2016 09:06:15 +0100 Subject: Add testcase for #225 --- testsuite/gna/issue225/repro.vhdl | 33 +++++++++++++++++++++++++++++ testsuite/gna/issue225/tb.vhdl | 41 +++++++++++++++++++++++++++++++++++++ testsuite/gna/issue225/testsuite.sh | 13 ++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 testsuite/gna/issue225/repro.vhdl create mode 100644 testsuite/gna/issue225/tb.vhdl create mode 100755 testsuite/gna/issue225/testsuite.sh (limited to 'testsuite/gna/issue225') 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" -- cgit v1.2.3