OpenCores
URL https://opencores.org/ocsvn/pcie_sg_dma/pcie_sg_dma/trunk

Subversion Repositories pcie_sg_dma

[/] [pcie_sg_dma/] [branches/] [Virtex6/] [ML605_ISE12.3/] [pcie_sg_dma/] [Virtex6/] [ML605/] [pseudo_protocol_module.vhd] - Blame information for rev 11

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 11 barabba
----------------------------------------------------------------------------------
2
-- Company:   ziti
3
-- Engineer:  wgao
4
-- 
5
-- Create Date:    17:01:32 19 Jun 2009
6
-- Design Name: 
7
-- Module Name:    pseudo_protocol_module - Behavioral 
8
-- Project Name: 
9
-- Target Devices: 
10
-- Tool versions: 
11
-- Description: 
12
--
13
-- Dependencies: 
14
--
15
-- Revision: 
16
-- Revision 0.01 - File Created
17
-- Additional Comments: 
18
--
19
----------------------------------------------------------------------------------
20
library IEEE;
21
use IEEE.STD_LOGIC_1164.ALL;
22
use IEEE.STD_LOGIC_ARITH.ALL;
23
use IEEE.STD_LOGIC_UNSIGNED.ALL;
24
 
25
library work;
26
use work.abb64Package.all;
27
 
28
---- Uncomment the following library declaration if instantiating
29
---- any Xilinx primitives in this code.
30
--library UNISIM;
31
--use UNISIM.VComponents.all;
32
 
33
entity pseudo_protocol_module is
34
--    Generic (
35
--             C_PRO_DAQ_WIDTH  :  integer  :=  16 ;
36
--             C_PRO_DLM_WIDTH  :  integer  :=   4 ;
37
--             C_PRO_CTL_WIDTH  :  integer  :=  16
38
--            );
39
    Port (
40
 
41
           -- DAQ Tx
42
           data2send_start          : IN    std_logic;
43
           data2send_end            : IN    std_logic;
44
           data2send                : IN    std_logic_vector(64-1 downto 0);
45
           crc_error_send           : IN    std_logic;
46
           data2send_stop           : OUT   std_logic;
47
 
48
           -- DAQ Rx
49
           data_rec_start           : OUT   std_logic;
50
           data_rec_end             : OUT   std_logic;
51
           data_rec                 : OUT   std_logic_vector(64-1 downto 0);
52
           crc_error_rec            : OUT   std_logic;
53
           data_rec_stop            : IN    std_logic;
54
 
55
           -- CTL Tx
56
           ctrl2send_start          : IN    std_logic;
57
           ctrl2send_end            : IN    std_logic;
58
           ctrl2send                : IN    std_logic_vector(16-1 downto 0);
59
           ctrl2send_stop           : OUT   std_logic;
60
 
61
           -- CTL Rx
62
           ctrl_rec_start           : OUT   std_logic;
63
           ctrl_rec_end             : OUT   std_logic;
64
           ctrl_rec                 : OUT   std_logic_vector(16-1 downto 0);
65
           ctrl_rec_stop            : IN    std_logic;
66
 
67
           -- DLM Tx
68
           dlm2send_va              : IN    std_logic;
69
           dlm2send_type            : IN    std_logic_vector(4-1 downto 0);
70
 
71
           -- DLM Rx
72
           dlm_rec_va               : OUT   std_logic;
73
           dlm_rec_type             : OUT   std_logic_vector(4-1 downto 0);
74
 
75
           -- dummy pin input  !!!! not really exists
76
           dummy_pin_in             : IN    std_logic_vector(3-1 downto 0);
77
 
78
           -- Common interface
79
           link_tx_clk              : OUT   std_logic;
80
           link_rx_clk              : OUT   std_logic;
81
           link_active              : OUT   std_logic_vector(2-1 downto 0);
82
           clk                      : IN    std_logic;
83
           res_n                    : IN    std_logic
84
          );
85
end entity pseudo_protocol_module;
86
 
87
 
88
architecture Behavioral of pseudo_protocol_module is
89
 
90
  -- DAQ Rx
91
  signal  data_rec_start_i      : std_logic;
92
  signal  data_rec_end_i        : std_logic;
