aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-11-06 03:57:59 +0100
committerTristan Gingold <tgingold@free.fr>2019-11-06 03:57:59 +0100
commit016591a902e5746986244064c12183847f2f1101 (patch)
tree98843f670b6b7bc2e3c0a203d7d66c4a3501a8c7 /testsuite
parent690470aa7380ce198bfa170977a0932b83123a72 (diff)
downloadghdl-yosys-plugin-016591a902e5746986244064c12183847f2f1101.tar.gz
ghdl-yosys-plugin-016591a902e5746986244064c12183847f2f1101.tar.bz2
ghdl-yosys-plugin-016591a902e5746986244064c12183847f2f1101.zip
Add testcase from issue 1001
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/ghdl-issues/issue1001/async.vhdl35
-rw-r--r--testsuite/ghdl-issues/issue1001/sync.vhdl37
-rwxr-xr-xtestsuite/ghdl-issues/issue1001/testsuite.sh10
3 files changed, 82 insertions, 0 deletions
diff --git a/testsuite/ghdl-issues/issue1001/async.vhdl b/testsuite/ghdl-issues/issue1001/async.vhdl
new file mode 100644
index 0000000..d2c4707
--- /dev/null
+++ b/testsuite/ghdl-issues/issue1001/async.vhdl
@@ -0,0 +1,35 @@
+library ieee;
+use ieee.std_logic_1164.all;
+
+entity test is
+ port (
+ Reset_n_i : in std_logic;
+ Clk_i : in std_logic;
+ Wen_i : in std_logic;
+ Addr_i : in natural range 0 to 2**8-1;
+ Din_i : in std_logic_vector(7 downto 0);
+ Dout_o : out std_logic_vector(7 downto 0)
+ );
+end entity test;
+
+architecture rtl of test is
+
+ type t_register is array(0 to 7) of std_logic_vector(7 downto 0);
+ signal s_register : t_register;
+
+begin
+
+ Dout_o <= s_register(Addr_i);
+
+ WriteP : process (Clk_i, Reset_n_i) is
+ begin
+ if Reset_n_i = '0' then
+ s_register <= (others => (others => '0'));
+ elsif rising_edge(Clk_i) then
+ if Wen_i = '1' then
+ s_register(Addr_i) <= Din_i;
+ end if;
+ end if;
+ end process WriteP;
+
+end architecture rtl;
diff --git a/testsuite/ghdl-issues/issue1001/sync.vhdl b/testsuite/ghdl-issues/issue1001/sync.vhdl
new file mode 100644
index 0000000..2a21371
--- /dev/null
+++ b/testsuite/ghdl-issues/issue1001/sync.vhdl
@@ -0,0 +1,37 @@
+library ieee;
+use ieee.std_logic_1164.all;
+
+entity test is
+ port (
+ Reset_n_i : in std_logic;
+ Clk_i : in std_logic;
+ Wen_i : in std_logic;
+ Addr_i : in natural range 0 to 2**8-1;
+ Din_i : in std_logic_vector(7 downto 0);
+ Dout_o : out std_logic_vector(7 downto 0)
+ );
+end entity test;
+
+architecture rtl of test is
+
+ type t_register is array(0 to 7) of std_logic_vector(7 downto 0);
+ signal s_register : t_register;
+
+begin
+
+ Dout_o <= s_register(Addr_i);
+
+ WriteP : process (Clk_i) is
+ begin
+ if rising_edge(Clk_i) then
+ if Reset_n_i = '0' then
+ s_register <= (others => (others => '0'));
+ else
+ if Wen_i = '1' then
+ s_register(Addr_i) <= Din_i;
+ end if;
+ end if;
+ end if;
+ end process WriteP;
+
+end architecture rtl;
diff --git a/testsuite/ghdl-issues/issue1001/testsuite.sh b/testsuite/ghdl-issues/issue1001/testsuite.sh
new file mode 100755
index 0000000..dc4749c
--- /dev/null
+++ b/testsuite/ghdl-issues/issue1001/testsuite.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+topdir=../..
+. $topdir/testenv.sh
+
+synth_import sync.vhdl -e
+synth_import async.vhdl -e
+
+clean
+echo OK