aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/synth/memdp01/tb_dpram2r.vhdl
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-08-14 04:43:51 +0200
committerTristan Gingold <tgingold@free.fr>2022-08-14 20:53:48 +0200
commit119034986fb631d2e8baa8e90aa30febe5b95b55 (patch)
tree41f51e3d6eaf43d6cdd584e25a04af0a4156e12d /testsuite/synth/memdp01/tb_dpram2r.vhdl
parent00daf9d550e459f7cac4cdc2175cc3752098b41f (diff)
downloadghdl-119034986fb631d2e8baa8e90aa30febe5b95b55.tar.gz
ghdl-119034986fb631d2e8baa8e90aa30febe5b95b55.tar.bz2
ghdl-119034986fb631d2e8baa8e90aa30febe5b95b55.zip
testsuite/synth: rename mem2d01 to memdp01
Diffstat (limited to 'testsuite/synth/memdp01/tb_dpram2r.vhdl')
-rw-r--r--testsuite/synth/memdp01/tb_dpram2r.vhdl72
1 files changed, 72 insertions, 0 deletions
diff --git a/testsuite/synth/memdp01/tb_dpram2r.vhdl b/testsuite/synth/memdp01/tb_dpram2r.vhdl
new file mode 100644
index 000000000..854e5662a
--- /dev/null
+++ b/testsuite/synth/memdp01/tb_dpram2r.vhdl
@@ -0,0 +1,72 @@
+entity tb_dpram2r is
+end tb_dpram2r;
+
+library ieee;
+use ieee.std_logic_1164.all;
+
+architecture behav of tb_dpram2r is
+ signal raddr : natural range 0 to 3;
+ signal rnib : natural range 0 to 1;
+ signal rdat : std_logic_vector (3 downto 0);
+ signal waddr : natural range 0 to 3;
+ signal wdat : std_logic_vector(7 downto 0);
+ signal clk : std_logic;
+begin
+ dut: entity work.dpram2r
+ port map (raddr => raddr, rnib => rnib, rdat => rdat,
+ waddr => waddr, wdat => wdat,
+ clk => clk);
+
+ process
+ procedure pulse is
+ begin
+ clk <= '0';
+ wait for 1 ns;
+ clk <= '1';
+ wait for 1 ns;
+ end pulse;
+ begin
+ raddr <= 0;
+ rnib <= 0;
+ waddr <= 1;
+ wdat <= x"e1";
+ pulse;
+
+ raddr <= 1;
+ rnib <= 0;
+ waddr <= 0;
+ wdat <= x"f0";
+ pulse;
+ assert rdat = x"1" severity failure;
+
+ raddr <= 1;
+ rnib <= 1;
+ waddr <= 2;
+ wdat <= x"d2";
+ pulse;
+ assert rdat = x"e" severity failure;
+
+ raddr <= 2;
+ rnib <= 1;
+ waddr <= 3;
+ wdat <= x"c3";
+ pulse;
+ assert rdat = x"d" severity failure;
+
+ raddr <= 3;
+ rnib <= 0;
+ waddr <= 0;
+ wdat <= x"f0";
+ pulse;
+ assert rdat = x"3" severity failure;
+
+ raddr <= 3;
+ rnib <= 1;
+ waddr <= 0;
+ wdat <= x"f0";
+ pulse;
+ assert rdat = x"c" severity failure;
+
+ wait;
+ end process;
+end behav;