FIFO
FIFO
Port ( we : in STD_LOGIC;
re : in STD_LOGIC;
rst : in STD_LOGIC;
clk : in STD_LOGIC;
full : out STD_LOGIC;
empty : out STD_LOGIC;
data_out : out STD_LOGIC_VECTOR (7 downto 0));
end fifo;
begin
process( clk,rst)
begin
if rst='1' then
clkout<='0';
count <=0;
elsif(clk' event and clk='1') then
if(count = 49999999) then
clkout <= not clkout;
count <= 0;
else
count <= count+1;
end if;
end if;
end process;
process(clkout, rst)
begin
if(clkout' event and clkout='1')then
if rst = '1' then
for i in 0 to 7 loop
memory(i) <= "00000000";
end loop;
empty <= '1';
full <= '0';
wptr <= 0;
rptr <= 0;
elsif (we ='1') then
rptr <= 0;
memory(wptr) <= data(wptr);
empty <= '0';
if(wptr = 7) then
wptr <= 0;
full <= '1';
else
wptr <= wptr + 1;
end if;
elsif (re ='1') then
Test Bench
entity fifo_test is
-- Port ( );
end fifo_test;
wait;
end process;
end Behavioral;