library IEEE;
use IEEE.Std_logic_1164.all;
use IEEE.Numeric_std.all;
entity Ram_TB is
end entity Ram_TB;
architecture Bench of Ram_TB is
signal Address :Std_logic_vector(9 downto 0);
signal DataIn, DataOut :Std_logic_vector(15 downto 0);
signal WE : Std_logic;
signal clock : Std_logic;
signal StopClock : boolean := FALSE;
component sync_ram is
port (
clock : in std_logic;
we : in std_logic;
address : in std_logic_vector;
datain : in std_logic_vector;
dataout : out std_logic_vector
);
end component;
begin
UUT: entity work.sync_ram(RTL)
port map (
clock => clock,
we => WE,
address => Address,
datain => DataIn,
DataOut => DataOut
);
ClockGen: process is
begin
while not StopClock loop
clock <= '0';
wait for 5 ns;
clock <= '1';
wait for 5 ns;
end loop;
wait;
end process ClockGen;
Stim: process is
begin
wait until rising_edge(clock); -- cycle 1
datain <= "0111111100000001";
address <= "0000000001";
we <= '0';
wait until rising_edge(clock); -- cycle 2
we <= '1';
datain <= "0000010011000011";
wait until rising_edge(clock); -- cycle 3
datain <= "0000011100110001";
address <= "0000000010";
wait until rising_edge(clock); -- cycle 4
we <= '0';
wait until rising_edge(clock); -- cycle 5
address <= "0000000001";
wait until rising_edge(clock); -- cycle 6
address <= "0000000010";
wait until rising_edge(clock); -- cycle 7
wait until rising_edge(clock); -- cycle 8
StopClock <= true;
wait;
end process;
end architecture Bench;