aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/synth/issue2169
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-08-09 21:45:11 +0200
committerTristan Gingold <tgingold@free.fr>2022-08-10 03:00:10 +0200
commitcb3e7b0f954f91c7a1d4702006b18d0041d6eb0d (patch)
treebcb9aded82099df081812060f623b42febb2b35f /testsuite/synth/issue2169
parent9034e7fba36540f0f38d9aa55e91391c5804d649 (diff)
downloadghdl-cb3e7b0f954f91c7a1d4702006b18d0041d6eb0d.tar.gz
ghdl-cb3e7b0f954f91c7a1d4702006b18d0041d6eb0d.tar.bz2
ghdl-cb3e7b0f954f91c7a1d4702006b18d0041d6eb0d.zip
testsuite/synth: add a test for #2169
Diffstat (limited to 'testsuite/synth/issue2169')
-rw-r--r--testsuite/synth/issue2169/bug.vhdl17
-rw-r--r--testsuite/synth/issue2169/mul.vhdl17
-rw-r--r--testsuite/synth/issue2169/tb.vhdl31
-rw-r--r--testsuite/synth/issue2169/tb_mul.vhdl31
-rwxr-xr-xtestsuite/synth/issue2169/testsuite.sh7
5 files changed, 103 insertions, 0 deletions
diff --git a/testsuite/synth/issue2169/bug.vhdl b/testsuite/synth/issue2169/bug.vhdl
new file mode 100644
index 000000000..1233d91e1
--- /dev/null
+++ b/testsuite/synth/issue2169/bug.vhdl
@@ -0,0 +1,17 @@
+library IEEE;
+use IEEE.std_logic_1164.all;
+use IEEE.numeric_std.all;
+
+entity bug is
+ port(
+ a : in unsigned( 7 downto 0);
+ b : in unsigned(15 downto 0);
+ r : out unsigned(23 downto 0)
+ );
+end entity;
+
+architecture rtl of bug is
+
+begin
+ r <= resize(a*b, 24);
+end architecture;
diff --git a/testsuite/synth/issue2169/mul.vhdl b/testsuite/synth/issue2169/mul.vhdl
new file mode 100644
index 000000000..6a32b7692
--- /dev/null
+++ b/testsuite/synth/issue2169/mul.vhdl
@@ -0,0 +1,17 @@
+library IEEE;
+use IEEE.std_logic_1164.all;
+use IEEE.numeric_std.all;
+
+entity mul is
+ port(
+ a : in unsigned( 7 downto 0);
+ b : in unsigned(15 downto 0);
+ r : out unsigned(23 downto 0)
+ );
+end entity;
+
+architecture rtl of mul is
+
+begin
+ r <= resize(a*b, 24);
+end architecture;
diff --git a/testsuite/synth/issue2169/tb.vhdl b/testsuite/synth/issue2169/tb.vhdl
new file mode 100644
index 000000000..d30be60b9
--- /dev/null
+++ b/testsuite/synth/issue2169/tb.vhdl
@@ -0,0 +1,31 @@
+library IEEE;
+use IEEE.std_logic_1164.all;
+use IEEE.numeric_std.all;
+
+entity tb_mul is
+end entity;
+
+architecture tb of tb_mul is
+ signal a : unsigned( 7 downto 0);
+ signal b : unsigned(15 downto 0);
+ signal r : unsigned(23 downto 0);
+begin
+
+ u0 : entity work.bug
+ port map(
+ a => a,
+ b => b,
+ r => r
+ );
+
+ process
+ begin
+ a <= to_unsigned(243,8);
+ b <= to_unsigned(34560,16);
+ wait for 1 ns;
+ report integer'image(to_integer(r));
+ assert r = to_unsigned(8398080, 24);
+ wait;
+ end process;
+
+end architecture;
diff --git a/testsuite/synth/issue2169/tb_mul.vhdl b/testsuite/synth/issue2169/tb_mul.vhdl
new file mode 100644
index 000000000..999d1a05f
--- /dev/null
+++ b/testsuite/synth/issue2169/tb_mul.vhdl
@@ -0,0 +1,31 @@
+library IEEE;
+use IEEE.std_logic_1164.all;
+use IEEE.numeric_std.all;
+
+entity tb_mul is
+end entity;
+
+architecture tb of tb_mul is
+ signal a : unsigned( 7 downto 0);
+ signal b : unsigned(15 downto 0);
+ signal r : unsigned(23 downto 0);
+begin
+
+ u0 : entity work.mul
+ port map(
+ a => a,
+ b => b,
+ r => r
+ );
+
+ process
+ begin
+ a <= to_unsigned(243,8);
+ b <= to_unsigned(34560,16);
+ wait for 1 ns;
+ report integer'image(to_integer(r));
+ assert r = to_unsigned(8398080, 24);
+ wait;
+ end process;
+
+end architecture;
diff --git a/testsuite/synth/issue2169/testsuite.sh b/testsuite/synth/issue2169/testsuite.sh
new file mode 100755
index 000000000..7ebdd2eb9
--- /dev/null
+++ b/testsuite/synth/issue2169/testsuite.sh
@@ -0,0 +1,7 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+synth_tb mul
+
+echo "Test successful"