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

Subversion Repositories core1990_interlaken

[/] [core1990_interlaken/] [trunk/] [gateware/] [sources/] [interlaken/] [interlaken_interface_vc709.vhd] - Blame information for rev 11

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 11 N.Boukadid
library ieee;
2
use ieee.std_logic_1164.all;
3
use ieee.numeric_std.all;
4
library work;
5
 
6
entity interlaken_interface is
7
  generic(
8
    BurstMax   : positive;      -- Configurable value of BurstMax
9
    BurstShort : positive;      -- Configurable value of BurstShort
10
    PacketLength : positive    -- Configurable value of PacketLength -- 24 packets * 8  = 192 B
11
  );
12
  port (
13
    ----40 MHz input, from clock generator------------
14
    clk40 : in std_logic;
15
    clk150 : in std_logic;
16
    reset : in std_logic;
17
 
18
    ----125 MHz input, to transceiver (SGMII clock)--
19
    GTREFCLK_IN_P : in std_logic;
20
    GTREFCLK_IN_N : in std_logic;
21
 
22
    ----Data signals---------------------------------
23
    TX_Data  : in std_logic_vector(63 downto 0);          -- Data transmitted
24
    RX_Data  : out std_logic_vector (63 downto 0);   -- Data received
25
 
26
    ----Transceiver related transmission-------------
27
    TX_Out_P  : out std_logic;
28
    TX_Out_N  : out std_logic;
29
    RX_In_P   : in std_logic;
30
    RX_In_N   : in std_logic;
31
 
32
    ----Transmitter input/ready signals--------------
33
    TX_SOP          : in std_logic;
34
    TX_EOP          : in std_logic;
35
    TX_EOP_Valid    : in std_logic_vector(2 downto 0);
36
    TX_FlowControl  : in std_logic_vector(15 downto 0);
37
    TX_Channel      : in std_logic_vector(7 downto 0);
38
 
39
    ----Receiver output signals-----------------------
40
    RX_SOP         : out std_logic;                         -- Start of Packet
41
    RX_EOP         : out std_logic;                         -- End of Packet
42
    RX_EOP_Valid  : out std_logic_vector(2 downto 0);      -- Valid bytes packet contains
43
    RX_FlowControl : out std_logic_vector(15 downto 0);     -- Flow control data (yet unutilized)
44
    RX_Channel     : out std_logic_vector(7 downto 0);      -- Select transmit channel (yet unutilized)
45
 
46
    RX_FIFO_Valid   : out std_logic;
47
 
48
    ----Transmitter status signals---------------------
49
    TX_FIFO_Full    : out std_logic;
50
    TX_FIFO_Write   : in std_logic;
51
    TX_FIFO_progfull: out std_logic;
52
 
53
    RX_in : out std_logic_vector(63 downto 0); --Debug
54
    TX_out: out std_logic_vector(63 downto 0); --Debug
55
    Data_Descrambler : out std_logic_vector(66 downto 0);
56
    Data_Decoder     : out std_logic_vector(66 downto 0);
57
 
58
    ----Receiver status signals------------------------
59
    RX_FIFO_Full      : out std_logic;
60
    RX_FIFO_Empty     : out std_logic;
61
    RX_FIFO_Read      : in std_logic;
62
    Decoder_lock      : out std_logic;
63
    Descrambler_lock  : out std_logic;
64
    CRC24_Error       : out std_logic;
65
    CRC32_Error       : out std_logic;
66
 
67
    loopback_in       : in std_logic_vector(2 downto 0)
68
  );
69
end entity interlaken_interface;
70
 
71
architecture interface of interlaken_interface is
72
 
73
  signal TX_User_Clock, RX_User_Clock : std_logic;
74
  signal Data_Transferred : std_logic_vector(66 downto 0);    --Data in transfer
75
 
76
  -------------------------- Include Transceiver -----------------------------
77
  component Transceiver_10g_64b67b
78
  port
