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

Subversion Repositories saturn

[/] [saturn/] [trunk/] [IPCommunication/] [communication.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 DavidRAMBA
--============================================================================= 
2
--  TITRE : COMMUNICATION
3
--  DESCRIPTION : 
4
--        Implémente la pile communication des MIO de SATURN sans PIC32 
5
--        Le module read_mac maintien les autres modules en reset
6
--        tant que l'adresse MAC n'a pas été récupérée
7
--  FICHIER :        communication.vhd 
8
--=============================================================================
9
--  CREATION 
10
--  DATE              AUTEUR    PROJET  REVISION 
11
--  10/04/2014  DRA        SATURN       V1.0 
12
--=============================================================================
13
--  HISTORIQUE  DES  MODIFICATIONS :
14
--  DATE              AUTEUR    PROJET  REVISION 
15
--=============================================================================
16
 
17
LIBRARY IEEE;
18
USE IEEE.STD_LOGIC_1164.ALL;
19
USE IEEE.STD_LOGIC_ARITH.ALL;
20
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
21
 
22
 
23
ENTITY communication IS
24
   GENERIC (
25
      reg_typemio : STD_LOGIC_VECTOR(7 DOWNTO 0) := x"10";   -- Type du MIO
26
      reg_version : STD_LOGIC_VECTOR(7 DOWNTO 0) := x"10";   -- Version du MIO
27
      ad_ref      : STD_LOGIC_VECTOR(7 DOWNTO 0) := x"80";   -- Adresse des registres à émettre sur trame de synchro
28
      sz_ref      : STD_LOGIC_VECTOR(7 DOWNTO 0) := x"04"    -- Nb otets à émettre sur trame de synchro
29
      );
30
   PORT (
31
      -- Ports système
32
      clk_sys  : IN  STD_LOGIC;                       -- Clock système
33
      rst_n    : IN  STD_LOGIC;                       -- Reset général système
34
      iid      : IN  STD_LOGIC_VECTOR(63 DOWNTO 0);   -- IID du MIO
35
      sync_lock   : OUT STD_LOGIC;
36
 
37
      -- Interfaces séries 1 et 2
38
      rx1       : IN  STD_LOGIC;                      -- Réception série    
39
      tx1       : OUT  STD_LOGIC;                     -- Transmission série
40
      rx2       : IN  STD_LOGIC;                      -- Réception série    
41
      tx2       : OUT  STD_LOGIC;                     -- Transmission série
42
 
43
      -- Bus d'accès à la zone métier du MIO
44
      datout_write: OUT STD_LOGIC_VECTOR(7 downto 0); -- Données à écrire sur l'interface externe
45
      datout_read : IN STD_LOGIC_VECTOR(7 downto 0);  -- Données lues sur l'interface externe
46
      ad_out      : OUT STD_LOGIC_VECTOR(6 downto 0); -- Adresse d'écriture et de lecture des données externe
47
      wr_out      : OUT STD_LOGIC;                    -- Signal d'écriture sur l'interface externe
48
      rd_out      : OUT STD_LOGIC;                    -- Signal de lecture sur l'interface externe
49
 
50
      -- Signaux de pilotage du SPI de la PROM de config du FPGA
51
      reload_fpgan: OUT STD_LOGIC;                    -- Ordre de reconfig du FPGA
52
      spi_csn  : OUT  STD_LOGIC;                      -- CS de la PROM
53
      spi_wpn  : OUT  STD_LOGIC;                      -- Write protect de la PROM
54
      spi_sdo  : OUT  STD_LOGIC;                      -- Serial Data vers la PROM
55
      spi_sdi  : IN  STD_LOGIC;                       -- Serial Data venant de la PROM
56
      spi_clk  : OUT  STD_LOGIC;                       -- clock série vers la PROM
57
                spare      : OUT STD_LOGIC_VECTOR(5 DOWNTO 0)
58
      );
59
END communication;
60
 
61
ARCHITECTURE rtl of communication is
62
   -- Définit le nombre de bit nécessaires pour mesurer la durée du bit le plus lent avec l'horloge système
63
   -- i.e. 1 Bit à 50Kbit/s = 20µs nbbit_div = Log2(96MHz x 20µs)
64
   CONSTANT nbbit_div      : INTEGER := 11;
65
 
66
   -- DFF pour la métastabilité de rx1 et rx2
67
   SIGNAL rx1_r1, rx1_r2 : STD_LOGIC;        -- Pour la metastabilité sur Rx1
68
   SIGNAL rx2_r1, rx2_r2 : STD_LOGIC;        -- Pour la metastabilité sur Rx2
69
 
70
   SIGNAL tc_divclk     : STD_LOGIC_VECTOR(nbbit_div - 1 DOWNTO 0); -- Diviseur d'horloge pour le baud rate
71
   SIGNAL baud_locked   : STD_LOGIC;                     -- Indique que l'autobaudrate a convergé
72
   SIGNAL tid           : STD_LOGIC_VECTOR(7 DOWNTO 0);  -- TID du MIO
73
 
74
   -- Interfaces du SWITCH1
75
   SIGNAL layer1_rx1    : STD_LOGIC_VECTOR(7 DOWNTO 0);  -- Flux de donnée déserialisé (Rx)
76
   SIGNAL layer1_val1   : STD_LOGIC;                     -- Indique un octet valide sur layer1_rx1
77
   SIGNAL sw_ena1       : STD_LOGIC;                     -- Indique qu'on est en réception entre 2 trames sur port 1
78
   SIGNAL layer1_tx1    : STD_LOGIC_VECTOR(7 DOWNTO 0);  -- Flux de donnée à sérialiser (Tx)
79
   SIGNAL layer1_rd1    : STD_LOGIC;                     -- Demande un octet de plus à transmettre
80
   SIGNAL layer1_empty1 : STD_LOGIC;                     -- Indique qu'aucun octet n'est en attente de serialsiation
81
   SIGNAL copy_ena1     : STD_LOGIC;
82
 
83
   -- Interfaces du SWITCH2
84
   SIGNAL layer1_rx2    : STD_LOGIC_VECTOR(7 DOWNTO 0);
85
   SIGNAL layer1_val2   : STD_LOGIC;
86
   SIGNAL sw_ena2       : STD_LOGIC;
87
   SIGNAL layer1_tx2    : STD_LOGIC_VECTOR(7 DOWNTO 0);
88
   SIGNAL layer1_rd2    : STD_LOGIC;
89
   SIGNAL layer1_empty2 : STD_LOGIC;
90
   SIGNAL copy_ena2     : STD_LOGIC;
91
 
92
   -- Interfaces du module LAYER2_RX1
93
   SIGNAL layer2_rx1    : STD_LOGIC_VECTOR(7 DOWNTO 0);  -- Flux de données applicatives destuffé
94
   SIGNAL layer2_rxval1 : STD_LOGIC;                     -- Indique un octet valide sur layer2_rx1
95
   SIGNAL layer2_sof1   : STD_LOGIC;                     -- Indique un  début de trame
96
   SIGNAL layer2_eof1   : STD_LOGIC;                     -- Indqiue une fin de trame
97
   SIGNAL layer2_l2ok1  : STD_LOGIC;                     -- Indique que la trame reçue est correcte
98
 
99
   -- Interfaces du module LAYER2_RX2
100
   SIGNAL layer2_rx2    : STD_LOGIC_VECTOR(7 DOWNTO 0);
101
   SIGNAL layer2_rxval2 : STD_LOGIC;
102
   SIGNAL layer2_sof2   : STD_LOGIC;
103
   SIGNAL layer2_eof2   : STD_LOGIC;
104
   SIGNAL layer2_l2ok2  : STD_LOGIC;
105
 
106
   -- Interfaces du module FRAME_STORE1 (couche applicative)
107
   SIGNAL layer7_rx1       : STD_LOGIC_VECTOR(7 DOWNTO 0);-- Données applicatives reçues sur port 1
108
   SIGNAL layer7_soc1      : STD_LOGIC;                   -- Indique un début de trame
109
   SIGNAL layer7_rd1       : STD_LOGIC;                   -- Signal de lecture d'un octet de plus
110
   SIGNAL layer7_newframe1 : STD_LOGIC;                   -- Indique la réception d'une nouvelle trame
111
   SIGNAL layer7_comdispo1 : STD_LOGIC;                   -- Indique qu'au moins une trame est dispo en mémoire
112
   SIGNAL layer7_l7ok1     : STD_LOGIC;                   -- Indique que la trame reçue est conforme
113
   SIGNAL layer7_overflow1 : STD_LOGIC;                   -- Indique un débordement de mémoire
114
 
115
   -- Interfaces du module FRAME_STORE2
116
   SIGNAL layer7_rx2       : STD_LOGIC_VECTOR(7 DOWNTO 0);
117
   SIGNAL layer7_soc2      : STD_LOGIC;
118
   SIGNAL layer7_rd2       : STD_LOGIC;
119
   SIGNAL layer7_newframe2 : STD_LOGIC;
120
   SIGNAL layer7_comdispo2 : STD_LOGIC;
121
   SIGNAL layer7_l7ok2     : STD_LOGIC;
122
   SIGNAL layer7_overflow2 : STD_LOGIC;
123
 
124
   -- Interface d'écriture des trames à émettre
125
   SIGNAL tx_dat           : STD_LOGIC_VECTOR(7 DOWNTO 0);  -- Donnée applicative à émettre
126
   SIGNAL val_txdat        : STD_LOGIC;                     -- Indique un octet dispo sur tx_dat
127
   SIGNAL tx_sof           : STD_LOGIC;                     -- Indique un début de trame
128
   SIGNAL tx_eof           : STD_LOGIC;                     -- Indique une fin de trame
129
   SIGNAL txdat_free       : STD_LOGIC;                     -- Indique que le module couche transport Tx est dispo
130
   SIGNAL clr_fifo_tx      : STD_LOGIC;                     -- Clear de la FIFO transport Tx
131
 
132
   -- Interfaces du module LAYER2_TX
133
   SIGNAL layer2_txdat     : STD_LOGIC_VECTOR(7 DOWNTO 0);  -- Flux de donnée stuffé + CRC transport
134
   SIGNAL layer2_txval     : STD_LOGIC;                     -- Indique un octet valide sur layer2_txdat
135
   SIGNAL layer2_progfull1 : STD_LOGIC;                     -- La FIFO de données Tx port 1 est presque pleine
136
   SIGNAL layer2_progfull2 : STD_LOGIC;                     -- La FIFO de données Tx port 2 est presque pleine
137
   SIGNAL layer2_full1     : STD_LOGIC;                     -- La FIFO de données Tx port 1 est pleine
138
   SIGNAL layer2_full2     : STD_LOGIC;                     -- La FIFO de données Tx port 2 est pleine
139
 
140
   -- Interface de pilotage du module SPI de programmation de la PROM FPGA
141
   SIGNAL spitx_dat        : STD_LOGIC_VECTOR(7 DOWNTO 0);  -- Data + commande à sérialiser
142
   SIGNAL spitx_val        : STD_LOGIC;                     -- Validant de spitx_dat
143
   SIGNAL spirx_dat        : STD_LOGIC_VECTOR(7 DOWNTO 0);  -- Data reçue
144
   SIGNAL spirx_val        : STD_LOGIC;                     -- Indique des données dispo dans spirx_val
145
   SIGNAL spirx_next       : STD_LOGIC;                     -- Lit un octet de plus dans spirx_val
146
   SIGNAL spi_typecom      : STD_LOGIC;                     -- Type de commande à éxécuter
147
   SIGNAL spi_execcom      : STD_LOGIC;                     -- Ordre d'exécution d'une commande
148
   SIGNAL spi_busy         : STD_LOGIC;                     -- Indique que le module SPI est occupé
149
   SIGNAL spi_nbread       : STD_LOGIC_VECTOR(7 DOWNTO 0);  -- Nombre d 'octets à lire avec une commande de lecture
150
   SIGNAL spi_rstn         : STD_LOGIC;                     -- Reset du module SPI
151
        SIGNAL etat1, etat2        : STD_LOGIC;
152
 
153
        COMPONENT autobaud
154
        PORT(
155
                clk_sys     : IN STD_LOGIC;
156
                rst_n       : IN STD_LOGIC;
157
                rx1         : IN STD_LOGIC;
158
                val_rx1     : IN STD_LOGIC;
159
                eof1        : IN STD_LOGIC;
160
                dat_rx1     : IN  STD_LOGIC_VECTOR(7 DOWNTO 0);
161
      l2_ok1      : IN STD_LOGIC;
162
                rx2         : IN STD_LOGIC;
163
                val_rx2     : IN STD_LOGIC;
164
                eof2        : IN STD_LOGIC;
165
                dat_rx2     : IN  STD_LOGIC_VECTOR(7 DOWNTO 0);
166
      l2_ok2      : IN STD_LOGIC;
167
                tc_divclk   : OUT STD_LOGIC_VECTOR(10 downto 0);
168
                baud_locked : OUT STD_LOGIC
169
                );
170
        END COMPONENT;
171
 
172
        COMPONENT switch
173
   GENERIC (
174
      nbbit_div : INTEGER := 10);
175
        PORT(
176
                clk_sys     : IN STD_LOGIC;
177
                rst_n       : IN STD_LOGIC;
178
      baud_lock   : IN  STD_LOGIC;
179
                tc_divclk   : IN STD_LOGIC_VECTOR(nbbit_div-1 downto 0);
180
                rx          : IN STD_LOGIC;
181
                rx_dat      : OUT STD_LOGIC_VECTOR(7 downto 0);
182
                rx_val      : OUT STD_LOGIC;
183
                tx          : OUT STD_LOGIC;
184
                tx_dat      : IN STD_LOGIC_VECTOR(7 downto 0);
185
                tx_rd       : OUT STD_LOGIC;
186
                tx_empty    : IN STD_LOGIC;
187
                sw_ena      : IN STD_LOGIC;
188
                copy_ena    : IN STD_LOGIC;
189
                etat            : OUT  STD_LOGIC
190
                );
191
        END COMPONENT;
192
 
193
        COMPONENT layer2_rx
194
   GENERIC (
195
      nbbit_div : INTEGER := 10);
196
        PORT(
197
                clk_sys     : IN STD_LOGIC;
198
                rst_n       : IN STD_LOGIC;
199
                tc_divclk   : IN STD_LOGIC_VECTOR(nbbit_div-1 downto 0);
200
                ad_mio      : IN STD_LOGIC_VECTOR(7 downto 0);
201
                dat_in      : IN STD_LOGIC_VECTOR(7 downto 0);
202
                val_in      : IN STD_LOGIC;
203
                dat_out     : OUT STD_LOGIC_VECTOR(7 downto 0);
204
                val_out     : OUT STD_LOGIC;
205
                sw_ena      : OUT STD_LOGIC;
206
                sof         : OUT STD_LOGIC;
207
                eof         : OUT STD_LOGIC;
208
                l2_ok       : OUT STD_LOGIC
209
                );
210
        END COMPONENT;
211
 
212
        COMPONENT frame_store
213
        PORT(
214
                clk_sys     : IN STD_LOGIC;
215
                rst_n       : IN STD_LOGIC;
216
                dat_in      : IN STD_LOGIC_VECTOR(7 downto 0);
217
                val_in      : IN STD_LOGIC;
218
                sof         : IN STD_LOGIC;
219
                eof         : IN STD_LOGIC;
220
                l2_ok       : IN STD_LOGIC;
221
                dat_out     : OUT STD_LOGIC_VECTOR(7 downto 0);
222
      soc_out     : OUT STD_LOGIC;
223
                rd_datout   : IN STD_LOGIC;
224
                new_frame   : OUT STD_LOGIC;
225
                com_dispo   : OUT STD_LOGIC;
226
                l7_ok       : OUT STD_LOGIC;
227
      overflow    : OUT STD_LOGIC
228
                );
229
        END COMPONENT;
230
 
231
        COMPONENT com_exec
232
      GENERIC (
233
      freq_clksys : INTEGER := 48;
234
      reg_typemio : STD_LOGIC_VECTOR(7 DOWNTO 0) := x"10";   -- Type du MIO
235
      reg_version : STD_LOGIC_VECTOR(7 DOWNTO 0) := x"10";   -- Version du MIO
236
      ad_ref      : STD_LOGIC_VECTOR(7 DOWNTO 0) := x"80";
237
      sz_ref      : STD_LOGIC_VECTOR(7 DOWNTO 0) := x"04"
238
      );
239
        PORT(
240
                clk_sys     : IN STD_LOGIC;
241
                rst_n       : IN STD_LOGIC;
242
                tid         : OUT STD_LOGIC_VECTOR(7 downto 0);
243
      iid         : IN  STD_LOGIC_VECTOR(63 downto 0);
244
      sync_lock   : OUT STD_LOGIC;
245
                datout_read : IN STD_LOGIC_VECTOR(7 downto 0);
246
                datout_write: OUT STD_LOGIC_VECTOR(7 downto 0);
247
                ad_out      : OUT STD_LOGIC_VECTOR(6 downto 0);
248
                wr_out      : OUT STD_LOGIC;
249
      rd_out      : OUT STD_LOGIC;
250
                activity1   : IN STD_LOGIC;
251
                activity2   : IN STD_LOGIC;
252
                datin1      : IN STD_LOGIC_VECTOR(7 downto 0);
253
      socin1      : IN STD_LOGIC;
254
                new_frame1  : IN STD_LOGIC;
255
                com_dispo1  : IN STD_LOGIC;
256
                l7_ok1      : IN STD_LOGIC;
257
      l7_overflow1: IN STD_LOGIC;
258
                datin2      : IN STD_LOGIC_VECTOR(7 downto 0);
259
      socin2      : IN STD_LOGIC;
260
                new_frame2  : IN STD_LOGIC;
261
                com_dispo2  : IN STD_LOGIC;
262
                l7_ok2      : IN STD_LOGIC;
263
      l7_overflow2: IN STD_LOGIC;
264
                datsent_free: IN STD_LOGIC;
265
                rd_datin1   : OUT STD_LOGIC;
266
                rd_datin2   : OUT STD_LOGIC;
267
                datsent     : OUT STD_LOGIC_VECTOR(7 downto 0);
268
                valsent     : OUT STD_LOGIC;
269
                sof         : OUT STD_LOGIC;
270
                eof         : OUT STD_LOGIC;
271
      clr_fifo_tx : OUT STD_LOGIC;
272
      copy_ena1   : OUT STD_LOGIC;
273
      copy_ena2   : OUT STD_LOGIC;
274
      reload_fpgan: OUT STD_LOGIC;
275
      spitx_dat   : OUT STD_LOGIC_VECTOR(7 DOWNTO 0);
276
      spitx_val   : OUT STD_LOGIC;
277
      spirx_dat   : IN  STD_LOGIC_VECTOR(7 DOWNTO 0);
278
      spirx_val   : IN  STD_LOGIC;
279
      spirx_next  : OUT STD_LOGIC;
280
      spi_typecom : OUT STD_LOGIC;
281
      spi_execcom : OUT STD_LOGIC;
282
      spi_busy    : IN  STD_LOGIC;
283
      spi_nbread  : OUT STD_LOGIC_VECTOR(7 DOWNTO 0);
284
      spi_rstn    : OUT STD_LOGIC
285
                );
286
        END COMPONENT;
287
 
288
   COMPONENT layer2_tx
289
   PORT(
290
      clk_sys     : IN STD_LOGIC;
291
      rst_n       : IN STD_LOGIC;
292
      dat_in      : IN STD_LOGIC_VECTOR(7 downto 0);
293
      val_in      : IN STD_LOGIC;
294
      sof         : IN STD_LOGIC;
295
      eof         : IN STD_LOGIC;
296
      datin_free  : OUT STD_LOGIC;
297
      dat_out     : OUT STD_LOGIC_VECTOR(7 downto 0);
298
      val_out     : OUT STD_LOGIC;
299
      clr_fifo    : IN   STD_LOGIC;
300
      progfull1   : IN   STD_LOGIC;
301
      progfull2   : IN   STD_LOGIC;
302
      full1       : IN   STD_LOGIC;
303
      empty1      : IN   STD_LOGIC;
304
      full2       : IN   STD_LOGIC;
305
      empty2      : IN   STD_LOGIC
306
      );
307
   END COMPONENT;
308
 
309
   -- La FIFO contient 512 mots, le prog_full est configuré à 500 mots pour laisser une marge de 
310
   -- stockage avant overflow (voir le module layer2_tx)
311
   COMPONENT fifo_tx
312
   PORT (
313
      clk      : IN STD_LOGIC;
314
      srst     : IN STD_LOGIC;
315
      din      : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
316
      wr_en    : IN STD_LOGIC;
317
      rd_en    : IN STD_LOGIC;
318
      dout     : OUT STD_LOGIC_VECTOR(7 DOWNTO 0);
319
      full     : OUT STD_LOGIC;
320
      empty    : OUT STD_LOGIC;
321
      prog_full: OUT STD_LOGIC
322
      );
323
   END COMPONENT;
324
 
325
   COMPONENT if_promspi
326
   GENERIC (
327
      div_rate : INTEGER := 3;      -- Diviseur d'horloge système pour obtenir le débit SPI = 2^div_rate
328
      spiclk_freq : INTEGER := 12
329
      );
330
   PORT(
331
      clk_sys  : IN  std_logic;
332
      rst_n    : IN  std_logic;
333
      spi_csn  : OUT  std_logic;
334
      spi_wpn  : OUT  std_logic;
335
      spi_sdo  : OUT  std_logic;
336
      spi_sdi  : IN  std_logic;
337
      spi_clk  : OUT  std_logic;
338
      tx_dat   : IN  std_logic_vector(7 downto 0);
339
      tx_val   : IN  std_logic;
340
      rx_dat   : OUT  std_logic_vector(7 downto 0);
341
      rx_val   : OUT  std_logic;
342
      rx_next  : IN  std_logic;
343
      type_com : IN  std_logic;
344
      exec_com : IN  std_logic;
345
      spi_busy : OUT  std_logic;
346
      nb_read  : IN  std_logic_vector(7 downto 0)
347
      );
348
    END COMPONENT;
349
 
350
BEGIN
351
        spare <= etat2 & etat1 & sw_ena2 & sw_ena1 & copy_ena2 & copy_ena1;
352
   --------------------------------------------
353
   -- Gestion de la métastbilité de rx1 et rx2
354
   --------------------------------------------
355
   meta : PROCESS(clk_sys, rst_n)
356
   BEGIN
357
      IF (rst_n = '0') THEN
358
         rx1_r1 <= '1';
359
         rx1_r2 <= '1';
360
         rx2_r1 <= '1';
361
         rx2_r2 <= '1';
362
      ELSIF (clk_sys'EVENT and clk_sys = '1') THEN
363
         rx1_r1 <= rx1;
364
         rx1_r2 <= rx1_r1;
365
         rx2_r1 <= rx2;
366
         rx2_r2 <= rx2_r1;
367
      END IF;
368
   END PROCESS;
369
 
370
        inst_autobaud: autobaud
371
   PORT MAP(
372
                clk_sys =>  clk_sys,
373
                rst_n =>    rst_n,
374
                rx1 =>      rx1_r2,
375
                rx2 =>      rx2_r2,
376
                val_rx1 =>  layer1_val1,
377
                dat_rx1 =>  layer1_rx1,
378
      eof1 =>     layer2_eof1,
379
                l2_ok1 =>   layer2_l2ok1,
380
                val_rx2 =>  layer1_val2,
381
      dat_rx2 =>  layer1_rx2,
382
                eof2 =>     layer2_eof2,
383
                l2_ok2 =>   layer2_l2ok2,
384
                tc_divclk => tc_divclk,
385
                baud_locked => baud_locked
386
        );
387
 
388
        inst_switch1: switch
389
   GENERIC MAP (
390
      nbbit_div => nbbit_div)
391
   PORT MAP(
392
                clk_sys =>     clk_sys,
393
                rst_n =>       rst_n,
394
      baud_lock =>   baud_locked,
395
                tc_divclk =>   tc_divclk,
396
                rx =>          rx1_r2,
397
                rx_dat =>      layer1_rx1,
398
                rx_val =>      layer1_val1,
399
                tx =>          tx2,
400
                tx_dat =>      layer1_tx2,
401
                tx_rd =>       layer1_rd2,
402
                tx_empty =>    layer1_empty2,
403
                sw_ena =>      sw_ena1,
404
                copy_ena =>    copy_ena1,
405
                etat => etat1
406
        );
407
 
408
        inst_switch2: switch
409
   GENERIC MAP (
410
      nbbit_div => nbbit_div)
411
   PORT MAP(
412
                clk_sys =>     clk_sys,
413
                rst_n =>       rst_n,
414
      baud_lock =>   baud_locked,
415
                tc_divclk =>   tc_divclk,
416
                rx =>          rx2_r2,
417
                rx_dat =>      layer1_rx2,
418
                rx_val =>      layer1_val2,
419
                tx =>          tx1,
420
                tx_dat =>      layer1_tx1,
421
                tx_rd =>       layer1_rd1,
422
                tx_empty =>    layer1_empty1,
423
                sw_ena =>      sw_ena2,
424
                copy_ena =>    copy_ena2,
425
                etat => etat2
426
        );
427
 
428
        inst_layer2_rx1: layer2_rx
429
   GENERIC MAP (
430
      nbbit_div => nbbit_div)
431
   PORT MAP(
432
                clk_sys =>     clk_sys,
433
                rst_n =>       rst_n,
434
                tc_divclk =>   tc_divclk,
435
      ad_mio =>      tid,
436
                dat_in =>      layer1_rx1,
437
                val_in =>      layer1_val1,
438
                dat_out =>     layer2_rx1,
439
                val_out =>     layer2_rxval1,
440
                sof =>         layer2_sof1,
441
                eof =>         layer2_eof1,
442
                l2_ok =>       layer2_l2ok1,
443
                sw_ena =>      sw_ena1
444
        );
445
 
446
        inst_layer2_rx2: layer2_rx
447
   GENERIC MAP (
448
      nbbit_div => nbbit_div)
449
   PORT MAP(
450
                clk_sys =>     clk_sys,
451
                rst_n =>       rst_n,
452
                tc_divclk =>   tc_divclk,
453
      ad_mio =>      tid,
454
                dat_in =>      layer1_rx2,
455
                val_in =>      layer1_val2,
456
                dat_out =>     layer2_rx2,
457
                val_out =>     layer2_rxval2,
458
                sof =>         layer2_sof2,
459
                eof =>         layer2_eof2,
460
                l2_ok =>       layer2_l2ok2,
461
                sw_ena =>      sw_ena2
462
        );
463
 
464
        inst_frame_store1: frame_store
465
   PORT MAP(
466
                clk_sys =>     clk_sys,
467
                rst_n =>       rst_n,
468
                dat_in =>      layer2_rx1,
469
                val_in =>      layer2_rxval1,
470
                sof =>         layer2_sof1,
471
                eof =>         layer2_eof1,
472
                l2_ok =>       layer2_l2ok1,
473
                dat_out =>     layer7_rx1,
474
      soc_out =>     layer7_soc1,
475
                rd_datout =>   layer7_rd1,
476
                new_frame =>   layer7_newframe1,
477
                com_dispo =>   layer7_comdispo1,
478
                l7_ok =>       layer7_l7ok1,
479
      overflow =>    layer7_overflow1
480
        );
481
 
482
        inst_frame_store2: frame_store
483
   PORT MAP(
484
                clk_sys =>     clk_sys,
485
                rst_n =>       rst_n,
486
                dat_in =>      layer2_rx2,
487
                val_in =>      layer2_rxval2,
488
                sof =>         layer2_sof2,
489
                eof =>         layer2_eof2,
490
                l2_ok =>       layer2_l2ok2,
491
                dat_out =>     layer7_rx2,
492
      soc_out =>     layer7_soc2,
493
                rd_datout =>   layer7_rd2,
494
                new_frame =>   layer7_newframe2,
495
                com_dispo =>   layer7_comdispo2,
496
                l7_ok =>       layer7_l7ok2,
497
      overflow =>    layer7_overflow2
498
        );
499
 
500
   inst_comexec: com_exec
501
   GENERIC MAP(
502
      freq_clksys => 96,
503
      reg_typemio => reg_typemio,
504
      reg_version => reg_version,
505
      ad_ref      => ad_ref,
506
      sz_ref      => sz_ref
507
      )
508
   PORT MAP(
509
      clk_sys     => clk_sys,
510
      rst_n       => rst_n,
511
      tid         => tid,
512
      iid         => iid,
513
      sync_lock   => sync_lock,
514
      datout_write=> datout_write,
515
      datout_read => datout_read,
516
      ad_out      => ad_out,
517
      wr_out      => wr_out,
518
      rd_out      => rd_out,
519
      activity1   => layer2_eof1,
520
      activity2   => layer2_eof2,
521
      datin1      => layer7_rx1,
522
      socin1      => layer7_soc1,
523
      rd_datin1   => layer7_rd1,
524
      new_frame1  => layer7_newframe1,
525
      com_dispo1  => layer7_comdispo1,
526
      l7_ok1      => layer7_l7ok1,
527
      l7_overflow1=> layer7_overflow1,
528
      datin2      => layer7_rx2,
529
      socin2      => layer7_soc2,
530
      rd_datin2   => layer7_rd2,
531
      new_frame2  => layer7_newframe2,
532
      com_dispo2  => layer7_comdispo2,
533
      l7_ok2      => layer7_l7ok2,
534
      l7_overflow2=> layer7_overflow2,
535
      datsent     => tx_dat,
536
      valsent     => val_txdat,
537
      sof         => tx_sof,
538
      eof         => tx_eof,
539
      datsent_free=> txdat_free,
540
      clr_fifo_tx => clr_fifo_tx,
541
      copy_ena1   => copy_ena1,
542
      copy_ena2   => copy_ena2,
543
      reload_fpgan=> reload_fpgan,
544
      spitx_dat   => spitx_dat,
545
      spitx_val   => spitx_val,
546
      spirx_dat   => spirx_dat,
547
      spirx_val   => spirx_val,
548
      spirx_next  => spirx_next,
549
      spi_typecom => spi_typecom,
550
      spi_execcom => spi_execcom,
551
      spi_busy    => spi_busy,
552
      spi_nbread  => spi_nbread,
553
      spi_rstn    => spi_rstn
554
      );
555
 
556
   inst_layer2_tx: layer2_tx
557
   PORT MAP(
558
      clk_sys => clk_sys,
559
      rst_n => rst_n,
560
      dat_in => tx_dat,
561
      val_in => val_txdat,
562
      sof => tx_sof,
563
      eof => tx_eof,
564
      datin_free => txdat_free,
565
      dat_out => layer2_txdat,
566
      val_out => layer2_txval,
567
      clr_fifo => clr_fifo_tx,
568
      progfull1 => layer2_progfull1,
569
      progfull2 => layer2_progfull2,
570
      full1     => layer2_full1,
571
      empty1    => layer1_empty1,
572
      full2     => layer2_full2,
573
      empty2    => layer1_empty2
574
        );
575
 
576
   inst_fifo_tx1 : fifo_tx
577
   PORT MAP (
578
      clk =>   clk_sys,
579
      srst =>  clr_fifo_tx,
580
      din =>   layer2_txdat,
581
      wr_en => layer2_txval,
582
      rd_en => layer1_rd1,
583
      dout =>  layer1_tx1,
584
      full =>  layer2_full1,
585
      empty => layer1_empty1,
586
      prog_full => layer2_progfull1
587
   );
588
 
589
   inst_fifo_tx2 : fifo_tx
590
   PORT MAP (
591
      clk =>   clk_sys,
592
      srst =>  clr_fifo_tx,
593
      din =>   layer2_txdat,
594
      wr_en => layer2_txval,
595
      rd_en => layer1_rd2,
596
      dout =>  layer1_tx2,
597
      full =>  layer2_full2,
598
      empty => layer1_empty2,
599
      prog_full => layer2_progfull2
600
   );
601
 
602
   inst_flash : if_promspi
603
   GENERIC MAP (
604
      div_rate => 3,
605
      spiclk_freq => 12)
606
   PORT MAP (
607
      clk_sys =>  clk_sys,
608
      rst_n =>    spi_rstn,
609
      spi_csn =>  spi_csn,
610
      spi_wpn =>  spi_wpn,
611
      spi_sdo =>  spi_sdo,
612
      spi_sdi =>  spi_sdi,
613
      spi_clk =>  spi_clk,
614
      tx_dat =>   spitx_dat,
615
      tx_val =>   spitx_val,
616
      rx_dat =>   spirx_dat,
617
      rx_val =>   spirx_val,
618
      rx_next =>  spirx_next,
619
      type_com => spi_typecom,
620
      exec_com => spi_execcom,
621
      spi_busy => spi_busy,
622
      nb_read =>  spi_nbread
623
        );
624
 
625
END rtl;
626
 

powered by: WebSVN 2.1.0

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