diff options
author | Tristan Gingold <tgingold@free.fr> | 2021-08-25 18:38:34 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2021-08-25 18:38:34 +0200 |
commit | 243bb15efb6e7573a278f19b22eaffa43c399714 (patch) | |
tree | 031e9d550f4882ab6ff9c04e23cdca6f753420c4 | |
parent | 2ef64244d0317a750a8a225b22a59c5b667ec8ee (diff) | |
download | ghdl-243bb15efb6e7573a278f19b22eaffa43c399714.tar.gz ghdl-243bb15efb6e7573a278f19b22eaffa43c399714.tar.bz2 ghdl-243bb15efb6e7573a278f19b22eaffa43c399714.zip |
testsuite/synth: add a test for #1838
-rw-r--r-- | testsuite/synth/issue1838/regfile.vhdl | 38 | ||||
-rwxr-xr-x | testsuite/synth/issue1838/testsuite.sh | 10 |
2 files changed, 48 insertions, 0 deletions
diff --git a/testsuite/synth/issue1838/regfile.vhdl b/testsuite/synth/issue1838/regfile.vhdl new file mode 100644 index 000000000..4b1110d8c --- /dev/null +++ b/testsuite/synth/issue1838/regfile.vhdl @@ -0,0 +1,38 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +entity register_file is + port( + clk : in std_logic; + + write_en : in std_ulogic; + write_addr : in std_ulogic_vector(6 downto 0); + write_data : in std_ulogic_vector(63 downto 0); + + read_addr : in std_ulogic_vector(6 downto 0); + read_data : out std_ulogic_vector(63 downto 0) + ); +end entity register_file; + +architecture behaviour of register_file is + type regfile is array(0 to 127) of std_ulogic_vector(63 downto 0); + signal registers : regfile; +begin + -- synchronous writes + register_write_0: process(clk) + begin + if rising_edge(clk) then + if write_en = '1' then + registers(to_integer(unsigned(write_addr))) <= write_data; + end if; + end if; + end process register_write_0; + + -- asynchronous reads + register_read_0: process(all) + begin + read_data <= registers(to_integer(unsigned(read_addr))); + end process register_read_0; + +end architecture behaviour; diff --git a/testsuite/synth/issue1838/testsuite.sh b/testsuite/synth/issue1838/testsuite.sh new file mode 100755 index 000000000..2f5c80312 --- /dev/null +++ b/testsuite/synth/issue1838/testsuite.sh @@ -0,0 +1,10 @@ +#! /bin/sh + +. ../../testenv.sh + +GHDL_STD_FLAGS=--std=08 +synth_analyze regfile +grep -q "variable registers :" syn_regfile.vhdl +clean + +echo "Test successful" |