79
  (
80
    SOFT_RESET_TX_IN                        : in   std_logic;
81
    SOFT_RESET_RX_IN                        : in   std_logic;
82
    DONT_RESET_ON_DATA_ERROR_IN             : in   std_logic;
83
    Q1_CLK0_GTREFCLK_PAD_N_IN               : in   std_logic;
84
    Q1_CLK0_GTREFCLK_PAD_P_IN               : in   std_logic;
85
 
86
    GT0_TX_FSM_RESET_DONE_OUT               : out  std_logic;
87
    GT0_RX_FSM_RESET_DONE_OUT               : out  std_logic;
88
    GT0_DATA_VALID_IN                       : in   std_logic;
89
    GT0_TX_MMCM_LOCK_OUT                    : out  std_logic;
90
    GT0_RX_MMCM_LOCK_OUT                    : out  std_logic;
91
 
92
    GT0_TXUSRCLK_OUT                        : out  std_logic;
93
    GT0_TXUSRCLK2_OUT                       : out  std_logic;
94
    GT0_RXUSRCLK_OUT                        : out  std_logic;
95
    GT0_RXUSRCLK2_OUT                       : out  std_logic;
96
 
97
    --_________________________________________________________________________
98
    --GT0  (X0Y4)
99
    --____________________________CHANNEL PORTS________________________________
100
    ---------------------------- Channel - DRP Ports  --------------------------
101
    gt0_drpaddr_in                          : in   std_logic_vector(8 downto 0);
102
    gt0_drpdi_in                            : in   std_logic_vector(15 downto 0);
103
    gt0_drpdo_out                           : out  std_logic_vector(15 downto 0);
104
    gt0_drpen_in                            : in   std_logic;
105
    gt0_drprdy_out                          : out  std_logic;
106
    gt0_drpwe_in                            : in   std_logic;
107
    ------------------------------- Loopback Ports -----------------------------
108
    gt0_loopback_in                         : in   std_logic_vector(2 downto 0);
109
    --------------------- RX Initialization and Reset Ports --------------------
110
    gt0_eyescanreset_in                     : in   std_logic;
111
    gt0_rxuserrdy_in                        : in   std_logic;
112
    -------------------------- RX Margin Analysis Ports ------------------------
113
    gt0_eyescandataerror_out                : out  std_logic;
114
    gt0_eyescantrigger_in                   : in   std_logic;
115
    ------------------- Receive Ports - Digital Monitor Ports ------------------
116
    gt0_dmonitorout_out                     : out  std_logic_vector(14 downto 0);
117
    ------------------ Receive Ports - FPGA RX interface Ports -----------------
118
    gt0_rxdata_out                          : out  std_logic_vector(63 downto 0);
119
    ------------------------ Receive Ports - RX AFE Ports ----------------------
120
    gt0_gthrxn_in                           : in   std_logic;
121
    --------------------- Receive Ports - RX Equalizer Ports -------------------
122
    gt0_rxmonitorout_out                    : out  std_logic_vector(6 downto 0);
123
    gt0_rxmonitorsel_in                     : in   std_logic_vector(1 downto 0);
124
    --------------- Receive Ports - RX Fabric Output Control Ports -------------
125
    gt0_rxoutclkfabric_out                  : out  std_logic;
126
    ---------------------- Receive Ports - RX Gearbox Ports --------------------
127
    gt0_rxdatavalid_out                     : out  std_logic;
128
    gt0_rxheader_out                        : out  std_logic_vector(2 downto 0);
129
    gt0_rxheadervalid_out                   : out  std_logic;
130
    --------------------- Receive Ports - RX Gearbox Ports  --------------------
131
    gt0_rxgearboxslip_in                    : in   std_logic;
132
    ------------- Receive Ports - RX Initialization and Reset Ports ------------
133
    gt0_gtrxreset_in                        : in   std_logic;
134
    ------------------------ Receive Ports -RX AFE Ports -----------------------
135
    gt0_gthrxp_in                           : in   std_logic;
136
    -------------- Receive Ports -RX Initialization and Reset Ports ------------
137
    gt0_rxresetdone_out                     : out  std_logic;
138
    --------------------- TX Initialization and Reset Ports --------------------
139
    gt0_gttxreset_in                        : in   std_logic;
140
    gt0_txuserrdy_in                        : in   std_logic;
141
    -------------- Transmit Ports - 64b66b and 64b67b Gearbox Ports ------------
142
    gt0_txheader_in                         : in   std_logic_vector(2 downto 0);
143
    ------------------ Transmit Ports - TX Data Path interface -----------------
144
    gt0_txdata_in                           : in   std_logic_vector(63 downto 0);
145
    ---------------- Transmit Ports - TX Driver and OOB signaling --------------
146
    gt0_gthtxn_out                          : out  std_logic;
147
    gt0_gthtxp_out                          : out  std_logic;
148
    ----------- Transmit Ports - TX Fabric Clock Output Control Ports ----------
149
    gt0_txoutclkfabric_out                  : out  std_logic;
150
    gt0_txoutclkpcs_out                     : out  std_logic;
151
    --------------------- Transmit Ports - TX Gearbox Ports --------------------
152
    gt0_txsequence_in                       : in   std_logic_vector(6 downto 0);
153
    ------------- Transmit Ports - TX Initialization and Reset Ports -----------
154
    gt0_txresetdone_out                     : out  std_logic;
155
 
156
    --____________________________COMMON PORTS________________________________
157
    GT0_QPLLLOCK_OUT       : out std_logic;
158
    GT0_QPLLREFCLKLOST_OUT : out std_logic;
159
    GT0_QPLLOUTCLK_OUT     : out std_logic;
160
    GT0_QPLLOUTREFCLK_OUT  : out std_logic;
161
    sysclk_in              : in  std_logic
162
  );
