CMX
CMX firmware code in-line documentation
 All Classes Namespaces Files Functions Variables
sys_monitor.vhd
Go to the documentation of this file.
1 ----------------------------------------------------------------------------------
7 ----------------------------------------------------------------------------------
8 library IEEE;
9 use IEEE.STD_LOGIC_1164.ALL;
10 use IEEE.STD_LOGIC_ARITH.ALL;
11 use IEEE.STD_LOGIC_UNSIGNED.ALL;
12 library UNISIM;
13 use UNISIM.VComponents.all;
14 
15 library work;
16 use work.CMXpackage.all;
17 use work.CMX_VME_defs.all;
18 
19 
20 entity sys_monitor is
21  GENERIC(
22  ADDR_REG_RO_SYSMON_DATA_BLOCK : integer := 16#1364#
23 
24  );
25  Port (
26  -- Clock
27  clk : in std_logic;
28  BF_SYSMON_01_P : in STD_LOGIC; -- Auxiliary Channel 1
29  BF_SYSMON_01_N : in STD_LOGIC;
30  BF_SYSMON_03_P : in STD_LOGIC; -- Auxiliary Channel 3
31  BF_SYSMON_03_N : in STD_LOGIC;
32  BF_SYSMON_04_P : in STD_LOGIC; -- Auxiliary Channel 4
33  BF_SYSMON_04_N : in STD_LOGIC;
34  BF_SYSMON_07_P : in STD_LOGIC; -- Auxiliary Channel 7
35  BF_SYSMON_07_N : in STD_LOGIC;
36  BF_SYSMON_08_P : in STD_LOGIC; -- Auxiliary Channel 8
37  BF_SYSMON_08_N : in STD_LOGIC;
38  BF_SYSMON_09_P : in STD_LOGIC; -- Auxiliary Channel 9
39  BF_SYSMON_09_N : in STD_LOGIC;
40  BF_SYSMON_10_P : in STD_LOGIC; -- Auxiliary Channel 10
41  BF_SYSMON_10_N : in STD_LOGIC;
42  BF_SYSMON_11_P : in STD_LOGIC; -- Auxiliary Channel 11
43  BF_SYSMON_11_N : in STD_LOGIC;
44  BF_SYSMON_12_P : in STD_LOGIC; -- Auxiliary Channel 12
45  BF_SYSMON_12_N : in STD_LOGIC;
46  BF_SYSMON_13_P : in STD_LOGIC; -- Auxiliary Channel 13
47  BF_SYSMON_13_N : in STD_LOGIC;
48  BF_SYSMON_14_P : in STD_LOGIC; -- Auxiliary Channel 14
49  BF_SYSMON_14_N : in STD_LOGIC;
50  BF_SYSMON_15_P : in STD_LOGIC; -- Auxiliary Channel 15
51  BF_SYSMON_15_N : in STD_LOGIC;
52  -- VME Control
53  ncs : in std_logic;
54  rd_nwr : in std_logic;
55  ds : in std_logic;
56  addr_vme : in std_logic_vector (15 downto 0);
57  data_vme_in : in std_logic_vector (15 downto 0);
58  data_vme_out : out std_logic_vector (15 downto 0);
59  bus_drive : out std_logic
60  );
61 
62 end sys_monitor;
63 
64 architecture Behavioral of sys_monitor is
65 
66  component vme_inreg_notri_async is
67  generic (
68  ia_vme : integer;
69  width : integer);
70  port (
71  ncs : in std_logic;
72  rd_nwr : in std_logic;
73  ds : in std_logic;
74  addr_vme : in std_logic_vector (15 downto 0);
75  data_vme_in : in std_logic_vector (15 downto 0);
76  data_vme_out : out std_logic_vector (15 downto 0);
77  bus_drive : out std_logic;
78  data_from_vme : out std_logic_vector (width-1 downto 0);
79  data_to_vme : in std_logic_vector (width-1 downto 0));
80  end component vme_inreg_notri_async;
81 
82 
84  generic (
85  ia_vme : integer;
86  width : integer);
87  port (
88  ncs : in std_logic;
89  rd_nwr : in std_logic;
90  ds : in std_logic;
91  addr_vme : in std_logic_vector (15 downto 0);
92  data_vme : out std_logic_vector (15 downto 0);
93  bus_drive : out std_logic;
94  data_to_vme : in std_logic_vector (width-1 downto 0));
95  end component vme_outreg_notri_async;
96 
97  component vme_local_switch is
98  port (
99  data_vme_up : out std_logic_vector (15 downto 0);
100  data_vme_from_below : in arr_16;
101  bus_drive_up : out std_logic;
102  bus_drive_from_below : in std_logic_vector);
103  end component vme_local_switch;
104 
105  component sys_mon is
106  port (
107  DADDR_IN : in STD_LOGIC_VECTOR (6 downto 0); -- Address bus for the dynamic reconfiguration port
108  DCLK_IN : in STD_LOGIC; -- Clock input for the dynamic reconfiguration port
109  DEN_IN : in STD_LOGIC; -- Enable Signal for the dynamic reconfiguration port
110  DI_IN : in STD_LOGIC_VECTOR (15 downto 0); -- Input data bus for the dynamic reconfiguration port
111  DWE_IN : in STD_LOGIC; -- Write Enable for the dynamic reconfiguration port
112  RESET_IN : in STD_LOGIC; -- Reset signal for the System Monitor control logic
113  VAUXP1 : in STD_LOGIC; -- Auxiliary Channel 1
114  VAUXN1 : in STD_LOGIC;
115  VAUXP3 : in STD_LOGIC; -- Auxiliary Channel 3
116  VAUXN3 : in STD_LOGIC;
117  VAUXP4 : in STD_LOGIC; -- Auxiliary Channel 4
118  VAUXN4 : in STD_LOGIC;
119  VAUXP7 : in STD_LOGIC; -- Auxiliary Channel 7
120  VAUXN7 : in STD_LOGIC;
121  VAUXP8 : in STD_LOGIC; -- Auxiliary Channel 8
122  VAUXN8 : in STD_LOGIC;
123  VAUXP9 : in STD_LOGIC; -- Auxiliary Channel 9
124  VAUXN9 : in STD_LOGIC;
125  VAUXP10 : in STD_LOGIC; -- Auxiliary Channel 10
126  VAUXN10 : in STD_LOGIC;
127  VAUXP11 : in STD_LOGIC; -- Auxiliary Channel 11
128  VAUXN11 : in STD_LOGIC;
129  VAUXP12 : in STD_LOGIC; -- Auxiliary Channel 12
130  VAUXN12 : in STD_LOGIC;
131  VAUXP13 : in STD_LOGIC; -- Auxiliary Channel 13
132  VAUXN13 : in STD_LOGIC;
133  VAUXP14 : in STD_LOGIC; -- Auxiliary Channel 14
134  VAUXN14 : in STD_LOGIC;
135  VAUXP15 : in STD_LOGIC; -- Auxiliary Channel 15
136  VAUXN15 : in STD_LOGIC;
137  BUSY_OUT : out STD_LOGIC; -- ADC Busy signal
138  CHANNEL_OUT : out STD_LOGIC_VECTOR (4 downto 0); -- Channel Selection Outputs
139  DO_OUT : out STD_LOGIC_VECTOR (15 downto 0); -- Output data bus for dynamic reconfiguration port
140  DRDY_OUT : out STD_LOGIC; -- Data ready signal for the dynamic reconfiguration port
141  EOC_OUT : out STD_LOGIC; -- End of Conversion Signal
142  EOS_OUT : out STD_LOGIC; -- End of Sequence Signal
143  JTAGBUSY_OUT : out STD_LOGIC; -- JTAG DRP transaction is in progress signal
144  JTAGLOCKED_OUT : out STD_LOGIC; -- DRP port lock request has been made by JTAG
145  JTAGMODIFIED_OUT : out STD_LOGIC; -- Indicates JTAG Write to the DRP has occurred
146  OT_OUT : out STD_LOGIC; -- Over-Temperature alarm output
147  VCCAUX_ALARM_OUT : out STD_LOGIC; -- VCCAUX-sensor alarm output
148  VCCINT_ALARM_OUT : out STD_LOGIC; -- VCCINT-sensor alarm output
149  USER_TEMP_ALARM_OUT : out STD_LOGIC; -- Temperature-sensor alarm output
150  VP_IN : in STD_LOGIC; -- Dedicated Analog Input Pair
151  VN_IN : in STD_LOGIC
152  );
153  end component;
154 
155  -- no more chipscope component sysmon_chipscope_ctrl is
156  -- no more chipscope port (
157  -- no more chipscope CONTROL0: inout std_logic_vector(35 downto 0));
158  -- no more chipscope end component;
159  -- no more chipscope
160  -- no more chipscope
161  -- no more chipscope component sysmon_chipscope_ila is
162  -- no more chipscope port (
163  -- no more chipscope CONTROL: inout std_logic_vector(35 downto 0);
164  -- no more chipscope CLK: in std_logic;
165  -- no more chipscope DATA: in std_logic_vector(26 downto 0);
166  -- no more chipscope TRIG0: in std_logic_vector(26 downto 0));
167  -- no more chipscope end component;
168  -- no more chipscope
169  -- no more chipscope
170  -- no more chipscope -- Chipscope
171  -- no more chipscope signal control0 : std_logic_vector(35 downto 0);
172  -- no more chipscope signal sysmon_trigger : std_logic_vector(26 downto 0);
173  -- no more chipscope signal sysmon_data : std_logic_vector(26 downto 0);
174 
175 
176  -- VME
177  signal data_to_vme_REG_RO_SYSMON_DATA_BLOCK : arr_16(14 downto 0);
178  signal data_vme_from_below : arr_16(14 downto 0);
179  signal bus_drive_from_below : std_logic_vector(14 downto 0);
180 
181 
182  -- DRP
183  signal drdy : std_logic;
184  signal do : std_logic_vector(15 downto 0);
185 
186 
187  -- Control
188  signal busy : std_logic;
189  signal channel : std_logic_vector(4 downto 0);
190  signal eoc : std_logic;
191  signal eos : std_logic;
192  signal channel_int : std_logic_vector(6 downto 0);
193 
194  constant zeros_input : std_logic_vector(15 downto 0):=(others=>'0');
195 
196 begin
197 
198  channel_int <= "00" & channel;
199 
200  vme_local_switch_inst: entity work.vme_local_switch
201  port map (
206 
207 
208  gen_REG_RO_SYSMON_CTRL_BLOCK: for i_reg in 0 to 14 generate
209  vme_outreg_notri_async_REG_RO_SYSMON_CTRL_BLOCK : entity work.vme_outreg_notri_async
210  generic map (
211  ia_vme => ADDR_REG_RO_SYSMON_DATA_BLOCK+(2*i_reg),
212  width => 16)
213  port map (
214  addr_vme => addr_vme,
215  ncs => ncs,
216  rd_nwr => rd_nwr,
217  ds => ds,
219  data_vme => data_vme_from_below (i_reg),
220  bus_drive => bus_drive_from_below(i_reg));
221 
222  end generate;
223 
224  process(clk)
225  begin
226  if clk'event and clk = '1' then -- rising clock edge
227 
228  if drdy = '1' and channel = "00000" then
229  data_to_vme_REG_RO_SYSMON_DATA_BLOCK(0) <= do; -- channel 0
230  elsif drdy = '1' and channel = "00001" then
231  data_to_vme_REG_RO_SYSMON_DATA_BLOCK(1) <= do; -- channel 1
232  elsif drdy = '1' and channel = "00010" then
233  data_to_vme_REG_RO_SYSMON_DATA_BLOCK(2) <= do; -- channel 2
234  elsif drdy = '1' and channel = "1001" then
235  data_to_vme_REG_RO_SYSMON_DATA_BLOCK(3) <= do; -- channel 17
236  elsif drdy = '1' and channel = "10011" then
237  data_to_vme_REG_RO_SYSMON_DATA_BLOCK(4) <= do; -- channel 19
238  elsif drdy = '1' and channel = "10100" then
239  data_to_vme_REG_RO_SYSMON_DATA_BLOCK(5) <= do; -- channel 20
240  elsif drdy = '1' and channel = "10111" then
241  data_to_vme_REG_RO_SYSMON_DATA_BLOCK(6) <= do; -- channel 23
242  elsif drdy = '1' and channel = "11000" then
243  data_to_vme_REG_RO_SYSMON_DATA_BLOCK(7) <= do; -- channel 24
244  elsif drdy = '1' and channel = "11001" then
245  data_to_vme_REG_RO_SYSMON_DATA_BLOCK(8) <= do; -- channel 25
246  elsif drdy = '1' and channel = "11010" then
247  data_to_vme_REG_RO_SYSMON_DATA_BLOCK(9) <= do; -- channel 26
248  elsif drdy = '1' and channel = "11011" then
249  data_to_vme_REG_RO_SYSMON_DATA_BLOCK(10) <= do; -- channel 27
250  elsif drdy = '1' and channel = "11100" then
251  data_to_vme_REG_RO_SYSMON_DATA_BLOCK(11) <= do; -- channel 28
252  elsif drdy = '1' and channel = "11101" then
253  data_to_vme_REG_RO_SYSMON_DATA_BLOCK(12) <= do; -- channel 29
254  elsif drdy = '1' and channel = "11110" then
255  data_to_vme_REG_RO_SYSMON_DATA_BLOCK(13) <= do; -- channel 30
256  elsif drdy = '1' and channel = "11111" then
257  data_to_vme_REG_RO_SYSMON_DATA_BLOCK(14) <= do; -- channel 31
258  end if;
259 
260 
261  end if;
262  end process;
263 
264 
265  sys_mon_inst : SYS_MON
266  port map(
267  DADDR_IN => channel_int,
268  DCLK_IN => clk,
269  DEN_IN => eoc,
270  DI_IN => zeros_input,
271  DWE_IN => '0',
272  RESET_IN => '0',
273  VAUXP1 => BF_SYSMON_01_P,
274  VAUXN1 => BF_SYSMON_01_N,
275  VAUXP3 => BF_SYSMON_03_P,
276  VAUXN3 => BF_SYSMON_03_N,
277  VAUXP4 => BF_SYSMON_04_P,
278  VAUXN4 => BF_SYSMON_04_N,
279  VAUXP7 => BF_SYSMON_07_P,
280  VAUXN7 => BF_SYSMON_07_N,
281  VAUXP8 => BF_SYSMON_08_P,
282  VAUXN8 => BF_SYSMON_08_N,
283  VAUXP9 => BF_SYSMON_09_P,
284  VAUXN9 => BF_SYSMON_09_N,
285  VAUXP10 => BF_SYSMON_10_P,
286  VAUXN10 => BF_SYSMON_10_N,
287  VAUXP11 => BF_SYSMON_11_P,
288  VAUXN11 => BF_SYSMON_11_N,
289  VAUXP12 => BF_SYSMON_12_P,
290  VAUXN12 => BF_SYSMON_12_N,
291  VAUXP13 => BF_SYSMON_13_P,
292  VAUXN13 => BF_SYSMON_13_N,
293  VAUXP14 => BF_SYSMON_14_P,
294  VAUXN14 => BF_SYSMON_14_N,
295  VAUXP15 => BF_SYSMON_15_P,
296  VAUXN15 => BF_SYSMON_15_N,
297  BUSY_OUT => busy,
298  CHANNEL_OUT => channel,
299  DO_OUT => do,
300  DRDY_OUT => drdy,
301  EOC_OUT => eoc,
302  EOS_OUT => eos,
303  JTAGBUSY_OUT => open,
304  JTAGLOCKED_OUT => open,
305  JTAGMODIFIED_OUT => open,
306  OT_OUT => open,
307  VCCAUX_ALARM_OUT => open,
308  VCCINT_ALARM_OUT => open,
309  USER_TEMP_ALARM_OUT => open,
310  VP_IN => '0',
311  VN_IN => '0'
312  );
313 
314 -- no more chipscope sysmon_chipscope_ctrl_i : sysmon_chipscope_ctrl
315 -- no more chipscope port map(
316 -- no more chipscope CONTROL0 => control0
317 -- no more chipscope );
318 -- no more chipscope
319 -- no more chipscope sysmon_chipscope_ila_i : sysmon_chipscope_ila
320 -- no more chipscope port map (
321 -- no more chipscope CONTROL => control0,
322 -- no more chipscope CLK => clk,
323 -- no more chipscope DATA => sysmon_data,
324 -- no more chipscope TRIG0 => sysmon_trigger
325 -- no more chipscope );
326 -- no more chipscope
327 -- no more chipscope
328 -- no more chipscope -- Chipscope trigger
329 -- no more chipscope sysmon_trigger(0) <= ds;
330 -- no more chipscope sysmon_trigger(1) <= rd_nwr;
331 -- no more chipscope sysmon_trigger(2) <= drdy;
332 -- no more chipscope sysmon_trigger(3) <= eoc;
333 -- no more chipscope sysmon_trigger(4) <= eos;
334 -- no more chipscope sysmon_trigger(5) <= busy;
335 -- no more chipscope sysmon_trigger(10 downto 6) <= channel;
336 -- no more chipscope sysmon_trigger(26 downto 11) <= do;
337 -- no more chipscope --sysmon_trigger(63 downto 27) <= (others=>'0');
338 -- no more chipscope
339 -- no more chipscope -- Chipscope data
340 -- no more chipscope sysmon_data <= sysmon_trigger;
341 
342 end Behavioral;
343 
344 
in BF_SYSMON_09_PSTD_LOGIC
Definition: sys_monitor.vhd:38
in addr_vmestd_logic_vector (15 downto 0)
out data_vme_outstd_logic_vector (15 downto 0)
Definition: sys_monitor.vhd:58
in rd_nwrstd_logic
Definition: sys_monitor.vhd:54
out data_vmestd_logic_vector (15 downto 0)
in BF_SYSMON_03_NSTD_LOGIC
Definition: sys_monitor.vhd:31
in BF_SYSMON_10_PSTD_LOGIC
Definition: sys_monitor.vhd:40
in BF_SYSMON_13_NSTD_LOGIC
Definition: sys_monitor.vhd:47
in BF_SYSMON_12_PSTD_LOGIC
Definition: sys_monitor.vhd:44
std_logic_vector (14 downto 0) bus_drive_from_below
out data_from_vmestd_logic_vector (width - 1 downto 0)
in BF_SYSMON_03_PSTD_LOGIC
Definition: sys_monitor.vhd:30
in BF_SYSMON_09_NSTD_LOGIC
Definition: sys_monitor.vhd:39
std_logic_vector (15 downto 0) do
in BF_SYSMON_13_PSTD_LOGIC
Definition: sys_monitor.vhd:46
in BF_SYSMON_11_NSTD_LOGIC
Definition: sys_monitor.vhd:43
in data_vme_from_belowarr_16
--! inputs from local registers and from
in BF_SYSMON_07_NSTD_LOGIC
Definition: sys_monitor.vhd:35
in BF_SYSMON_01_NSTD_LOGIC
Definition: sys_monitor.vhd:29
in data_vme_instd_logic_vector (15 downto 0)
in ncsstd_logic
Definition: sys_monitor.vhd:53
in addr_vmestd_logic_vector (15 downto 0)
Definition: sys_monitor.vhd:56
std_logic_vector (15 downto 0) :=( others =>'0' ) zeros_input
in BF_SYSMON_07_PSTD_LOGIC
Definition: sys_monitor.vhd:34
in dsstd_logic
Definition: sys_monitor.vhd:55
in BF_SYSMON_10_NSTD_LOGIC
Definition: sys_monitor.vhd:41
in data_to_vmestd_logic_vector (width - 1 downto 0)
in BF_SYSMON_04_NSTD_LOGIC
Definition: sys_monitor.vhd:33
in BF_SYSMON_14_PSTD_LOGIC
Definition: sys_monitor.vhd:48
out data_vme_upstd_logic_vector (15 downto 0)
--! connect this to
in addr_vmestd_logic_vector (15 downto 0)
in data_vme_instd_logic_vector (15 downto 0)
Definition: sys_monitor.vhd:57
in BF_SYSMON_01_PSTD_LOGIC
Definition: sys_monitor.vhd:28
out bus_drive_upstd_logic
or of all bus drive requests from below
std_logic_vector (4 downto 0) channel
in BF_SYSMON_08_NSTD_LOGIC
Definition: sys_monitor.vhd:37
in BF_SYSMON_14_NSTD_LOGIC
Definition: sys_monitor.vhd:49
in BF_SYSMON_08_PSTD_LOGIC
Definition: sys_monitor.vhd:36
in BF_SYSMON_11_PSTD_LOGIC
Definition: sys_monitor.vhd:42
in clkstd_logic
Definition: sys_monitor.vhd:27
ADDR_REG_RO_SYSMON_DATA_BLOCKinteger :=16#1364#
Definition: sys_monitor.vhd:22
_library_ IEEEIEEE
Definition: Stretch_10.vhd:8
in BF_SYSMON_15_PSTD_LOGIC
Definition: sys_monitor.vhd:50
arr_16 (14 downto 0) data_to_vme_REG_RO_SYSMON_DATA_BLOCK
out data_vme_outstd_logic_vector (15 downto 0)
in BF_SYSMON_04_PSTD_LOGIC
Definition: sys_monitor.vhd:32
in BF_SYSMON_15_NSTD_LOGIC
Definition: sys_monitor.vhd:51
test registers
sys_mon sys_mon_instsys_mon_inst
std_logic_vector (6 downto 0) channel_int
out bus_drivestd_logic
Definition: sys_monitor.vhd:59
in BF_SYSMON_12_NSTD_LOGIC
Definition: sys_monitor.vhd:45
arr_16 (14 downto 0) data_vme_from_below
in data_to_vmestd_logic_vector (width - 1 downto 0)
in bus_drive_from_belowstd_logic_vector