eFEX firmware  1.7.3
ATLAS l1-calo - electron and tau feature extraction firmware for eFEX boards

Back to eFEX documentation
packet_fifo_block.vhd
Go to the documentation of this file.
1 
9 
11 LIBRARY ieee;
12 USE ieee.std_logic_1164.all;
13 use ieee.numeric_std.all;
14 
17  GENERIC(
18  RAM_ADDR_WIDTH : positive := 12;
19  MAX_PACKET_WIDTH : positive := 8
20  );
21  port (
22  clk_320 : in std_logic;
23  rst_320 : in std_logic;
24 --
25  fifo_data : in std_logic_vector (63 DOWNTO 0);
26  fifo_valid : in std_logic;
27  fifo_last : in std_logic;
28 --
29  packet_data : OUT std_logic_vector (63 DOWNTO 0);
30  packet_valid : OUT std_logic;
31  packet_last : OUT std_logic;
32  packet_ready : IN std_logic;
33 --
34  fifo_fill_level : out std_logic_vector(15 downto 0);
35  packet_count : out STD_LOGIC_VECTOR(15 downto 0);
36  fifo_empty : OUT std_logic;
37  input_error : OUT std_logic;
38  fifo_error : OUT std_logic
39  );
40 END ENTITY packet_fifo_block;
41 
43 Architecture rtl of packet_fifo_block is
44 
45 Component packet_ram_fifo is
46  Generic (
47  DATA_WIDTH: positive := 64;
48  constant BUFWIDTH: positive := 10;
49  constant MAXWIDTH: positive := 5
50  );
51  Port (
52  clk : in STD_LOGIC;
53  rst_clk : in STD_LOGIC;
54  in_data : in STD_LOGIC_VECTOR(DATA_WIDTH-1 downto 0);
55  in_valid : in STD_LOGIC;
56  in_last : in STD_LOGIC;
57  out_pause : in STD_LOGIC;
58  out_data : out STD_LOGIC_VECTOR(DATA_WIDTH-1 downto 0);
59  out_valid : out STD_LOGIC;
60  out_last : out STD_LOGIC;
61  fifo_fill_level : out STD_LOGIC_VECTOR(15 downto 0);
62  packet_count : out STD_LOGIC_VECTOR(15 downto 0);
63  in_error : out STD_LOGIC;
64  out_error : out STD_LOGIC
65  );
66 end Component packet_ram_fifo;
67 
68 Component packet_fifo is
69  Generic (
70  DATA_WIDTH: positive := 64;
71  constant BUFWIDTH: positive := 4
72  );
73  Port (
74  clk : in STD_LOGIC;
75  rst_clk : in STD_LOGIC;
76  in_data : in STD_LOGIC_VECTOR(DATA_WIDTH-1 downto 0);
77  in_valid : in STD_LOGIC;
78  in_last : in STD_LOGIC;
79  in_pause : out STD_LOGIC;
80  out_ready : in STD_LOGIC;
81  out_data : out STD_LOGIC_VECTOR(DATA_WIDTH-1 downto 0);
82  out_valid : out STD_LOGIC;
83  out_last : out STD_LOGIC;
84  out_error : out STD_LOGIC
85  );
86 end Component packet_fifo;
87 
88 SIGNAL data_fifo_data : STD_LOGIC_VECTOR(63 DOWNTO 0);
89 signal fifo_fill_level_i : std_logic_vector(15 downto 0);
90 SIGNAL data_fifo_pause, data_fifo_valid, data_fifo_last, data_fifo_error, ram_fifo_error, local_reset : STD_LOGIC;
91 
92 Begin
93 
94  data_ram_fifo : packet_ram_fifo
95  Generic map (
96  DATA_WIDTH => 64,
97  BUFWIDTH => RAM_ADDR_WIDTH,
98  MAXWIDTH => MAX_PACKET_WIDTH
99  )
100  Port map (
101  clk => clk_320,
102  rst_clk => local_reset,
103  in_data => fifo_data,
104  in_valid => fifo_valid,
105  in_last => fifo_last,
106  out_pause => data_fifo_pause,
107  out_data => data_fifo_data,
108  out_valid => data_fifo_valid,
109  out_last => data_fifo_last,
110  fifo_fill_level => fifo_fill_level_i,
111  packet_count => packet_count,
112  in_error => input_error,
113  out_error => ram_fifo_error
114  );
115 
116  data_fifo : packet_fifo
117  Generic map (
118  DATA_WIDTH => 64,
119  BUFWIDTH => 4
120  )
121  Port map (
122  clk => clk_320,
123  rst_clk => local_reset,
124  in_data => data_fifo_data,
125  in_valid => data_fifo_valid,
126  in_last => data_fifo_last,
127  in_pause => data_fifo_pause,
128  out_ready => packet_ready,
129  out_data => packet_data,
130  out_valid => packet_valid,
131  out_last => packet_last,
132  out_error => data_fifo_error
133  );
134 
135 local_reset_block: process(clk_320)
136  Variable stretch: std_logic_vector(7 downto 0) := (Others => '1');
137  begin
138 -- Reset on incoming rst_320 or error out of either FIFO
139  if rising_edge(clk_320) then
140  if (ram_fifo_error = '1') or (data_fifo_error = '1') or (rst_320 = '1') then
141  stretch := (Others => '1');
142  else
143  stretch := stretch(6 downto 0) & "0";
144  end if;
145  local_reset <= stretch(7)
146 -- pragma translate_off
147  after 2 ns
148 -- pragma translate_on
149  ;
150  end if;
151  end process local_reset_block;
152 
153 fifo_empty_block: process(clk_320)
154  begin
155  if rising_edge(clk_320) then
156  if (unsigned(fifo_fill_level_i) = 0) then
157  fifo_empty <= '1'
158 -- pragma translate_off
159  after 2 ns
160 -- pragma translate_on
161  ;
162  else
163  fifo_empty <= '0'
164 -- pragma translate_off
165  after 2 ns
166 -- pragma translate_on
167  ;
168  end if;
169  end if;
170  end process fifo_empty_block;
171 
172 fifo_error <= ram_fifo_error or data_fifo_error;
173 fifo_fill_level <= fifo_fill_level_i;
174 
175 END Architecture rtl;
Instantiate a Block RAM storage and Distributed RAM AXI interface block...
Instantiate a Block RAM storage and Distributed RAM AXI interface block...
Optimised RAM-based single clock packet FIFO.
Definition: packet_fifo.vhd:14
out out_data STD_LOGIC_VECTOR( DATA_WIDTH- 1 downto 0)
AXI stream output.
Definition: packet_fifo.vhd:37
in in_data STD_LOGIC_VECTOR( DATA_WIDTH- 1 downto 0)
AXI stream input.
Definition: packet_fifo.vhd:27
out in_pause STD_LOGIC
AXI stream input pause request.
Definition: packet_fifo.vhd:33
out out_error STD_LOGIC
AXI stream output error (asserted on last)
Definition: packet_fifo.vhd:44
in rst_clk STD_LOGIC
Synchronous reset.
Definition: packet_fifo.vhd:25
in clk STD_LOGIC
Clock.
Definition: packet_fifo.vhd:23
DATA_WIDTH positive := 64
Width of data for RAM.
Definition: packet_fifo.vhd:17
out out_valid STD_LOGIC
AXI stream output valid.
Definition: packet_fifo.vhd:39
in in_last STD_LOGIC
AXI stream input last.
Definition: packet_fifo.vhd:31
in in_valid STD_LOGIC
AXI stream input valid.
Definition: packet_fifo.vhd:29
in out_ready STD_LOGIC
AXI stream output ready.
Definition: packet_fifo.vhd:35
out out_last STD_LOGIC
AXI stream output last.
Definition: packet_fifo.vhd:41
BUFWIDTH positive := 4
Width of address bus for buffer, i.e. array (0 to 2**BUFWIDTH - 1)
Definition: packet_fifo.vhd:20
Optimised RAM-based single clock packet FIFO.
out out_data STD_LOGIC_VECTOR( DATA_WIDTH- 1 downto 0)
AXI stream output.
in in_data STD_LOGIC_VECTOR( DATA_WIDTH- 1 downto 0)
AXI stream input.
MAXWIDTH positive := 5
Parameter for maximum packet size (2**MAXWIDTH - 1) on input or output before trigger reset mechanism...
out out_error STD_LOGIC
AXI stream output error (asserted on last)
in rst_clk STD_LOGIC
Synchronous reset.
out packet_count STD_LOGIC_VECTOR( 15 downto 0)
Number of packets stored in the FIFO.
in clk STD_LOGIC
Clock.
DATA_WIDTH positive := 64
Width of data for RAM.
in out_pause STD_LOGIC
AXI stream output pause request.
out out_valid STD_LOGIC
AXI stream output valid.
in in_last STD_LOGIC
AXI stream input last.
in in_valid STD_LOGIC
AXI stream input valid.
out fifo_fill_level STD_LOGIC_VECTOR( 15 downto 0)
Number of words stored in the FIFO.
BUFWIDTH positive := 10
Width of address bus for RAM, i.e. array (0 to 2**BUFWIDTH - 1)
out out_last STD_LOGIC
AXI stream output last.
out in_error STD_LOGIC
AXI stream input error.