ENTITY nrzi_tb IS
END nrzi_tb;
ARCHITECTURE behavior OF nrzi_tb IS
-- Component Declaration for the Unit Under Test (UUT)
COMPONENT top_nrzi
PORT(
clk : IN std_logic;
d_in : IN std_logic;
q_out : OUT std_logic
);
END COMPONENT;
constant flag : std_logic_vector(7 downto 0):=x"7E";
constant data : std_logic_vector(33 downto 0):="10010111" & "10100011" & "10111110" & "11111011" & "01";
--Inputs
signal clk : std_logic := '0';
signal d_in : std_logic := '0';
--Outputs
signal q_out : std_logic;
-- Clock period definitions
constant clk_period : time := 2.5 ms;
BEGIN
-- Instantiate the Unit Under Test (UUT)
uut: top_nrzi PORT MAP (
clk => clk,
d_in => d_in,
q_out => q_out
);
-- Clock process definitions
clk_process :process
begin
clk <= '1';
wait for clk_period/2;
clk <= '0';
wait for clk_period/2;
end process;
-- Stimulus process
stim_proc: process
begin
-- hold reset state for 100 ns.
--wait for 1 ms;
wait for CLK_period*5;
for i in 0 to 7 loop
d_in <= flag(i); wait for CLK_period;
end loop;
for i in 0 to 7 loop
d_in <= flag(i); wait for CLK_period;
end loop;
-----------------------------
for i in 0 to 33 loop
d_in <= data(i); wait for CLK_period;
end loop;
-----------------------------
for i in 0 to 7 loop
d_in <= flag(i); wait for CLK_period;
end loop;
for i in 0 to 7 loop
d_in <= flag(i); wait for CLK_period;
end loop;
wait for clk_period*10;
-- insert stimulus here
wait;
end process;
END;