163
  end component;
164
 
165
  signal RX_prog_full : std_logic_vector(15 downto 0);
166
  signal FlowControl : std_logic_vector(15 downto 0);
167
  signal RX_Datavalid_Out : std_logic;
168
  signal RX_Header_Out : std_logic_vector(2 downto 0);
169
  signal RX_Headervalid_Out : std_logic;
170
  signal RX_Gearboxslip_In : std_logic;
171
  signal RX_Resetdone_Out : std_logic;
172
 
173
  signal TX_Gearboxready_Out : std_logic;
174
  signal TX_Header_In : std_logic_vector(2 downto 0);
175
  signal TX_Startseq_In : std_logic;
176
  signal TX_Resetdone_Out : std_logic;
177
 
178
  signal Data_Transceiver_In, Data_Transceiver_Out : std_logic_vector(63 downto 0);
179
  signal GT0_DATA_VALID_IN : std_logic;
180
  signal GT0_TX_FSM_RESET_DONE_OUT : std_logic;
181
  signal link_up : std_logic;
182
  signal Descrambler_Locked : std_logic;
183
 
184
  signal gt0_txsequence_i       : std_logic_vector(6 downto 0);
185
  signal gt0_txseq_counter_r    :   unsigned(8 downto 0);
186
 
187
  signal gt0_pause_data_valid_r : std_logic;
188
  signal gt0_data_valid_out_i   : std_logic;
189
 
190
begin
191
 
192
  ------------------------------ System Clock --------------------------------
193
  startseq : process (TX_User_Clock)
194
  begin
195
    if rising_edge(TX_User_Clock) then
196
      if (reset = '1') then
197
         TX_Startseq_In <= '0';
198
      elsif (TX_Gearboxready_Out = '1') then
199
          TX_Startseq_In <= '1';
200
      end if;
201
    end if;
202
  end process;
203
 
204
  ------------------------------- Transceiver --------------------------------
205
  Transceiver_10g_64b67b_i : Transceiver_10g_64b67b
