-- 8bit LUT FIFO
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
-- pragma translate off
library UNISIM;
use UNISIM.VComponents.all;
-- pragma translate on
entity lut_fifo is
port (
clk: IN std_logic;
areset : in std_logic; -- async reset
sreset : in std_logic; -- sync reset
din: IN std_logic_vector(7 downto 0);
wr_en: IN std_logic;
rd_en: IN std_logic;
dout: OUT std_logic_vector(7 downto 0);
full: OUT std_logic;
empty: OUT std_logic);
end lut_fifo;
architecture RTL of lut_fifo is
component SRL16E
port (
q : out std_logic;
a0 : in std_logic;
a1 : in std_logic;
a2 : in std_logic;
a3 : in std_logic;
ce : in std_logic;
clk : in std_logic;
d : in std_logic
);
END component;
component BUFIO
port(
o : out std_ulogic;
i : in std_ulogic
);
end component;
component BUFR
generic(
BUFR_DIVIDE : string := "BYPASS"
);
port(
o : out std_ulogic;
ce : in std_ulogic;
clr : in std_ulogic;
i : in std_ulogic
);
end component;
signal addr : std_logic_vector(3 downto 0);
signal clk_bufio, clk_bufr : std_logic;
signal logic0, logic1 : std_logic;
begin
logic0 <= '0';
logic1 <= '1';
bufio_inst : bufio port map(
i => clk,
o => clk_bufio
);
bufr_inst : bufr port map(
o => clk_bufr,
ce => logic1,
clr => logic0,
i => clk_bufio
);
DIST_FIFO_GEN : for i in 0 to 7 generate
SRL16E_inst : SRL16E port map(
q => dout(i),
a0 => addr(0),
a1 => addr(1),
a2 => addr(2),
a3 => addr(3),
ce => wr_en,
clk => clk_bufr,
d => din(i)
);
end generate DIST_FIFO_GEN;
empty <= '1' when addr=0 else '0';
full <= '1' when addr=15 else '0';
process(clk_bufr, areset) begin
if areset='1' then
addr <= (others => '0');
elsif clk_bufr'event and clk_bufr='1' then
if sreset='1' then
addr <= (others => '0');
elsif wr_en='1' and rd_en='0' then
addr <= addr + 1;
elsif wr_en='0' and rd_en='1' then
addr <= addr - 1;
end if; -- wr_en='1' and rd_en='1'の時はaddrはそのまま
end if;
end process;
end RTL;
NET "areset" LOC = "D16" ;
#INST "bufio_inst" LOC = "BUFIO_X0Y11" ;
INST "bufr_inst" LOC = "BUFR_X0Y11" ;
NET "clk" LOC = "D18" ;
NET "din<0>" LOC = "B17" ;
NET "din<1>" LOC = "A17" ;
NET "din<2>" LOC = "E17" ;
NET "din<3>" LOC = "F17" ;
NET "din<4>" LOC = "A18" ;
NET "din<5>" LOC = "A19" ;
NET "din<6>" LOC = "C18" ;
NET "din<7>" LOC = "C19" ;
NET "dout<0>" LOC = "D19" ;
NET "dout<1>" LOC = "F18" ;
NET "dout<2>" LOC = "E18" ;
NET "dout<3>" LOC = "B19" ;
NET "dout<4>" LOC = "A20" ;
NET "dout<5>" LOC = "H18" ;
NET "dout<6>" LOC = "J19" ;
NET "dout<7>" LOC = "B20" ;
NET "empty" LOC = "B21" ;
NET "full" LOC = "D20" ;
NET "rd_en" LOC = "C17" ;
NET "sreset" LOC = "H17" ;
NET "wr_en" LOC = "G17" ;
日 | 月 | 火 | 水 | 木 | 金 | 土 |
---|---|---|---|---|---|---|
- | - | - | - | - | 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 | - | - | - | - | - | - |