93
  signal  data_rec_i            : std_logic_vector(64-1 downto 0);
94
  signal  crc_error_rec_i       : std_logic;
95
  signal  data2send_stop_i      : std_logic;
96
 
97
  -- CTL Rx
98
  signal  ctrl_rec_start_i      : std_logic;
99
  signal  ctrl_rec_end_i        : std_logic;
100
  signal  ctrl_rec_i            : std_logic_vector(16-1 downto 0);
101
  signal  ctrl2send_stop_i      : std_logic;
102
 
103
  -- DLM Rx
104
  signal  dlm_rec_va_i          : std_logic;
105
  signal  dlm_rec_type_i        : std_logic_vector(4-1 downto 0);
106
 
107
  -- Link active latency
108
  signal  link_act_counter      : std_logic_vector(8-1 downto 0);
109
  signal  link_active_i         : std_logic_vector(2-1 downto 0);
110
 
111
  -- Dummy pin
112
  signal  dummy_pin_r1          : std_logic_vector(3-1 downto 0);
113
  signal  dummy_pin_r2          : std_logic_vector(3-1 downto 0);
114
  signal  dummy_pin_r3          : std_logic_vector(3-1 downto 0);
115
  signal  dummy_pin_r4          : std_logic_vector(3-1 downto 0);
116
 
117
 
118
begin
119
 
120
  link_tx_clk       <= clk;
121
  link_rx_clk       <= clk;
122
  link_active       <= link_active_i;
123
 
124
  data_rec_start    <= data_rec_start_i  ;
125
  data_rec_end      <= data_rec_end_i    ;
126
  data_rec          <= data_rec_i        ;
127
  crc_error_rec     <= crc_error_rec_i   ;
128
  data2send_stop    <= data2send_stop_i  ;
129
 
130
  ctrl_rec_start    <= ctrl_rec_start_i  ;
131
  ctrl_rec_end      <= ctrl_rec_end_i    ;
132
  ctrl_rec          <= ctrl_rec_i        ;
133
  ctrl2send_stop    <= ctrl2send_stop_i  ;
134
 
135
  dlm_rec_va        <= dlm_rec_va_i      ;
136
  dlm_rec_type      <= dlm_rec_type_i    ;
137
 
138
 
139
  -------------------------------------------
140
  -- Dummy pin delayed
141
  -- 
142
  Synchron_dummy_pin:
143
  process (clk, res_n )
144
  begin
145
    if res_n = '0' then
146
        dummy_pin_r1     <= (OTHERS=>'0');
147
        dummy_pin_r2     <= (OTHERS=>'0');
148
        dummy_pin_r3     <= (OTHERS=>'0');
149
        dummy_pin_r4     <= (OTHERS=>'0');
150
    elsif clk'event and clk = '1' then
151
        dummy_pin_r1     <= dummy_pin_in;
152
        dummy_pin_r2     <= dummy_pin_r1;
153
        dummy_pin_r3     <= dummy_pin_r2;
154
        dummy_pin_r4     <= dummy_pin_r3;
155
    end if;
156
  end process;
157
 
158
 
159
  -------------------------------------------
160
  -- Link active coutner up
161
  -- 
162
  Synchron_Link_Active:
163
  process (clk, res_n )
164
  begin
165
    if res_n = '0' then
166
        link_act_counter   <= (OTHERS=>'0');
167
        link_active_i      <= (OTHERS=>'0');
168
    elsif clk'event and clk = '1' then
169
        if link_active_i="11" then
170
           link_active_i      <= link_active_i;
171
           link_act_counter   <= link_act_counter;
172
        elsif link_act_counter=X"ff" then
173
           link_active_i      <= "11";
174
           link_act_counter   <= link_act_counter;
175
        else
176
           link_active_i      <= link_active_i;
177
           link_act_counter   <= link_act_counter + '1';
178
        end if;
179
    end if;
180
  end process;
181
 
182
 
183
  -------------------------------------------
184
  -- DAQ transferred over
185
  -- 
186
  --  (Data/Event generator can be built here ... ... ... )
187
  -- 
188
  Transfer_DAQ:
189
  process (clk, res_n )
190
  begin
191
    if res_n = '0' then
