otsdaq_prepmodernization  v2_05_02_indev
FIFO_SIM.vhd
1 ----------------------------------------------------------------------------------
2 -- Company: Fermilab
3 -- Engineer: Collin Bradford
4 --
5 -- Create Date: 14:19:52 07/06/2016
6 -- Design Name:
7 -- Module Name: FIFO_SIM - 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 use IEEE.STD_LOGIC_ARITH.ALL;
23 use IEEE.STD_LOGIC_UNSIGNED.ALL;
24 
25 entity FIFO_SIM is
26  Port ( rst : in STD_LOGIC;
27  clk : in STD_LOGIC;
28  full : in STD_LOGIC;
29  data_out : out STD_LOGIC_VECTOR (31 downto 0);
30  wr_en : out STD_LOGIC;
31  FIFO_RESET : out std_logic;
32  threshold : out std_logic_vector(7 downto 0));
33 end FIFO_SIM;
34 --FIFO reset is simply disabled and not needed. We are pushing data here. If we lose some, we can't get it back anyway.
35 architecture Behavioral of FIFO_SIM is
36  signal counter : std_logic_vector(31 downto 0);
37 begin
38  threshold <= "11000000";
39  data_out <= counter;
40  process(rst, clk, full) begin
41  if(rst = '0') then
42  if(rising_edge(clk)) then
43  if(full = '0') then
44  FIFO_RESET <= '0';
45  counter <= counter + 1;
46  wr_en <= '1';
47  else
48  wr_en <= '0';
49  FIFO_RESET <= '0';
50  end if;
51  end if;
52  else --reset code here.
53  counter <= (others => '0');
54  FIFO_RESET <= '0';
55  end if;
56  end process;
57 
58 end Behavioral;
59