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

Back to eFEX documentation
infrastructure_slaves_cntrl.vhd
Go to the documentation of this file.
1 
14 library IEEE;
15 use IEEE.STD_LOGIC_1164.all;
16 library ipbus_lib;
17 use ipbus_lib.ipbus.all;
18 use work.spi.all;
19 library infrastructure_lib;
20 use infrastructure_lib.all;
21 use infrastructure_lib.mgt_type.all;
22 use infrastructure_lib.ipbus_decode_efex_cntrl_infrastructure.all;
25  port(
27  ipb_clk : in std_logic;
29  ipb_rst : in std_logic;
31  ipb_in : in ipb_wbus;
33  ipb_out : out ipb_rbus;
35  status : in std_logic_vector(31 downto 0);
37  control_reg : out std_logic_vector(31 downto 0);
38  ---! reconfigure address
39  reconfig_reg : out std_logic_vector(31 downto 0);
41  scl : out std_logic;
42  sda_o : out std_logic;
43  sda_i : in std_logic;
45  pll_miso : in std_logic;
47  pll_le : out std_logic;
49  pll_clko : out std_logic;
51  pll_mosi : out std_logic;
53  pll_select : out std_logic_vector(1 downto 0);
55  flash_miso : in std_logic;
57  flash_le : out std_logic;
59  flash_clko : out std_logic;
61  flash_mosi : out std_logic;
62  VAUXP, VAUXN : in STD_LOGIC_VECTOR (5 downto 0);
63  Vp, Vn : in std_logic
64 
65  );
66 
70 
71 
72 
73 -- constant sel_width:positive := 4;
74  signal ipbw : ipb_wbus_array(N_SLAVES-1 downto 0);
75  signal ipbr, ipbr_d : ipb_rbus_array(N_SLAVES-1 downto 0);
76  signal ctrl_pulse_reg : std_logic_vector(31 downto 0);
77  signal pll_spi_in, flash_spi_in : spi_mi;
78  signal pll_spi_out, flash_spi_out : spi_mo;
79  signal flash_select : std_logic_vector(1 downto 0) := (others => '0');
80 
81 
82 begin
83 
84 
85 --control_reg <= ctrl_pulse_reg ( 31 downto 0);
86 
87 
88 
89 --- spi pll assignment
90  pll_spi_in.miso <= pll_miso;
91  pll_le <= pll_spi_out.le;
92  pll_mosi <= pll_spi_out.mosi;
93  pll_clko <= pll_spi_out.clk;
94 
95 --- spi flash pin assignment
96  flash_spi_in.miso <= flash_miso;
97  flash_mosi <= flash_spi_out.mosi;
98  flash_le <= flash_spi_out.le;
99  flash_clko <= flash_spi_out.clk;
100 
101 
102 
103 
104  fabric : entity ipbus_lib.ipbus_fabric_sel
105  generic map(NSLV => N_SLAVES,
106  SEL_WIDTH => ipbus_sel_width)
107  port map(
108  ipb_in => ipb_in,
109  ipb_out => ipb_out,
110  sel => ipbus_sel_efex_cntrl_infrastructure(ipb_in.ipb_addr),
111  ipb_to_slaves => ipbw,
112  ipb_from_slaves => ipbr
113  );
114 
115 
116  module_control : entity ipbus_lib.ipbus_ctrlreg_v
117  generic map (
118  N_CTRL => 1, --number of control reg
119  N_STAT => 1) --number of status reg
120  port map (
121  clk => ipb_clk,
122  reset => ipb_rst,
123  ipbus_in => ipbw(N_SLV_MODULE_REG),
124  ipbus_out => ipbr(N_SLV_MODULE_REG),
125  d => (0 => status),
126  q(0) => (control_reg),
127 -- qmask => (others => '0'),
128  stb => open
129  );
130 
131 
132  xadc : entity work.ipbus_xadc_drp -- accessing the xadc of the FPGA
133  generic map (
134  reg48 => X"4f01",
135  reg49 => X"050f" )
136  port map(
137  ipb_clk => ipb_clk,
138  reset => ipb_rst,
139  VAUXP => VAUXP,
140  VAUXN => VAUXN,
141  Vp => Vp,
142  Vn => Vn,
143  ipbus_in => ipbw(N_SLV_XADC),
144  ipbus_out => ipbr(N_SLV_XADC)
145 
146  );
147 
148  reconfig : entity ipbus_lib.ipbus_ctrlreg_v
149  generic map (
150  N_CTRL => 1, --number of control reg
151  N_STAT => 0) --number of status reg
152  port map (
153  clk => ipb_clk,
154  reset => ipb_rst,
155  ipbus_in => ipbw(N_SLV_RECONFIGURE),
156  ipbus_out => ipbr(N_SLV_RECONFIGURE),
157  d => (others =>(others => '0')),
158  ctrl_default(0) => x"00020000",
159  q(0) => (reconfig_reg),
160  stb => open
161  );
162 
163  i2c_0 : entity work.ipbus_i2c_master_arb
164  generic map (addr_width => 4 -- slave that allow to access i2c devices that connect to i2c bus
165  )
166  port map(
167  clk => ipb_clk,
168  rst => ipb_rst,
169  ipb_in => ipbw(N_SLV_I2C),
170  ipb_out => ipbr(N_SLV_I2C),
171  scl => scl,
172  sda_o => sda_o,
173  sda_i => sda_i
174  );
175 
176 
177  spi_pll : entity work.ipbus_spi32 -- Slave that used to configure the PLL and read its status
178  generic map(
179  BYTE_SPI => false,
180  ADDR_WIDTH => 6
181  )
182  port map(
183  ipbus_clk => ipb_clk,
184  reset => ipb_rst,
185  ipb_in => ipbw(N_SLV_PLL_SPI_RAM),
186  ipb_out => ipbr(N_SLV_PLL_SPI_RAM),
187  spi_in => pll_spi_in,
188  spi_out => pll_spi_out,
189  selreg => pll_select
190 
191  );
192 
193  spi_flash : entity work.ipbus_spi32 --access to SPI FLASH for write/read it
194  generic map(
195  BYTE_SPI => true,
196  ADDR_WIDTH => 9
197  )
198  port map(
199  ipbus_clk => ipb_clk,
200  reset => ipb_rst,
201  ipb_in => ipbw(N_SLV_FLASH_SPI_RAM),
202  ipb_out => ipbr(N_SLV_FLASH_SPI_RAM),
203  spi_in => flash_spi_in,
204  spi_out => flash_spi_out,
205  selreg => flash_select
206 
207  );
208 
209  RAM : entity ipbus_lib.ipbus_ram -- internal ram for testing the iPbus transactions.
210  generic map(
211  ADDR_WIDTH => 10
212  )
213  port map(
214  clk => ipb_clk,
215  reset => ipb_rst,
216  ipbus_in => ipbw(N_SLV_RAM),
217  ipbus_out => ipbr(N_SLV_RAM)
218  );
219 
220 end Behavioral;
control fpga infrastructure slaves
out pll_le std_logic
spi pll enable enable
out pll_mosi std_logic
spi pll output signals
in ipb_rst std_logic
IPBus Reset input.
out flash_le std_logic
spi flash enable
out control_reg std_logic_vector( 31 downto 0)
module control signals
in flash_miso std_logic
spi flash input signals
in status std_logic_vector( 31 downto 0)
module status signals
out pll_clko std_logic
spi pll clock
out flash_clko std_logic
spi flash clock
out scl std_logic
i2c bus signals
out ipb_out ipb_rbus
IPBus output bus going from slaves to master.
in pll_miso std_logic
spi pll input signals
out pll_select std_logic_vector( 1 downto 0)
spi pll select
out flash_mosi std_logic
spi flash output signals
in ipb_in ipb_wbus
IPBus input bus going from master to slaves.
ipbus_spi32
Definition: ipbus_spi32.vhd:17
in reset std_logic
reset
Definition: ipbus_spi32.vhd:28
in spi_in spi_mi
spi input signals
Definition: ipbus_spi32.vhd:34
out selreg std_logic_vector( 1 downto 0)
select output
Definition: ipbus_spi32.vhd:39
out ipb_out ipb_rbus
IPBus output bus going from slaves to master.
Definition: ipbus_spi32.vhd:32
out spi_out spi_mo
spi output signals
Definition: ipbus_spi32.vhd:36
in ipb_in ipb_wbus
IPBus input bus going from master to slaves.
Definition: ipbus_spi32.vhd:30
in ipbus_clk std_logic
ipbus clk of 31.25MHz
Definition: ipbus_spi32.vhd:26