192
                  data_rec_start_i   <= '0';
193
        data_rec_end_i     <= '0';
194
                  data_rec_i         <= (OTHERS=>'0');
195
                  crc_error_rec_i    <= '0';
196
                  data2send_stop_i   <= '1';
197
    elsif clk'event and clk = '1' then
198
           if dummy_pin_r1(0)='0' then
199
                  data_rec_start_i   <= data2send_start;
200
        data_rec_end_i     <= data2send_end;
201
                  data_rec_i         <= data2send;
202
                  crc_error_rec_i    <= crc_error_send;
203
                  data2send_stop_i   <= data_rec_stop;
204
                else
205
                  data_rec_start_i   <= '0';
206
        data_rec_end_i     <= '0';
207
                  data_rec_i         <= (OTHERS=>'0');
208
                  crc_error_rec_i    <= '0';
209
                  data2send_stop_i   <= '0';
210
                end if;
211
    end if;
212
  end process;
213
 
214
 
215
  -------------------------------------------
216
  -- CTL transferred over
217
  -- 
218
  Transfer_CTL:
219
  process (clk, res_n )
220
  begin
221
    if res_n = '0' then
222
                  ctrl_rec_start_i    <= '0';
223
                  ctrl_rec_end_i      <= '0';
224
                  ctrl_rec_i          <= (OTHERS=>'0');
225
                  ctrl2send_stop_i    <= '1';
226
    elsif clk'event and clk = '1' then
227
           if dummy_pin_r1(2)='0' and dummy_pin_r2(2)='0' and dummy_pin_r3(2)='0' then
228
                  ctrl_rec_start_i    <= ctrl2send_start;
229
                  ctrl_rec_end_i      <= ctrl2send_end;
230
                  ctrl_rec_i          <= ctrl2send;
231
                  ctrl2send_stop_i    <= ctrl_rec_stop;
232
           elsif dummy_pin_r1(2)='1' and dummy_pin_r2(2)='0' and dummy_pin_r3(2)='0' then
233
                  ctrl_rec_start_i    <= '1';
234
                  ctrl_rec_end_i      <= '0';
235
                  ctrl_rec_i          <= (OTHERS=>'1');
236
                  ctrl2send_stop_i    <= ctrl_rec_stop;
237
           elsif dummy_pin_r1(2)='1' and dummy_pin_r2(2)='1' and dummy_pin_r3(2)='0' then
238
                  ctrl_rec_start_i    <= '0';
239
                  ctrl_rec_end_i      <= '1';
240
                  ctrl_rec_i          <= (OTHERS=>'0');
241
                  ctrl2send_stop_i    <= ctrl_rec_stop;
242
           elsif dummy_pin_r1(2)='0' and dummy_pin_r2(2)='1' and dummy_pin_r3(2)='0' then
243
                  ctrl_rec_start_i    <= '0';
244
                  ctrl_rec_end_i      <= '1';
245
                  ctrl_rec_i          <= (OTHERS=>'0');
246
                  ctrl2send_stop_i    <= ctrl_rec_stop;
247
                else
248
                  ctrl_rec_start_i    <= '0';
249
                  ctrl_rec_end_i      <= '0';
250
                  ctrl_rec_i          <= (OTHERS=>'0');
251
                  ctrl2send_stop_i    <= '0';
252
                end if;
253
    end if;
254
  end process;
255
 
256
 
257
  -------------------------------------------
258
  -- DLM transferred over
259
  -- 
260
  Transfer_DLM:
261
  process (clk, res_n )
262
  begin
263
    if res_n = '0' then
264
                  dlm_rec_va_i     <= '0';
265
                  dlm_rec_type_i   <= (OTHERS=>'0');
266
    elsif clk'event and clk = '1' then
267
           if dummy_pin_r1(1)='0' then
268
                  dlm_rec_va_i     <= dlm2send_va;
269
                  dlm_rec_type_i   <= dlm2send_type;
270
                else
271
                  dlm_rec_va_i     <= '0';
272
                  dlm_rec_type_i   <= (OTHERS=>'0');
273
                end if;
274
    end if;
275
  end process;
276
 
277
 
278
end architecture Behavioral;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.