206
  port map (
207
    SOFT_RESET_TX_IN => reset,
208
    SOFT_RESET_RX_IN => reset,
209
    DONT_RESET_ON_DATA_ERROR_IN => '0',
210
    Q1_CLK0_GTREFCLK_PAD_N_IN => GTREFCLK_IN_N,
211
    Q1_CLK0_GTREFCLK_PAD_P_IN => GTREFCLK_IN_P,
212
 
213
    GT0_TX_FSM_RESET_DONE_OUT => GT0_TX_FSM_RESET_DONE_OUT,
214
    GT0_RX_FSM_RESET_DONE_OUT => open,
215
    GT0_DATA_VALID_IN => GT0_DATA_VALID_IN,
216
    GT0_TX_MMCM_LOCK_OUT => open,
217
    GT0_RX_MMCM_LOCK_OUT => open,
218
 
219
    GT0_TXUSRCLK_OUT => open,
220
    GT0_TXUSRCLK2_OUT => TX_User_Clock,
221
    GT0_RXUSRCLK_OUT => open,
222
    GT0_RXUSRCLK2_OUT => RX_User_Clock,
223
 
224
    gt0_loopback_in  => loopback_in,
225
    --_________________________________________________________________________
226
    --GT0  (X0Y2)
227
    --____________________________CHANNEL PORTS________________________________
228
    ---------------------------- Channel - DRP Ports  --------------------------
229
    gt0_drpaddr_in                  =>      (others => '0'),
230
    gt0_drpdi_in                    =>      (others => '0'),
231
    gt0_drpdo_out                   =>      open,
232
    gt0_drpen_in                    =>      '0',
233
    gt0_drprdy_out                  =>      open,
234
    gt0_drpwe_in                    =>      '0',
235
 
236
    --------------------- RX Initialization and Reset Ports --------------------
237
    gt0_eyescanreset_in             =>      '0',
238
    gt0_rxuserrdy_in                =>      '1',
239
    -------------------------- RX Margin Analysis Ports ------------------------
240
    gt0_eyescandataerror_out        =>      open,
241
    gt0_eyescantrigger_in           =>      '0',
242
    --------------------------- Digital Monitor Ports --------------------------
243
    gt0_dmonitorout_out             =>      open,
244
 
245
    ------------------ Receive Ports - FPGA RX interface Ports -----------------
246
    gt0_rxdata_out                  =>      Data_Transceiver_Out,
247
    --------------------------- Receive Ports - RX AFE -------------------------
248
    gt0_gthrxp_in                   =>      RX_In_P,
249
    ------------------------ Receive Ports - RX AFE Ports ----------------------
250
    gt0_gthrxn_in                   =>      RX_In_N,
251
    --------------------- Receive Ports - RX Equalizer Ports -------------------
252
    gt0_rxmonitorout_out            =>      open,
253
    gt0_rxmonitorsel_in             =>      (others => '0'),
254
    --------------- Receive Ports - RX Fabric Output Control Ports -------------
255
    gt0_rxoutclkfabric_out          =>      open,
256
    ---------------------- Receive Ports - RX Gearbox Ports --------------------
257
    gt0_rxdatavalid_out             =>      RX_Datavalid_Out,
258
    gt0_rxheader_out                =>      RX_Header_Out,
259
    gt0_rxheadervalid_out           =>      RX_Headervalid_Out,
260
    --------------------- Receive Ports - RX Gearbox Ports  --------------------
261
    gt0_rxgearboxslip_in            =>      RX_Gearboxslip_In,
262
    ------------- Receive Ports - RX Initialization and Reset Ports ------------
263
    gt0_gtrxreset_in                =>      reset,
264
    -------------- Receive Ports -RX Initialization and Reset Ports ------------
265
    gt0_rxresetdone_out             =>      RX_Resetdone_Out,
266
 
267
    --------------------- TX Initialization and Reset Ports --------------------
268
    gt0_gttxreset_in                =>      reset,
269
    gt0_txuserrdy_in                =>      '1',
270
    -------------- Transmit Ports - 64b66b and 64b67b Gearbox Ports ------------
271
    gt0_txheader_in                 =>      TX_Header_In,
272
    ------------------ Transmit Ports - TX Data Path interface -----------------
273
    gt0_txdata_in                   =>      Data_Transceiver_In,
274
    ---------------- Transmit Ports - TX Driver and OOB signaling --------------
275
    gt0_gthtxn_out                  =>      TX_Out_N,
276
    gt0_gthtxp_out                  =>      TX_Out_P,
277
    ----------- Transmit Ports - TX Fabric Clock Output Control Ports ----------
278
    gt0_txoutclkfabric_out          =>      open,
279
    gt0_txoutclkpcs_out             =>      open,
280
    --------------------- Transmit Ports - TX Gearbox Ports --------------------
281
    gt0_txsequence_in               =>      gt0_txsequence_i,
282
    ------------- Transmit Ports - TX Initialization and Reset Ports -----------
283
    gt0_txresetdone_out             =>      TX_Resetdone_Out,
284
    --____________________________COMMON PORTS________________________________
285
    GT0_QPLLLOCK_OUT => open,
286
    GT0_QPLLREFCLKLOST_OUT  => open,
287
    GT0_QPLLOUTCLK_OUT  => open,
288
    GT0_QPLLOUTREFCLK_OUT => open,
289
 
290
    sysclk_in => clk40
291
  );
292
 
293
 
294
  ----------------------------- TX Gearbox sequencer -----------------------------
295
  gt0_data_valid_out_i <=  '1' when ((gt0_txsequence_i /= "0010101") and (gt0_txsequence_i /= "0101011") and (gt0_txsequence_i /= "1000001")) else
296
                                     '0';
297
 
298
  process(TX_User_Clock)
299
  begin
300
    if rising_edge (TX_User_Clock) then
301
           gt0_pause_data_valid_r <=  gt0_data_valid_out_i ;
302
    end if;
303
  end process;
304
 
305
  TX_Gearboxready_Out  <= '1' when (gt0_pause_data_valid_r='1') else '0';
306
 
307
  --____________________________ TXSEQUENCE counter to GT __________________________    
308
  process(TX_User_Clock)
309
  begin
310
    if rising_edge (TX_User_Clock) then
311
      if((reset='1') or (gt0_txseq_counter_r = 66)) then
312
           gt0_txseq_counter_r <=  (others => '0') ;
313
      else
314
           gt0_txseq_counter_r <=  gt0_txseq_counter_r + 1 ;
