CMX
CMX firmware code in-line documentation
 All Classes Namespaces Files Functions Variables
vme_outreg_rtl_notri.vhd
Go to the documentation of this file.
1 
5 
6 LIBRARY ieee ;
7 USE ieee.std_logic_1164.all;
8 USE ieee.numeric_std.all;
9 
10 
11 use work.CMXpackage.all;
12 use work.CMX_VME_defs.all;
13 
15  generic(
16  ia_vme : integer := 0;
17  width : integer := 16
18  );
19  port(
20  clk : in std_logic;
21 
22  ncs : in std_logic;
23  rd_nwr : in std_logic;
24  ds : in std_logic;
25 
26  addr_vme : in std_logic_vector (15 downto 0);
27  data_vme : out std_logic_vector (15 downto 0);
28  bus_drive : out std_logic;
29 
30  data_to_vme : in std_logic_vector (width-1 downto 0);
31  read_detect : out std_logic
32  );
33 
34 -- Declarations
35 
36 end vme_outreg_notri ;
37 --------------------------------------------------------------------------------
38 ARCHITECTURE rtl OF vme_outreg_notri IS
39 --------------------------------------------------------------------------------
40 -- VME register, all bits are inputs to board (q).
41 -- Variable width q, max 16.
42 --
43 
44  signal ren: std_logic; -- vme read enable
45  signal ren_r,ren_rr,ren_rrr,ren_rrrr,ren_rrrrr,ren_rrrrrr: std_logic; --above
46  --registered to
47  --sys clk
48 
49  signal ds_r,ds_rr,ds_rrr,ds_rrrr,ds_rrrrr,ds_rrrrrr,ds_rrrrrrr,ds_rrrrrrrr : std_logic; -- previous
50  -- registered
51  -- value of strobe
52 
53  signal read_detect_sig : std_logic;
54  signal read_detect_delay_line : std_logic_vector(VME_read_det_delay-1 downto 0);
55 
56 
57 
58 --------------------------------------------------------------------------------
59 BEGIN
60 
61 
62  ren <= vme_ren (ia_vme, addr_vme, ncs, rd_nwr);
63 
64 
65  data_vme(width-1 downto 0)<=data_to_vme when ren='1' else (others=>'0');
66  gz: if width<16 generate
67  data_vme(15 downto width)<=(others=>'0');
68  end generate gz;
69  bus_drive<=ren;
70 
71  -- detect a read enable edge and generate a pulse on read_detect signal
72  read_detect_proc: process (clk)
73  begin -- process read_detect_proc
74  if rising_edge(clk) then -- rising clock edge
75  if ren_rrrrrr='1' and ren_rrrrr='1' and ren_rrrr='1' and ren_rrr='1' and ren_rr='1' and ren_r='1'
76  and ds_rrrrrrrr='0' and ds_rrrrrrr='0' and ds_rrrrrr='0' and ds_rrrrr='1' and ds_rrrr='1' and ds_rrr='1'
77  then
78  read_detect_sig <= '1';
79  else
80  read_detect_sig <= '0';
81  end if;
85  ren_rrr<=ren_rr;
86  ren_rr<=ren_r;
87  ren_r<=ren;
88 
93  ds_rrrr<=ds_rrr;
94  ds_rrr<=ds_rr;
95  ds_rr<=ds_r;
96  ds_r<=ds;
97 
98  end if;
99  end process read_detect_proc;
100 
101 
103  gen_read_detect_delay: for i_del in 1 to VME_read_det_delay-1 generate
104  process(clk)
105  begin
106  if rising_edge(clk) then
108  end if;
109  end process;
110  end generate gen_read_detect_delay;
111 
112  read_detect<=read_detect_delay_line(VME_read_det_delay-1);
113 
114 END rtl;
115 
116 
117 
out data_vmestd_logic_vector (15 downto 0)
std_logic_vector (VME_read_det_delay - 1 downto 0) read_detect_delay_line
_library_ ieeeieee
in data_to_vmestd_logic_vector (width - 1 downto 0)
in addr_vmestd_logic_vector (15 downto 0)
test registers
out read_detectstd_logic