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

Back to eFEX documentation
ipbus_inputRAM.vhd
Go to the documentation of this file.
1 
76 
78 library IEEE;
79 use IEEE.STD_LOGIC_1164.all;
80 use ieee.numeric_std.all;
82 library ipbus_lib;
83 
85 use ipbus_lib.ipbus.all;
87 use work.DataTypes.all;
89 use work.AlgoDataTypes.all;
90 library infrastructure_lib;
91 use infrastructure_lib.EfexDataFormats.all;
92 
94 entity ipbus_inputRAM is
95  port(
96  clk_ipb : in std_logic;
97  rst : in std_logic;
98  ipb_in : in ipb_wbus;
99  ipb_out : out ipb_rbus;
100 
101  rclk : in std_logic;
102  Load : in std_logic;
103  BCNIn : in std_logic_vector(11 downto 0);
104  AlgoIn : in AlgoInput;
105  we : in std_logic := '0';
106  AlgoOut : out AlgoInput;
107  BCNOut : out std_logic_vector(11 downto 0)
108  );
109 
110 end ipbus_inputRAM;
111 
113 architecture rtl of ipbus_inputRAM is
114 
115 -- algorithm signals
116  signal q : std_logic_vector(128*60-1 downto 0);
117  signal din : std_logic_vector(128*60-1 downto 0);
118  signal counter : std_logic_vector(3 downto 0) := "0000"; --16 BCs
119  signal L1, L2, L3 : std_logic := '0';
120 
121 -- fabric decode signals
122  constant BLOCK_WIDTH : integer := 6; --log2 of the memory address
123  signal ipbw : ipb_wbus_array((INPUT_TOWERS - 1) downto 0);
124  signal ipbr : ipb_rbus_array((INPUT_TOWERS - 1) downto 0);
125 
126 -- function disable_ram(i : integer) return std_logic is --only enable RAM for central towers
127 -- begin
128 -- if (i >= 12 and i <= 17) or
129 -- (i >= 22 and i <= 27) or
130 -- (i >= 32 and i <= 37) or
131 -- (i >= 42 and i <= 47) then
132 -- return '0';
133 -- else
134 -- return '1';
135 -- end if;
136 -- end function;
137 
138 
139 begin
140 
141  fabric_decode : entity ipbus_lib.ipbus_fabric_branch
142  generic map(
143  NSLV => INPUT_TOWERS,
144  DECODE_BASE => BLOCK_WIDTH
145  )
146  port map(
147  ipb_in => ipb_in,
148  ipb_out => ipb_out,
149  ipb_to_slaves => ipbw,
150  ipb_from_slaves => ipbr
151  );
152 
154  COUNTER_PROC : process(rclk)
155  begin
156  if rising_edge(rclk) then
157  L3 <= L2; -- to compensate RAM read latency should be set (at least) 2 clock cycles before Load
158  L2 <= L1; -- so we delay by 3,
159  L1 <= Load;
160  if L2 = '1' then
161  counter <= std_logic_vector(unsigned(counter) + 1);
162  else
163  counter <= counter;
164  end if;
165  --d_counter <= counter;
166  end if;
167  end process;
168 
169 
170  RAM_FOR : for i in 0 to INPUT_TOWERS-1 generate
171  ALGO_INPUT_RAM_WRAPPER : entity work.ipbus_inputRAM_wrapper
172  -- generic map(DISABLE => disable_ram(i))
173  port map (
174  clk_ipb => clk_ipb,
175  rst => rst,
176  ipb_in => ipbw(i),
177  ipb_out => ipbr(i),
178 
179  rclk => rclk,
180  din => din((127+128*i) downto 128*i),
181  we => we and Load , --this should be synchronous with input data
182  q => q((127+128*i) downto 128*i),
183  addr => counter);
184  end generate;
185 
186  -- Conversion between algorithm data-types and std_logic_vectors
187  din <= to_LogicVector(AlgoIn, BCNIn);
188  AlgoOut <= to_AlgoInput(q);
189  BCNOut <= to_BCN(q);
190 end rtl;
External data-types and functions.
( INPUT_COLUMNS- 1 downto 0) AlgoColumn AlgoInput
Algorithm INPUT port.
eFEX data-types and functions
Input spy/playback RAM for Algorithm block.
Wrapper for the input spy/playback RAM.
Input spy/playback RAM for Algorithm block.