CMX
CMX firmware code in-line documentation
 All Classes Namespaces Files Functions Variables
vme_outreg_rtl.vhd
Go to the documentation of this file.
1 
5 
6 
7 LIBRARY ieee ;
8 USE ieee.std_logic_1164.all;
9 USE ieee.numeric_std.all;
10 
11 
12 use work.CMXpackage.all;
13 use work.CMX_VME_defs.all;
14 
15 entity vme_outreg is
16  generic(
17  ia_vme : integer := 0;
18  width : integer := 16
19  );
20  port(
21  clk : in std_logic;
22 
23  ncs : in std_logic;
24  rd_nwr : in std_logic;
25  ds : in std_logic;
26 
27  addr_vme : in std_logic_vector (15 downto 0);
28  data_vme : out std_logic_vector (15 downto 0);
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 ;
37 --------------------------------------------------------------------------------
38 ARCHITECTURE rtl OF vme_outreg 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 
66  -- read access
67  begin
68  data_vme <= "ZZZZZZZZZZZZZZZZ";
69  if (ren = '1') then
70  data_vme <= (others=>'0');
71  data_vme(width-1 downto 0) <= data_to_vme;
72  end if;
73  end process;
74 
75  -- detect a read enable edge and generate a pulse on read_detect signal
76  read_detect_proc: process (clk)
77  begin -- process read_detect_proc
78  if rising_edge(clk) then -- rising clock edge
79  if ren_rrrrrr='1' and ren_rrrrr='1' and ren_rrrr='1' and ren_rrr='1' and ren_rr='1' and ren_r='1'
80  and ds_rrrrrrrr='0' and ds_rrrrrrr='0' and ds_rrrrrr='0' and ds_rrrrr='1' and ds_rrrr='1' and ds_rrr='1'
81  then
82  read_detect_sig <= '1';
83  else
84  read_detect_sig <= '0';
85  end if;
89  ren_rrr<=ren_rr;
90  ren_rr<=ren_r;
91  ren_r<=ren;
92 
97  ds_rrrr<=ds_rrr;
98  ds_rrr<=ds_rr;
99  ds_rr<=ds_r;
100  ds_r<=ds;
101 
102  end if;
103  end process read_detect_proc;
104 
105 
107  gen_read_detect_delay: for i_del in 1 to VME_read_det_delay-1 generate
108  process(clk)
109  begin
110  if rising_edge(clk) then
112  end if;
113  end process;
114  end generate gen_read_detect_delay;
115 
116  read_detect<=read_detect_delay_line(VME_read_det_delay-1);
117 
118 END rtl;
119 
120 
121 
in rd_nwrstd_logic
in clkstd_logic
in dsstd_logic
std_logic ren_rrr
std_logic ds_rrrrr
out read_detectstd_logic
std_logic ren_rrrr
std_logic ds_rrr
ia_vmeinteger :=0
std_logic ren_rr
std_logic read_detect_sig
std_logic ren_rrrrr
in data_to_vmestd_logic_vector (width - 1 downto 0)
std_logic_vector (VME_read_det_delay - 1 downto 0) read_detect_delay_line
std_logic ren_rrrrrr
std_logic ds_rrrrrrrr
std_logic ds_rrrr
widthinteger :=16
vme_r_procren,data_to_vme
_library_ ieeeieee
in addr_vmestd_logic_vector (15 downto 0)
std_logic ds_rrrrrrr
out data_vmestd_logic_vector (15 downto 0)
in ncsstd_logic
test registers
std_logic ds_rrrrrr