AMC13
Firmwares for the different applications of the AMC13 uTCA board made at Boston University
 All Classes Files Variables
FIFO66x2048.vhd
1 ----------------------------------------------------------------------------------
2 -- Company:
3 -- Engineer:
4 --
5 -- Create Date: 10:01:22 10/08/2013
6 -- Design Name:
7 -- Module Name: FIFO72x8192 - Behavioral
8 -- Project Name:
9 -- Target Devices:
10 -- Tool versions:
11 -- Description:
12 --
13 -- Dependencies:
14 --
15 -- Revision:
16 -- Revision 0.01 - File Created
17 -- Additional Comments:
18 --
19 ----------------------------------------------------------------------------------
20 library IEEE;
21 use IEEE.STD_LOGIC_1164.ALL;
22 
23 -- Uncomment the following library declaration if using
24 -- arithmetic functions with Signed or Unsigned values
25 --use IEEE.NUMERIC_STD.ALL;
26 
27 -- Uncomment the following library declaration if instantiating
28 -- any Xilinx primitives in this code.
29 library UNISIM;
30 use UNISIM.VComponents.all;
31 Library UNIMACRO;
32 use UNIMACRO.vcomponents.all;
33 
34 entity FIFO66x2048 is
35  generic(ALMOSTFULL_OFFSET : bit_vector(15 downto 0) := x"0080";ALMOSTEMPTY_OFFSET : bit_vector(15 downto 0) := x"0080");
36  Port ( wclk : in STD_LOGIC;
37  rclk : in STD_LOGIC;
38  fifo_rst : in STD_LOGIC;
39  fifo_en : in STD_LOGIC;
40  di : in STD_LOGIC_VECTOR (65 downto 0);
41  we : in STD_LOGIC;
42  re : in STD_LOGIC;
43  do : out STD_LOGIC_VECTOR (65 downto 0);
44  full : out STD_LOGIC;
45  empty : out STD_LOGIC;
46  data_avl : out STD_LOGIC);
47 end FIFO66x2048;
48 
49 architecture Behavioral of FIFO66x2048 is
50 signal fifo_re : std_logic := '0';
51 signal fifo_we : std_logic := '0';
52 signal wait_time : std_logic_vector(3 downto 0) := (others => '0');
53 signal dip : std_logic_vector(71 downto 0) := (others => '0');
54 signal dop : std_logic_vector(71 downto 0) := (others => '0');
55 signal fifo_empty : std_logic_vector(7 downto 0) := (others => '0');
56 signal fifo_Almostempty : std_logic_vector(7 downto 0) := (others => '0');
57 signal fifo_full : std_logic_vector(7 downto 0) := (others => '0');
58 type array8X12 is array (0 to 7) of std_logic_vector(11 downto 0);
59 signal rdcount : array8X12 := (others => (others => '0'));
60 signal wrcount : array8X12 := (others => (others => '0'));
61 
62 begin
63 dip(65 downto 0) <= di;
64 do <= dop(65 downto 0);
65 g_FIFO: for i in 0 to 7 generate
66  i_FIFO : FIFO_DUALCLOCK_MACRO
67  generic map (
68  DEVICE => "7SERIES", -- Target Device: "VIRTEX5", "VIRTEX6", "7SERIES"
69  ALMOST_FULL_OFFSET => ALMOSTFULL_OFFSET , -- Sets almost full threshold
70  ALMOST_EMPTY_OFFSET => ALMOSTEMPTY_OFFSET, -- Sets the almost empty threshold
71  DATA_WIDTH => 9, -- Valid values are 1-72 (37-72 only valid when FIFO_SIZE="36Kb")
72  FIFO_SIZE => "36Kb", -- Target BRAM, "18Kb" or "36Kb"
73  FIRST_WORD_FALL_THROUGH => TRUE) -- Sets the FIFO FWFT to TRUE or FALSE
74  port map (
75  ALMOSTEMPTY => fifo_Almostempty(i), -- 1-bit output almost empty
76  ALMOSTFULL => FIFO_full(i), -- 1-bit output almost full
77  DO => dop(i*9+8 downto i*9), -- Output data, width defined by DATA_WIDTH parameter
78  EMPTY => fifo_empty(i), -- 1-bit output empty
79  FULL => open, -- 1-bit output full
80  RDCOUNT => rdcount(i), -- Output read count, width determined by FIFO depth
81  RDERR => open, -- 1-bit output read error
82  WRCOUNT => wrcount(i), -- Output write count, width determined by FIFO depth
83  WRERR => open, -- 1-bit output write error
84  DI => dip(i*9+8 downto i*9), -- Input data, width defined by DATA_WIDTH parameter
85  RDCLK => rclk, -- 1-bit input read clock
86  RDEN => FIFO_re, -- 1-bit input read enable
87  RST => fifo_rst, -- 1-bit input reset
88  WRCLK => wclk, -- 1-bit input write clock
89  WREN => FIFO_we -- 1-bit input write enable
90  );
91 end generate;
92 FIFO_we <= FIFO_en and we;
93 FIFO_re <= FIFO_en and re;
94 full <= FIFO_full(0);
95 empty <= '0' when FIFO_empty = x"00" else '1';
96 data_avl <= not fifo_Almostempty(0);
97 --process(rclk)
98 --begin
99 -- if(rclk'event and rclk = '1')then
100 -- if(FIFO_empty(0) = '1' or wait_time(3) = '1')then
101 -- data_avl <= '0';
102 -- else
103 -- data_avl <= '1';
104 -- end if;
105 -- if(fifo_Almostempty(0) = '1' and wait_time(3) = '0')then
106 -- wait_time <= "1111";
107 -- else
108 -- wait_time <= wait_time(2 downto 0) & '0';
109 -- end if;
110 -- end if;
111 --end process;
112 --data_avl <= not FIFO_empty(0);
113 end Behavioral;
114