aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/synth/comp02/cmask.vhdl14
-rw-r--r--testsuite/synth/comp02/mixer.vhdl17
-rw-r--r--testsuite/synth/comp02/pkg.vhdl11
-rw-r--r--testsuite/synth/comp02/tb_mixer.vhdl32
-rwxr-xr-xtestsuite/synth/comp02/testsuite.sh15
5 files changed, 89 insertions, 0 deletions
diff --git a/testsuite/synth/comp02/cmask.vhdl b/testsuite/synth/comp02/cmask.vhdl
new file mode 100644
index 000000000..9b1f2438c
--- /dev/null
+++ b/testsuite/synth/comp02/cmask.vhdl
@@ -0,0 +1,14 @@
+library ieee;
+use ieee.std_logic_1164.all;
+
+entity cmask is
+ generic
+ (mask : std_logic_vector (0 to 7));
+ port (d : std_logic_vector (7 downto 0);
+ o : out std_logic_vector (7 downto 0));
+end cmask;
+
+architecture behav of cmask is
+begin
+ o <= d and mask;
+end behav;
diff --git a/testsuite/synth/comp02/mixer.vhdl b/testsuite/synth/comp02/mixer.vhdl
new file mode 100644
index 000000000..589f19980
--- /dev/null
+++ b/testsuite/synth/comp02/mixer.vhdl
@@ -0,0 +1,17 @@
+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;
+
+use work.pkg.all;
+architecture behav of mixer is
+ signal t1 : std_logic_vector (7 downto 0);
+begin
+ a1: cmask
+ generic map (mask => x"0f")
+ port map (l, t1);
+ o <= t1 or h;
+end behav;
diff --git a/testsuite/synth/comp02/pkg.vhdl b/testsuite/synth/comp02/pkg.vhdl
new file mode 100644
index 000000000..8d834a280
--- /dev/null
+++ b/testsuite/synth/comp02/pkg.vhdl
@@ -0,0 +1,11 @@
+library ieee;
+use ieee.std_logic_1164.all;
+
+package pkg is
+ component cmask is
+ generic
+ (mask : std_logic_vector (0 to 7));
+ port (d : std_logic_vector (7 downto 0);
+ o : out std_logic_vector (7 downto 0));
+ end component;
+end pkg;
diff --git a/testsuite/synth/comp02/tb_mixer.vhdl b/testsuite/synth/comp02/tb_mixer.vhdl
new file mode 100644
index 000000000..4085ba9a9
--- /dev/null
+++ b/testsuite/synth/comp02/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/comp02/testsuite.sh b/testsuite/synth/comp02/testsuite.sh
new file mode 100755
index 000000000..73ee22454
--- /dev/null
+++ b/testsuite/synth/comp02/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"