aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-10-15 06:43:26 +0200
committerTristan Gingold <tgingold@free.fr>2019-10-15 06:43:26 +0200
commit001bdb593ff5d2413c3a3a39ee0b65fc20a27cd0 (patch)
treef0d003b3e17179f7531082f52d3a9e3d4d8b9ea4 /testsuite
parentacf68c6a935edaf9cd3f575a5606e8fc6bd0fecb (diff)
downloadghdl-001bdb593ff5d2413c3a3a39ee0b65fc20a27cd0.tar.gz
ghdl-001bdb593ff5d2413c3a3a39ee0b65fc20a27cd0.tar.bz2
ghdl-001bdb593ff5d2413c3a3a39ee0b65fc20a27cd0.zip
testsuite/synth: add a test for --work option within files.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/synth/lib01/and2.vhdl12
-rw-r--r--testsuite/synth/lib01/and3.vhdl17
-rw-r--r--testsuite/synth/lib01/tb_and3.vhdl30
-rwxr-xr-xtestsuite/synth/lib01/testsuite.sh16
4 files changed, 75 insertions, 0 deletions
diff --git a/testsuite/synth/lib01/and2.vhdl b/testsuite/synth/lib01/and2.vhdl
new file mode 100644
index 000000000..e2d18ed02
--- /dev/null
+++ b/testsuite/synth/lib01/and2.vhdl
@@ -0,0 +1,12 @@
+library ieee;
+use ieee.std_logic_1164.all;
+
+entity and2 is
+ port (a, b : std_logic;
+ o : out std_logic);
+end and2;
+
+architecture behav of and2 is
+begin
+ o <= a and b;
+end behav;
diff --git a/testsuite/synth/lib01/and3.vhdl b/testsuite/synth/lib01/and3.vhdl
new file mode 100644
index 000000000..baf808e27
--- /dev/null
+++ b/testsuite/synth/lib01/and3.vhdl
@@ -0,0 +1,17 @@
+library ieee;
+use ieee.std_logic_1164.all;
+library mylib;
+
+entity and3 is
+ port (i0, i1, i2 : std_logic;
+ o : out std_logic);
+end and3;
+
+architecture behav of and3 is
+ signal t1 : std_logic;
+begin
+ a1: entity mylib.and2
+ port map (i0, i1, t1);
+ a2: entity mylib.and2
+ port map (t1, i2, o);
+end behav;
diff --git a/testsuite/synth/lib01/tb_and3.vhdl b/testsuite/synth/lib01/tb_and3.vhdl
new file mode 100644
index 000000000..3acf0c282
--- /dev/null
+++ b/testsuite/synth/lib01/tb_and3.vhdl
@@ -0,0 +1,30 @@
+library ieee;
+use ieee.std_logic_1164.all;
+
+entity tb_and3 is
+end tb_and3;
+
+architecture behav of tb_and3 is
+ signal i0, i1, i2 : std_logic;
+ signal o : std_logic;
+
+begin
+ dut : entity work.and3
+ port map (i0 => i0, i1 => i1, i2 => i2, o => o);
+
+ process
+ constant v0 : std_logic_vector := b"1011";
+ constant v1 : std_logic_vector := b"1111";
+ constant v2 : std_logic_vector := b"1101";
+ constant ov : std_logic_vector := b"1001";
+ begin
+ for i in ov'range loop
+ i0 <= v0 (i);
+ i1 <= v1 (i);
+ i2 <= v2 (i);
+ wait for 1 ns;
+ assert o = ov(i) severity failure;
+ end loop;
+ wait;
+ end process;
+end behav;
diff --git a/testsuite/synth/lib01/testsuite.sh b/testsuite/synth/lib01/testsuite.sh
new file mode 100755
index 000000000..621e78d14
--- /dev/null
+++ b/testsuite/synth/lib01/testsuite.sh
@@ -0,0 +1,16 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+analyze --work=mylib and2.vhdl
+analyze and3.vhdl tb_and3.vhdl
+elab_simulate tb_and3
+clean
+
+synth --work=mylib and2.vhdl --work=work and3.vhdl -e and3 > syn_and3.vhdl
+analyze syn_and3.vhdl tb_and3.vhdl
+elab_simulate tb_and3
+clean
+clean mylib
+
+echo "Test successful"