aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/synth/mem02
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-09-30 20:09:34 +0200
committerTristan Gingold <tgingold@free.fr>2019-09-30 20:09:34 +0200
commit65a096b1cd73dc30a6849fe1ff7b368d944515d9 (patch)
treee016b78b2b6c9504a96865cb746707d07e973e14 /testsuite/synth/mem02
parented4c48c6b2484059535a4d9642b3c13f53ee33ed (diff)
downloadghdl-65a096b1cd73dc30a6849fe1ff7b368d944515d9.tar.gz
ghdl-65a096b1cd73dc30a6849fe1ff7b368d944515d9.tar.bz2
ghdl-65a096b1cd73dc30a6849fe1ff7b368d944515d9.zip
testsuite/synth: add a test for 'to' direction.
Diffstat (limited to 'testsuite/synth/mem02')
-rw-r--r--testsuite/synth/mem02/ram6.vhdl25
-rw-r--r--testsuite/synth/mem02/tb_ram6.vhdl38
-rwxr-xr-xtestsuite/synth/mem02/testsuite.sh2
3 files changed, 64 insertions, 1 deletions
diff --git a/testsuite/synth/mem02/ram6.vhdl b/testsuite/synth/mem02/ram6.vhdl
new file mode 100644
index 000000000..621e7cc27
--- /dev/null
+++ b/testsuite/synth/mem02/ram6.vhdl
@@ -0,0 +1,25 @@
+library ieee;
+use ieee.std_logic_1164.all;
+use ieee.numeric_std.all;
+
+entity ram6 is
+ port (val : out std_logic_vector (7 downto 0);
+ waddr : std_logic_vector (2 downto 0);
+ wdat : std_logic;
+ clk : std_logic);
+end ram6;
+
+architecture behav of ram6 is
+ signal mem : std_logic_vector(0 to 7);
+begin
+ process (clk)
+ variable ra : natural;
+ variable wa : natural;
+ begin
+ if rising_edge (clk) then
+ ra := to_integer(unsigned (waddr));
+ mem(ra) <= wdat;
+ end if;
+ end process;
+ val <= mem;
+end behav;
diff --git a/testsuite/synth/mem02/tb_ram6.vhdl b/testsuite/synth/mem02/tb_ram6.vhdl
new file mode 100644
index 000000000..bf93b0be5
--- /dev/null
+++ b/testsuite/synth/mem02/tb_ram6.vhdl
@@ -0,0 +1,38 @@
+entity tb_ram6 is
+end tb_ram6;
+
+library ieee;
+use ieee.std_logic_1164.all;
+
+architecture behav of tb_ram6 is
+ signal val : std_logic_vector(7 downto 0);
+ signal waddr : std_logic_vector(2 downto 0);
+ signal wdat : std_logic;
+ signal clk : std_logic;
+begin
+ dut: entity work.ram6
+ port map (waddr => waddr, wdat => wdat, val => val,
+ clk => clk);
+
+ process
+ procedure pulse is
+ begin
+ clk <= '0';
+ wait for 1 ns;
+ clk <= '1';
+ wait for 1 ns;
+ end pulse;
+ begin
+ waddr <= "000";
+ wdat <= '0';
+ pulse;
+
+ waddr <= "001";
+ wdat <= '1';
+ pulse;
+
+ assert (val and x"c0") = x"40" severity failure;
+
+ wait;
+ end process;
+end behav;
diff --git a/testsuite/synth/mem02/testsuite.sh b/testsuite/synth/mem02/testsuite.sh
index d212c22e3..bd199178b 100755
--- a/testsuite/synth/mem02/testsuite.sh
+++ b/testsuite/synth/mem02/testsuite.sh
@@ -2,7 +2,7 @@
. ../../testenv.sh
-for t in dpram1 ram3 ram4; do
+for t in dpram1 ram3 ram4 ram6; do
analyze $t.vhdl tb_$t.vhdl
elab_simulate tb_$t
clean