diff options
author | Tristan Gingold <tgingold@free.fr> | 2020-03-08 21:15:49 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2020-03-08 21:15:49 +0100 |
commit | 933093129777685670e01e267e3354bbdf771417 (patch) | |
tree | 23a094cdeebd2df0937d1f2fc5bc913f348da8bb /testsuite | |
parent | 442f905f3549cfc959c15a54c6b8d26e3cdd3052 (diff) | |
download | ghdl-933093129777685670e01e267e3354bbdf771417.tar.gz ghdl-933093129777685670e01e267e3354bbdf771417.tar.bz2 ghdl-933093129777685670e01e267e3354bbdf771417.zip |
testsuite/synth: add test for previous commit.
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/synth/func03/func01.vhdl | 18 | ||||
-rw-r--r-- | testsuite/synth/func03/tb_func01.vhdl | 29 | ||||
-rwxr-xr-x | testsuite/synth/func03/testsuite.sh | 9 |
3 files changed, 56 insertions, 0 deletions
diff --git a/testsuite/synth/func03/func01.vhdl b/testsuite/synth/func03/func01.vhdl new file mode 100644 index 000000000..53f0a5c2c --- /dev/null +++ b/testsuite/synth/func03/func01.vhdl @@ -0,0 +1,18 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +entity func01 is + port (a : std_logic_vector (7 downto 0); + b : out std_logic_vector (7 downto 0)); +end func01; + +architecture behav of func01 is + function "+"(l, r : std_logic_vector) return std_logic_Vector is + begin + return std_logic_vector(unsigned(l) + unsigned(r)); + end "+"; +begin + b <= a + a; +end behav; + diff --git a/testsuite/synth/func03/tb_func01.vhdl b/testsuite/synth/func03/tb_func01.vhdl new file mode 100644 index 000000000..42bdb3546 --- /dev/null +++ b/testsuite/synth/func03/tb_func01.vhdl @@ -0,0 +1,29 @@ +entity tb_func01 is +end tb_func01; + +library ieee; +use ieee.std_logic_1164.all; + +architecture behav of tb_func01 is + signal a, b : std_logic_vector(7 downto 0); +begin + dut: entity work.func01 + port map (a, b); + + process + begin + a <= x"5d"; + wait for 1 ns; + assert b = x"ba" severity failure; + + a <= x"ff"; + wait for 1 ns; + assert b = x"fe" severity failure; + + a <= x"23"; + wait for 1 ns; + assert b = x"46" severity failure; + + wait; + end process; +end behav; diff --git a/testsuite/synth/func03/testsuite.sh b/testsuite/synth/func03/testsuite.sh new file mode 100755 index 000000000..74351ab7e --- /dev/null +++ b/testsuite/synth/func03/testsuite.sh @@ -0,0 +1,9 @@ +#! /bin/sh + +. ../../testenv.sh + +for t in func01; do + synth_tb $t +done + +echo "Test successful" |