diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-10-07 18:26:32 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-10-07 18:26:32 +0200 |
commit | 8d3778ffbb30ecb023bd1989d938f6cf83e1436c (patch) | |
tree | a4a9cd5c3bb458d8c58faa0afb7da7f4145d975d /testsuite | |
parent | 27ce4a93d4bfc66dc50eadcf59375b4ac541c66a (diff) | |
download | ghdl-8d3778ffbb30ecb023bd1989d938f6cf83e1436c.tar.gz ghdl-8d3778ffbb30ecb023bd1989d938f6cf83e1436c.tar.bz2 ghdl-8d3778ffbb30ecb023bd1989d938f6cf83e1436c.zip |
testsuite/synth: add pkg01
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/synth/pkg01/cmask.vhdl | 14 | ||||
-rw-r--r-- | testsuite/synth/pkg01/mixer.vhdl | 15 | ||||
-rw-r--r-- | testsuite/synth/pkg01/pkg.vhdl | 6 | ||||
-rw-r--r-- | testsuite/synth/pkg01/tb_mixer.vhdl | 32 | ||||
-rwxr-xr-x | testsuite/synth/pkg01/testsuite.sh | 15 |
5 files changed, 82 insertions, 0 deletions
diff --git a/testsuite/synth/pkg01/cmask.vhdl b/testsuite/synth/pkg01/cmask.vhdl new file mode 100644 index 000000000..f2fe1a075 --- /dev/null +++ b/testsuite/synth/pkg01/cmask.vhdl @@ -0,0 +1,14 @@ +library ieee; +use ieee.std_logic_1164.all; + +entity cmask is + port (d : std_logic_vector (7 downto 0); + o : out std_logic_vector (7 downto 0)); +end cmask; + +use work.pkg.all; + +architecture behav of cmask is +begin + o <= d and mask; +end behav; diff --git a/testsuite/synth/pkg01/mixer.vhdl b/testsuite/synth/pkg01/mixer.vhdl new file mode 100644 index 000000000..92ed2c78e --- /dev/null +++ b/testsuite/synth/pkg01/mixer.vhdl @@ -0,0 +1,15 @@ +library ieee; +use ieee.std_logic_1164.all; + +entity mixer is + port (h, l : std_logic_vector(7 downto 0); + o : out std_logic_vector (7 downto 0)); +end mixer; + +architecture behav of mixer is + signal t1 : std_logic_vector (7 downto 0); +begin + a1: entity work.cmask + port map (l, t1); + o <= t1 or h; +end behav; diff --git a/testsuite/synth/pkg01/pkg.vhdl b/testsuite/synth/pkg01/pkg.vhdl new file mode 100644 index 000000000..a3c226786 --- /dev/null +++ b/testsuite/synth/pkg01/pkg.vhdl @@ -0,0 +1,6 @@ +library ieee; +use ieee.std_logic_1164.all; + +package pkg is + constant mask : std_logic_vector (7 downto 0) := x"0f"; +end pkg; diff --git a/testsuite/synth/pkg01/tb_mixer.vhdl b/testsuite/synth/pkg01/tb_mixer.vhdl new file mode 100644 index 000000000..4085ba9a9 --- /dev/null +++ b/testsuite/synth/pkg01/tb_mixer.vhdl @@ -0,0 +1,32 @@ +library ieee; +use ieee.std_logic_1164.all; + +entity tb_mixer is +end tb_mixer; + +architecture behav of tb_mixer is + signal h, l, o : std_logic_vector (7 downto 0); +begin + dut : entity work.mixer + port map (h => h, l => l, o => o); + + process + begin + h <= x"00"; + l <= x"ab"; + wait for 1 ns; + assert o = x"0b" severity failure; + + h <= x"50"; + l <= x"a6"; + wait for 1 ns; + assert o = x"56" severity failure; + + h <= x"a3"; + l <= x"5c"; + wait for 1 ns; + assert o = x"af" severity failure; + + wait; + end process; +end behav; diff --git a/testsuite/synth/pkg01/testsuite.sh b/testsuite/synth/pkg01/testsuite.sh new file mode 100755 index 000000000..73ee22454 --- /dev/null +++ b/testsuite/synth/pkg01/testsuite.sh @@ -0,0 +1,15 @@ +#! /bin/sh + +. ../../testenv.sh + +# Direct instance +analyze pkg.vhdl cmask.vhdl mixer.vhdl tb_mixer.vhdl +elab_simulate tb_mixer +clean + +synth pkg.vhdl cmask.vhdl mixer.vhdl -e mixer > syn_mixer.vhdl +analyze syn_mixer.vhdl tb_mixer.vhdl +elab_simulate tb_mixer +clean + +echo "Test successful" |