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

Back to eFEX documentation
mgt_playback_ram_wrapper.vhd
Go to the documentation of this file.
1 
8 
9 library IEEE;
10 use IEEE.STD_LOGIC_1164.all;
11 use ieee.numeric_std.all;
12 
13 library ipbus_lib;
14 use ipbus_lib.ipbus.all;
15 
16 
19  generic (DISABLE : std_logic := '0');
20  port(
22  clk_ipb : in std_logic;
24  rst : in std_logic;
26  ipb_in : in ipb_wbus;
28  ipb_out : out ipb_rbus;
30  rdy : in std_logic;
32  bcr : in std_logic;
34  ttc_clk : in std_logic; -- mgt rx clock of 40 MHz
36  din : in std_logic_vector(31 downto 0);
38  we : in std_logic := '0';
40  q : out std_logic_vector(227 downto 0)
41 
42  );
43 
45 
47 architecture rtl of mgt_playback_ram_wrapper is
48 
49  component mgt_playback_ram
50  port (
51  clka : in std_logic;
52  ena : in std_logic;
53  wea : in std_logic_vector(0 downto 0);
54  addra : in std_logic_vector(6 downto 0);
55  dina : in std_logic_vector(31 downto 0);
56  douta : out std_logic_vector(31 downto 0);
57  clkb : in std_logic;
58  enb : in std_logic;
59  web : in std_logic_vector(0 downto 0);
60  addrb : in std_logic_vector(3 downto 0);
61  dinb : in std_logic_vector(255 downto 0);
62  doutb : out std_logic_vector(255 downto 0)
63  );
64  end component;
65 
66  --ipbus signals
67  signal ack, ack2 ,kchar_i : std_logic;
68  signal enb : std_logic;
69  signal addr : std_logic_vector(3 downto 0);
70  signal ipbus_write : std_logic_vector(0 downto 0);
71  signal write_enable : std_logic_vector(0 downto 0);
72 
73  --signal for disabling the RAM
74  signal ipb_out_int : std_logic_vector(31 downto 0);
75  signal q_int : std_logic_vector(255 downto 0);
76 
77 
78 begin
79  IPBUS_RAM : process(clk_ipb)
80  begin
81  if rising_edge(clk_ipb) then
82  if ipb_in.ipb_strobe = '1' and ipb_in.ipb_write = '1' then
83  ipbus_write(0) <= '1';
84  else
85  ipbus_write(0) <= '0';
86  end if;
87  ack2 <= ipb_in.ipb_strobe and (not ack2) and (not ack);
88  ack <= ack2;
89 
90  end if;
91 end process;
92 
93  ipb_out.ipb_ack <= ack;
94  ipb_out.ipb_err <= '0';
95  write_enable(0) <= we;
96 
97  PLAYBACK_RAM : mgt_playback_ram
98  port map (
99  clka => clk_ipb,
100  ena => ipb_in.ipb_strobe,
101  wea => ipbus_write,
102  addra => ipb_in.ipb_addr(6 downto 0),
103  dina => ipb_in.ipb_wdata,
104  douta => ipb_out_int, --ipb_out.ipb_rdata,
105  clkb => ttc_clk,
106  enb => enb,
107  web => (others => '0'), -- was write_enable,
108  addrb => addr,
109  dinb => (others => '0'), -- was din,
110  doutb => q_int
111  );
112 
113  q <= q_int(227 downto 0) when DISABLE = '0' else (others => '0');
114  ipb_out.ipb_rdata <= ipb_out_int when DISABLE = '0' else x"d15ab1ed";
115 
116 
117 
118 sm_playback: ENTITY work.ctrl_playback_ram
119  port map(
120  clk => ttc_clk,
121  rdy => rdy,
122  reset => rst,
123  bcr => bcr,
124  addr => addr,
125  en => enb
126 
127  );
128 
129 
130 
131 end rtl;
control State machine of playback ram
in reset std_logic
reset
in clk std_logic
rx clock of 40 Mhz
out en std_logic
ram enable
in bcr std_logic
bcr in
out addr std_logic_vector( 3 DOWNTO 0)
ram address for read side
in rdy std_logic
ready
Wrapper for the input spy/playback RAM of the MGT.
Wrapper for the input spy/playback RAM of the MGT.
in ttc_clk std_logic
ttc clock of 40 MHz
out ipb_out ipb_rbus
ipbus data out
in we std_logic := '0'
write en
in din std_logic_vector( 31 downto 0)
data in
in ipb_in ipb_wbus
ipbus data in
in clk_ipb std_logic
ipbus clock
out q std_logic_vector( 227 downto 0)
data out