315
      end if;
316
    end if;
317
  end process;
318
  gt0_txsequence_i         <= std_logic_vector(gt0_txseq_counter_r(6 downto 0));
319
 
320
  -------------------------------- RX Gearbox  ----------------------------------- 
321
  block_sync_sm_0_i  :  entity work.Transceiver_10g_64b67b_BLOCK_SYNC_SM
322
  generic map
323
  (
324
    SH_CNT_MAX          => 64,
325
    SH_INVALID_CNT_MAX  => 16
326
  )
327
  port map
328
  (
329
    -- User Interface
330
    BLOCKSYNC_OUT             =>    open,
331
    RXGEARBOXSLIP_OUT         =>    RX_Gearboxslip_In,
332
    RXHEADER_IN               =>    RX_Header_Out,
333
    RXHEADERVALID_IN          =>    RX_Headervalid_Out,
334
 
335
    -- System Interface
336
    USER_CLK                  =>    RX_User_Clock,
337
    SYSTEM_RESET              =>    reset
338
  );
339
 
340
  ---------------------------- Transmitting side -----------------------------
341
  Interlaken_TX : entity work.Interlaken_Transmitter
342
  generic map(
343
    BurstMax   => BurstMax,      -- Configurable value of BurstMax
344
    BurstShort => BurstShort,    -- Configurable value of BurstShort
345
    PacketLength => PacketLength -- Configurable value of PacketLength
346
  )
347
  port map (
348
    write_clk => clk150,
349
    clk   => TX_User_Clock,
350
    reset => reset,
351
 
352
    TX_Data_In  => TX_Data,
353
    TX_Data_Out(63 downto 0) => Data_Transceiver_In,
354
    TX_Data_Out(66 downto 64) => TX_Header_In,
355
 
356
    TX_SOP          => TX_SOP,
357
    TX_EOP_Valid    => TX_EOP_Valid,
358
    TX_EOP          => TX_EOP,
359
    TX_Channel      => TX_Channel,
360
    TX_Gearboxready => TX_Gearboxready_Out,
361
    TX_Startseq     => TX_Startseq_In,
362
 
363
    FIFO_Write_Data => TX_FIFO_Write,
364
    FIFO_prog_full  => TX_FIFO_progfull,
365
 
366
    TX_FlowControl  => FlowControl,
367
    RX_prog_full    => RX_prog_full,
368
 
369
    Link_up         => Descrambler_locked,
370
    FIFO_Full       => TX_FIFO_Full,
371
 
372
    TX_valid_out    => GT0_DATA_VALID_IN
373
  );
374
 
375
 -- TX_out <= Data_Transceiver_In;
376
 
377
  ---------------------------- Receiving side --------------------------------
378
  Interlaken_RX : entity work.Interlaken_Receiver
379
  generic map (
380
    PacketLength => PacketLength
381
  )
382
  port map (
383
    fifo_read_clk   => clk150,
384
    clk             => RX_User_Clock,
385
    reset           => reset,
386
 
387
    RX_Data_In(63 downto 0) => Data_Transceiver_Out,--Data_Transferred,
388
    RX_Data_In(66 downto 64)=> RX_Header_Out,--Data_Transferred,
389
    RX_Data_Out             => RX_Data,
390
    RX_FIFO_Valid           => RX_FIFO_Valid,
391
 
392
    RX_SOP          => RX_SOP,
393
    RX_EOP_valid    => RX_EOP_Valid,
394
    RX_EOP          => RX_EOP,
395
    RX_FlowControl  => FlowControl,
396
    RX_prog_full    => RX_prog_full,
397
    RX_Channel      => RX_Channel,
398
    RX_Datavalid    => RX_Datavalid_Out,
399
 
400
    Descrambler_Lock=> Descrambler_Locked,
401
    Decoder_Lock    => Decoder_Lock,
402
    CRC24_Error     => CRC24_Error,
403
    CRC32_Error     => CRC32_Error,
404
 
405
    Data_Descrambler => open,
406
    Data_Decoder => open,
407
 
408
    RX_FIFO_Full       => RX_FIFO_Full,
409
    RX_FIFO_Empty      => RX_FIFO_Empty,
410
    RX_FIFO_Read       => RX_FIFO_Read,
411
 
412
    RX_Link_Up      => Link_Up,
413
    Bitslip         => open--RX_Gearboxslip_In
414
  );
415
  Descrambler_Lock <= Descrambler_locked;
416
  -- RX_in <= Data_Transceiver_Out;
417
 
418
end architecture interface;

powered by: WebSVN 2.1.0

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