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

Back to eFEX documentation
fifo_selector.vhd
Go to the documentation of this file.
1 
8 
10 LIBRARY ieee;
11 USE ieee.std_logic_1164.all;
12 use ieee.numeric_std.all;
13 
14 
16 ENTITY fifo_selector IS
17  port (
18  clk_320 : in std_logic;
19 -- FIFO data from MGT block
20  fifo_data : in std_logic_vector (63 DOWNTO 0);
21  fifo_valid : in std_logic;
22  fifo_last : in std_logic;
23 -- data to FIFO A
24  fifo_data_A : out std_logic_vector (63 DOWNTO 0);
25  fifo_valid_A : out std_logic;
26  fifo_last_A : out std_logic;
27 -- data to FIFO B
28  fifo_data_B : out std_logic_vector (63 DOWNTO 0);
29  fifo_valid_B : out std_logic;
30  fifo_last_B : out std_logic;
31 -- switch control
32  destination_enable : in std_logic_vector(1 downto 0) := (Others => '0')
33  );
34 END ENTITY fifo_selector;
35 
37 Architecture rtl of fifo_selector is
38 
39  Signal destination_selected: std_logic_vector(1 downto 0) := (Others => '0');
40  Signal fifo_valid_buf, fifo_last_buf: std_logic;
41  Signal fifo_data_buf: std_logic_vector (63 DOWNTO 0);
42 
43 Begin
44 
45 buffer_block: process(clk_320)
46  Begin
47  if rising_edge(clk_320) then
48  fifo_valid_buf <= fifo_valid
49 -- pragma translate_off
50  after 2 ns
51 -- pragma translate_on
52  ;
53  fifo_last_buf <= fifo_last
54 -- pragma translate_off
55  after 2 ns
56 -- pragma translate_on
57  ;
58  fifo_data_buf <= fifo_data
59 -- pragma translate_off
60  after 2 ns
61 -- pragma translate_on
62  ;
63  end if;
64  End process buffer_block;
65 
66 tob_fifo_select: process(clk_320)
67  Variable active: std_logic := '0';
68  Begin
69  if rising_edge(clk_320) then
70  if (fifo_valid_buf = '1') and (fifo_last_buf = '1') then
71  active := '0';
72  elsif (fifo_valid = '1') and (active = '0') then
73  active := '1';
74  if (destination_enable = "11") then
75 -- Ping pong!
76  destination_selected <= (not fifo_data(32)) & fifo_data(32)
77 -- pragma translate_off
78  after 2 ns
79 -- pragma translate_on
80  ;
81  else
82  destination_selected <= destination_enable
83 -- pragma translate_off
84  after 2 ns
85 -- pragma translate_on
86  ;
87  end if;
88  elsif (active = '0') then
89  destination_selected <= (Others => '0')
90 -- pragma translate_off
91  after 2 ns
92 -- pragma translate_on
93  ;
94  end if;
95  end if;
96  End process tob_fifo_select;
97 
98 transmit_block : process(clk_320)
99  Begin
100  if rising_edge(clk_320) then
101  fifo_data_A <= fifo_data_buf
102 -- pragma translate_off
103  after 2 ns
104 -- pragma translate_on
105  ;
106  fifo_data_B <= fifo_data_buf
107 -- pragma translate_off
108  after 2 ns
109 -- pragma translate_on
110  ;
111  fifo_valid_A <= fifo_valid_buf and destination_selected(0)
112 -- pragma translate_off
113  after 2 ns
114 -- pragma translate_on
115  ;
116  fifo_valid_B <= fifo_valid_buf and destination_selected(1)
117 -- pragma translate_off
118  after 2 ns
119 -- pragma translate_on
120  ;
121  fifo_last_A <= fifo_last_buf and destination_selected(0)
122 -- pragma translate_off
123  after 2 ns
124 -- pragma translate_on
125  ;
126  fifo_last_B <= fifo_last_buf and destination_selected(1)
127 -- pragma translate_off
128  after 2 ns
129 -- pragma translate_on
130  ;
131  end if;
132  End process transmit_block;
133 
134 END Architecture rtl;
Switch FIFO data to correct stream depending on destination_enable...
Switch FIFO data to correct stream depending on destination_enable...