From c121783be11334acd9226ef3962f5595c72e59d8 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sun, 23 Feb 2020 08:43:38 +0100 Subject: testsuite/synth: add tests for memory ports order. --- testsuite/synth/mem01/NOTES.txt | 3 ++- testsuite/synth/mem01/sram03.vhdl | 29 +++++++++++++++++++++++++++++ testsuite/synth/mem01/testsuite.sh | 2 +- 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 testsuite/synth/mem01/sram03.vhdl diff --git a/testsuite/synth/mem01/NOTES.txt b/testsuite/synth/mem01/NOTES.txt index 3c362c073..8f8e1af0f 100644 --- a/testsuite/synth/mem01/NOTES.txt +++ b/testsuite/synth/mem01/NOTES.txt @@ -5,7 +5,8 @@ rom1: asynchronous ROM srom01: Read (initialized ROM). sram01: Read+Write (at the same address). -sram02: Write+Read (at the same address). +sram02: Write+Read (at the same address, enable, variable). +sram03: Read+Write (at the same address, enable, signal and R appears after W). dpram1: Read+Write (using signals, without enables) dpram2: Read+Write (using a variable, without enables) dpram3: Read+Write (like dpram2 but downto) diff --git a/testsuite/synth/mem01/sram03.vhdl b/testsuite/synth/mem01/sram03.vhdl new file mode 100644 index 000000000..01dfbd7d0 --- /dev/null +++ b/testsuite/synth/mem01/sram03.vhdl @@ -0,0 +1,29 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +entity sram03 is + port ( + clk_i : std_logic; + addr_i : std_logic_vector(3 downto 0); + data_i : std_logic_vector(7 downto 0); + data_o : out std_logic_vector(7 downto 0); + wen_i : std_logic); +end sram03; + +architecture behav of sram03 is + type mem_type is array (0 to 15) of std_logic_vector (7 downto 0); + signal mem : mem_type; +begin + process (clk_i, addr_i) + variable addr : natural range mem_type'range; + begin + if rising_edge(clk_i) then + addr := to_integer (unsigned (addr_i)); + if wen_i = '1' then + mem (addr) <= data_i; + end if; + data_o <= mem (addr); + end if; + end process; +end behav; diff --git a/testsuite/synth/mem01/testsuite.sh b/testsuite/synth/mem01/testsuite.sh index 073c69ea4..315ff4f4e 100755 --- a/testsuite/synth/mem01/testsuite.sh +++ b/testsuite/synth/mem01/testsuite.sh @@ -2,7 +2,7 @@ . ../../testenv.sh -for t in rom1 srom01 sram01 dpram1 dpram2 dpram3; do +for t in rom1 srom01 sram01 sram02 sram03 dpram1 dpram2 dpram3; do analyze $t.vhdl tb_$t.vhdl elab_simulate tb_$t clean -- cgit v1.2.3