Fifo 1
Fifo 1
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity fifo is
Generic(bits : Integer := 8;
words:Integer :=16);
Port ( data_in : in std_logic_vector(7 downto 0);
data_out : out std_logic_vector(7 downto 0);
clk : in std_logic;
wr_en : in std_logic;
read_en : in std_logic;
error : out std_logic;
flag: out std_logic_vector(1 downto 0));
-- flag= "00" -> Empty
-- "11" -> Full
-- "01","10" -> Partial full
end fifo;
begin
process(clk,wr_en,read_en)
begin
if(clk='1' and clk'event) then
if((wr_en and read_en) = '1') then
error<='1';
elsif(wr_en ='1') then
if(temp1<=15) then
temp1:=temp1+1;
mem(temp1)<= data_in;
end if;
elsif(read_en ='1') then
if(temp1>=1) then
data_out<= mem(temp1);
temp1:=temp1-1;
end if;
end if;
end if;
end process;
end Behavioral;
RTL Schematic:-
Clock Information:
-----------------------------------+------------------------+-------+
Clock Signal | Clock buffer(FF name) | Load |
-----------------------------------+------------------------+-------+
clk | BUFGP | 148 |
-----------------------------------+------------------------+-------+
Timing Summary:-
Speed Grade: -6
Timing Detail:-
--------------
All values displayed in nanoseconds (ns)
-------------------------------------------------------------------------
Timing constraint: Default period analysis for Clock 'clk'
Delay: 3.281ns (Levels of Logic = 4)
Source: temp1_0 (FF)
Destination: data_out_0 (FF)
Source Clock: clk rising
Destination Clock: clk rising
------------------------------------------------------------------------------------------
Timing constraint: Default OFFSET IN BEFORE for Clock 'clk'
Offset: 3.484ns (Levels of Logic = 3)
Source: read_en (PAD)
Destination: mem_4_1 (FF)
Destination Clock: clk rising
--------------------------------------------------------------------------------------
Timing constraint: Default OFFSET OUT AFTER for Clock 'clk'
Offset: 5.814ns (Levels of Logic = 2)
Source: temp1_0 (FF)
Destination: flag<0> (PAD)
Source Clock: clk rising