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

Subversion Repositories rio

[/] [rio/] [branches/] [2.0.0-development/] [rtl/] [vhdl/] [RioSwitch.vhd] - Blame information for rev 51

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 magro732
-------------------------------------------------------------------------------
2
-- 
3
-- RapidIO IP Library Core
4
-- 
5
-- This file is part of the RapidIO IP library project
6
-- http://www.opencores.org/cores/rio/
7
-- 
8
-- Description
9
-- Containing RapidIO packet switching functionality contained in the top
10
-- entity RioSwitch.
11
-- 
12
-- To Do:
13 46 magro732
-- - Add support for portWrite maintenance packets.
14
-- - Add a real crossbar as interconnect.
15
-- - Change the internal addressing to one-hot.
16
-- - Remove acknowledge cycle when transfering packets between ports to double
17
--   the bandwidth.
18
-- - Add hot-swap.
19
-- - Connect linkInitialized to all ports and read it from the source port
20
--   using the interconnect. This will allow alternative routes since the
21
--   sending port can see if a receiving port is up or not.
22
-- - Add support for extended route.
23
-- - Add validity-bit to know if a route has been activly set for a particular
24 48 magro732
--   deviceId. Currently, we rely on that the routing table memory is
25
--   initialized in the enumeration or at device startup.
26 2 magro732
-- 
27
-- Author(s): 
28
-- - Magnus Rosenius, magro732@opencores.org 
29
-- 
30
-------------------------------------------------------------------------------
31
-- 
32
-- Copyright (C) 2013 Authors and OPENCORES.ORG 
33
-- 
34
-- This source file may be used and distributed without 
35
-- restriction provided that this copyright statement is not 
36
-- removed from the file and that any derivative work contains 
37
-- the original copyright notice and the associated disclaimer. 
38
-- 
39
-- This source file is free software; you can redistribute it 
40
-- and/or modify it under the terms of the GNU Lesser General 
41
-- Public License as published by the Free Software Foundation; 
42
-- either version 2.1 of the License, or (at your option) any 
43
-- later version. 
44
-- 
45
-- This source is distributed in the hope that it will be 
46
-- useful, but WITHOUT ANY WARRANTY; without even the implied 
47
-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
48
-- PURPOSE. See the GNU Lesser General Public License for more 
49
-- details. 
50
-- 
51
-- You should have received a copy of the GNU Lesser General 
52
-- Public License along with this source; if not, download it 
53
-- from http://www.opencores.org/lgpl.shtml 
54
-- 
55
-------------------------------------------------------------------------------
56
 
57
 
58
-------------------------------------------------------------------------------
59
-- RioSwitch
60
-------------------------------------------------------------------------------
61
library ieee;
62
use ieee.std_logic_1164.all;
63
use ieee.numeric_std.all;
64
use work.rio_common.all;
65
 
66
-------------------------------------------------------------------------------
67
-- Entity for RioSwitch.
68
-------------------------------------------------------------------------------
69
entity RioSwitch is
70
  generic(
71
    SWITCH_PORTS : natural range 3 to 255 := 4;
72
    DEVICE_IDENTITY : std_logic_vector(15 downto 0);
73
    DEVICE_VENDOR_IDENTITY : std_logic_vector(15 downto 0);
74
    DEVICE_REV : std_logic_vector(31 downto 0);
75
    ASSY_IDENTITY : std_logic_vector(15 downto 0);
76
    ASSY_VENDOR_IDENTITY : std_logic_vector(15 downto 0);
77
    ASSY_REV : std_logic_vector(15 downto 0));
78
  port(
79
    clk : in std_logic;
80
    areset_n : in std_logic;
81
 
82
    writeFrameFull_i : in Array1(SWITCH_PORTS-1 downto 0);
83
    writeFrame_o : out Array1(SWITCH_PORTS-1 downto 0);
84
    writeFrameAbort_o : out Array1(SWITCH_PORTS-1 downto 0);
85
    writeContent_o : out Array1(SWITCH_PORTS-1 downto 0);
86
    writeContentData_o : out Array32(SWITCH_PORTS-1 downto 0);
87
 
88
    readFrameEmpty_i : in Array1(SWITCH_PORTS-1 downto 0);
89
    readFrame_o : out Array1(SWITCH_PORTS-1 downto 0);
90
    readContent_o : out Array1(SWITCH_PORTS-1 downto 0);
91
    readContentEnd_i : in Array1(SWITCH_PORTS-1 downto 0);
92
    readContentData_i : in Array32(SWITCH_PORTS-1 downto 0);
93
 
94
    portLinkTimeout_o : out std_logic_vector(23 downto 0);
95
 
96
    linkInitialized_i : in Array1(SWITCH_PORTS-1 downto 0);
97
    outputPortEnable_o : out Array1(SWITCH_PORTS-1 downto 0);
98
    inputPortEnable_o : out Array1(SWITCH_PORTS-1 downto 0);
99
 
100
    localAckIdWrite_o : out Array1(SWITCH_PORTS-1 downto 0);
101
    clrOutstandingAckId_o : out Array1(SWITCH_PORTS-1 downto 0);
102
    inboundAckId_o : out Array5(SWITCH_PORTS-1 downto 0);
103
    outstandingAckId_o : out Array5(SWITCH_PORTS-1 downto 0);
104
    outboundAckId_o : out Array5(SWITCH_PORTS-1 downto 0);
105
    inboundAckId_i : in Array5(SWITCH_PORTS-1 downto 0);
106
    outstandingAckId_i : in Array5(SWITCH_PORTS-1 downto 0);
107
    outboundAckId_i : in Array5(SWITCH_PORTS-1 downto 0);
108
 
109
    configStb_o : out std_logic;
110
    configWe_o : out std_logic;
111
    configAddr_o : out std_logic_vector(23 downto 0);
112
    configData_o : out std_logic_vector(31 downto 0);
113 47 magro732
    configData_i : in std_logic_vector(31 downto 0);
114
    configAck_i : in std_logic);
115 2 magro732
end entity;
116
 
117
 
118
-------------------------------------------------------------------------------
119
-- Architecture for RioSwitch.
120
-------------------------------------------------------------------------------
121
architecture RioSwitchImpl of RioSwitch is
122
 
123
  component RouteTableInterconnect is
124
    generic(
125
      WIDTH : natural range 1 to 256 := 8);
126
    port(
127
      clk : in std_logic;
128
      areset_n : in std_logic;
129
 
130
      stb_i : in Array1(WIDTH-1 downto 0);
131
      addr_i : in Array16(WIDTH-1 downto 0);
132
      dataM_o : out Array8(WIDTH-1 downto 0);
133
      ack_o : out Array1(WIDTH-1 downto 0);
134
 
135
      stb_o : out std_logic;
136
      addr_o : out std_logic_vector(15 downto 0);
137
      dataS_i : in std_logic_vector(7 downto 0);
138
      ack_i : in std_logic);
139
  end component;
140
 
141
  component SwitchPortInterconnect is
142
    generic(
143
      WIDTH : natural range 1 to 256 := 8);
144
    port(
145
      clk : in std_logic;
146
      areset_n : in std_logic;
147
 
148
      masterCyc_i : in Array1(WIDTH-1 downto 0);
149
      masterStb_i : in Array1(WIDTH-1 downto 0);
150
      masterWe_i : in Array1(WIDTH-1 downto 0);
151
      masterAddr_i : in Array10(WIDTH-1 downto 0);
152
      masterData_i : in Array32(WIDTH-1 downto 0);
153
      masterData_o : out Array1(WIDTH-1 downto 0);
154
      masterAck_o : out Array1(WIDTH-1 downto 0);
155
 
156
      slaveCyc_o : out Array1(WIDTH-1 downto 0);
157
      slaveStb_o : out Array1(WIDTH-1 downto 0);
158
      slaveWe_o : out Array1(WIDTH-1 downto 0);
159
      slaveAddr_o : out Array10(WIDTH-1 downto 0);
160
      slaveData_o : out Array32(WIDTH-1 downto 0);
161
      slaveData_i : in Array1(WIDTH-1 downto 0);
162
      slaveAck_i : in Array1(WIDTH-1 downto 0));
163
  end component;
164
 
165
  component SwitchPortMaintenance is
166
    generic(
167
      SWITCH_PORTS : natural range 0 to 255;
168
      DEVICE_IDENTITY : std_logic_vector(15 downto 0);
169
      DEVICE_VENDOR_IDENTITY : std_logic_vector(15 downto 0);
170
      DEVICE_REV : std_logic_vector(31 downto 0);
171
      ASSY_IDENTITY : std_logic_vector(15 downto 0);
172
      ASSY_VENDOR_IDENTITY : std_logic_vector(15 downto 0);
173
      ASSY_REV : std_logic_vector(15 downto 0));
174
    port(
175
      clk : in std_logic;
176
      areset_n : in std_logic;
177
 
178
      lookupStb_i : in std_logic;
179
      lookupAddr_i : in std_logic_vector(15 downto 0);
180
      lookupData_o : out std_logic_vector(7 downto 0);
181
      lookupAck_o : out std_logic;
182
 
183
      masterCyc_o : out std_logic;
184
      masterStb_o : out std_logic;
185
      masterWe_o : out std_logic;
186
      masterAddr_o : out std_logic_vector(9 downto 0);
187
      masterData_o : out std_logic_vector(31 downto 0);
188
      masterData_i : in std_logic;
189
      masterAck_i : in std_logic;
190
 
191
      slaveCyc_i : in std_logic;
192
      slaveStb_i : in std_logic;
193
      slaveWe_i : in std_logic;
194
      slaveAddr_i : in std_logic_vector(9 downto 0);
195
      slaveData_i : in std_logic_vector(31 downto 0);
196
      slaveData_o : out std_logic;
197
      slaveAck_o : out std_logic;
198
 
199
      lookupStb_o : out std_logic;
200
      lookupAddr_o : out std_logic_vector(15 downto 0);
201
      lookupData_i : in std_logic_vector(7 downto 0);
202
      lookupAck_i : in std_logic;
203
 
204
      portLinkTimeout_o : out std_logic_vector(23 downto 0);
205
 
206
      linkInitialized_i : in Array1(SWITCH_PORTS-1 downto 0);
207
      outputPortEnable_o : out Array1(SWITCH_PORTS-1 downto 0);
208
      inputPortEnable_o : out Array1(SWITCH_PORTS-1 downto 0);
209
      localAckIdWrite_o : out Array1(SWITCH_PORTS-1 downto 0);
210
      clrOutstandingAckId_o : out Array1(SWITCH_PORTS-1 downto 0);
211
      inboundAckId_o : out Array5(SWITCH_PORTS-1 downto 0);
212
      outstandingAckId_o : out Array5(SWITCH_PORTS-1 downto 0);
213
      outboundAckId_o : out Array5(SWITCH_PORTS-1 downto 0);
214
      inboundAckId_i : in Array5(SWITCH_PORTS-1 downto 0);
215
      outstandingAckId_i : in Array5(SWITCH_PORTS-1 downto 0);
216
      outboundAckId_i : in Array5(SWITCH_PORTS-1 downto 0);
217
 
218
      configStb_o : out std_logic;
219
      configWe_o : out std_logic;
220
      configAddr_o : out std_logic_vector(23 downto 0);
221
      configData_o : out std_logic_vector(31 downto 0);
222 47 magro732
      configData_i : in std_logic_vector(31 downto 0);
223
      configAck_i : in std_logic);
224 2 magro732
  end component;
225
 
226
  component SwitchPort is
227
    generic(
228 46 magro732
      MAINTENANCE_LOOKUP : boolean;
229 2 magro732
      PORT_INDEX : natural);
230
    port(
231
      clk : in std_logic;
232
      areset_n : in std_logic;
233
 
234
      masterCyc_o : out std_logic;
235
      masterStb_o : out std_logic;
236
      masterWe_o : out std_logic;
237
      masterAddr_o : out std_logic_vector(9 downto 0);
238
      masterData_o : out std_logic_vector(31 downto 0);
239
      masterData_i : in std_logic;
240
      masterAck_i : in std_logic;
241
 
242
      slaveCyc_i : in std_logic;
243
      slaveStb_i : in std_logic;
244
      slaveWe_i : in std_logic;
245
      slaveAddr_i : in std_logic_vector(9 downto 0);
246
      slaveData_i : in std_logic_vector(31 downto 0);
247
      slaveData_o : out std_logic;
248
      slaveAck_o : out std_logic;
249
 
250
      lookupStb_o : out std_logic;
251
      lookupAddr_o : out std_logic_vector(15 downto 0);
252
      lookupData_i : in std_logic_vector(7 downto 0);
253
      lookupAck_i : in std_logic;
254
 
255
      readFrameEmpty_i : in std_logic;
256
      readFrame_o : out std_logic;
257
      readContent_o : out std_logic;
258
      readContentEnd_i : in std_logic;
259
      readContentData_i : in std_logic_vector(31 downto 0);
260 46 magro732
      writeFramePort_o : out std_logic_vector(9 downto 0);
261 2 magro732
      writeFrameFull_i : in std_logic;
262
      writeFrame_o : out std_logic;
263
      writeFrameAbort_o : out std_logic;
264
      writeContent_o : out std_logic;
265
      writeContentData_o : out std_logic_vector(31 downto 0));
266
  end component;
267
 
268
  signal masterLookupStb : Array1(SWITCH_PORTS downto 0);
269
  signal masterLookupAddr : Array16(SWITCH_PORTS downto 0);
270
  signal masterLookupData : Array8(SWITCH_PORTS downto 0);
271
  signal masterLookupAck : Array1(SWITCH_PORTS downto 0);
272
 
273
  signal slaveLookupStb : std_logic;
274
  signal slaveLookupAddr : std_logic_vector(15 downto 0);
275
  signal slaveLookupData : std_logic_vector(7 downto 0);
276
  signal slaveLookupAck : std_logic;
277
 
278
  signal masterCyc : Array1(SWITCH_PORTS downto 0);
279
  signal masterStb : Array1(SWITCH_PORTS downto 0);
280
  signal masterWe : Array1(SWITCH_PORTS downto 0);
281
  signal masterAddr : Array10(SWITCH_PORTS downto 0);
282
  signal masterDataWrite : Array32(SWITCH_PORTS downto 0);
283
  signal masterDataRead : Array1(SWITCH_PORTS downto 0);
284
  signal masterAck : Array1(SWITCH_PORTS downto 0);
285
 
286
  signal slaveCyc : Array1(SWITCH_PORTS downto 0);
287
  signal slaveStb : Array1(SWITCH_PORTS downto 0);
288
  signal slaveWe : Array1(SWITCH_PORTS downto 0);
289
  signal slaveAddr : Array10(SWITCH_PORTS downto 0);
290
  signal slaveDataWrite : Array32(SWITCH_PORTS downto 0);
291
  signal slaveDataRead : Array1(SWITCH_PORTS downto 0);
292
  signal slaveAck : Array1(SWITCH_PORTS downto 0);
293
 
294
begin
295
 
296
  -----------------------------------------------------------------------------
297
  -- The routing table interconnect.
298
  -----------------------------------------------------------------------------
299
  RouteInterconnect: RouteTableInterconnect
300
    generic map(
301
      WIDTH=>SWITCH_PORTS+1)
302
    port map(
303
      clk=>clk, areset_n=>areset_n,
304
      stb_i=>masterLookupStb, addr_i=>masterLookupAddr,
305
      dataM_o=>masterLookupData, ack_o=>masterLookupAck,
306
      stb_o=>slaveLookupStb, addr_o=>slaveLookupAddr,
307
      dataS_i=>slaveLookupData, ack_i=>slaveLookupAck);
308
 
309
  -----------------------------------------------------------------------------
310
  -- The port interconnect.
311
  -----------------------------------------------------------------------------
312
  PortInterconnect: SwitchPortInterconnect
313
    generic map(
314
      WIDTH=>SWITCH_PORTS+1)
315
    port map(
316
      clk=>clk, areset_n=>areset_n,
317
      masterCyc_i=>masterCyc, masterStb_i=>masterStb, masterWe_i=>masterWe, masterAddr_i=>masterAddr,
318
      masterData_i=>masterDataWrite, masterData_o=>masterDataRead, masterAck_o=>masterAck,
319
      slaveCyc_o=>slaveCyc, slaveStb_o=>slaveStb, slaveWe_o=>slaveWe, slaveAddr_o=>slaveAddr,
320
      slaveData_o=>slaveDataWrite, slaveData_i=>slaveDataRead, slaveAck_i=>slaveAck);
321
 
322
  -----------------------------------------------------------------------------
323
  -- Data relaying port instantiation.
324
  -----------------------------------------------------------------------------
325
  PortGeneration: for portIndex in 0 to SWITCH_PORTS-1 generate
326
    PortInst: SwitchPort
327
      generic map(
328 46 magro732
        MAINTENANCE_LOOKUP=>false,
329 2 magro732
        PORT_INDEX=>portIndex)
330
      port map(
331
        clk=>clk, areset_n=>areset_n,
332 51 magro732
        masterCyc_o=>masterCyc(portIndex),
333
        masterStb_o=>masterStb(portIndex),
334
        masterWe_o=>masterWe(portIndex),
335
        masterAddr_o=>masterAddr(portIndex),
336 2 magro732
        masterData_o=>masterDataWrite(portIndex),
337 51 magro732
        masterData_i=>masterDataRead(portIndex),
338
        masterAck_i=>masterAck(portIndex),
339
        slaveCyc_i=>slaveCyc(portIndex),
340
        slaveStb_i=>slaveStb(portIndex),
341
        slaveWe_i=>slaveWe(portIndex),
342
        slaveAddr_i=>slaveAddr(portIndex),
343 2 magro732
        slaveData_i=>slaveDataWrite(portIndex),
344 51 magro732
        slaveData_o=>slaveDataRead(portIndex),
345
        slaveAck_o=>slaveAck(portIndex),
346 2 magro732
        lookupStb_o=>masterLookupStb(portIndex),
347
        lookupAddr_o=>masterLookupAddr(portIndex),
348 51 magro732
        lookupData_i=>masterLookupData(portIndex),
349
        lookupAck_i=>masterLookupAck(portIndex),
350
        readFrameEmpty_i=>readFrameEmpty_i(portIndex),
351
        readFrame_o=>readFrame_o(portIndex),
352
        readContent_o=>readContent_o(portIndex),
353
        readContentEnd_i=>readContentEnd_i(portIndex),
354
        readContentData_i=>readContentData_i(portIndex),
355 46 magro732
        writeFramePort_o=>open,
356 51 magro732
        writeFrameFull_i=>writeFrameFull_i(portIndex),
357
        writeFrame_o=>writeFrame_o(portIndex),
358
        writeFrameAbort_o=>writeFrameAbort_o(portIndex),
359
        writeContent_o=>writeContent_o(portIndex),
360 2 magro732
        writeContentData_o=>writeContentData_o(portIndex));
361
  end generate;
362
 
363
  -----------------------------------------------------------------------------
364
  -- Maintenance port instantiation.
365
  -----------------------------------------------------------------------------
366
  MaintenancePort: SwitchPortMaintenance
367
    generic map(
368
      SWITCH_PORTS=>SWITCH_PORTS,
369
      DEVICE_IDENTITY=>DEVICE_IDENTITY,
370
      DEVICE_VENDOR_IDENTITY=>DEVICE_VENDOR_IDENTITY,
371
      DEVICE_REV=>DEVICE_REV,
372
      ASSY_IDENTITY=>ASSY_IDENTITY,
373
      ASSY_VENDOR_IDENTITY=>ASSY_VENDOR_IDENTITY,
374
      ASSY_REV=>ASSY_REV)
375
    port map(
376
      clk=>clk, areset_n=>areset_n,
377
      lookupStb_i=>slaveLookupStb, lookupAddr_i=>slaveLookupAddr,
378
      lookupData_o=>slaveLookupData, lookupAck_o=>slaveLookupAck,
379
      masterCyc_o=>masterCyc(SWITCH_PORTS), masterStb_o=>masterStb(SWITCH_PORTS),
380
      masterWe_o=>masterWe(SWITCH_PORTS), masterAddr_o=>masterAddr(SWITCH_PORTS),
381
      masterData_o=>masterDataWrite(SWITCH_PORTS),
382
      masterData_i=>masterDataRead(SWITCH_PORTS), masterAck_i=>masterAck(SWITCH_PORTS),
383
      slaveCyc_i=>slaveCyc(SWITCH_PORTS), slaveStb_i=>slaveStb(SWITCH_PORTS),
384
      slaveWe_i=>slaveWe(SWITCH_PORTS), slaveAddr_i=>slaveAddr(SWITCH_PORTS),
385
      slaveData_i=>slaveDataWrite(SWITCH_PORTS),
386
      slaveData_o=>slaveDataRead(SWITCH_PORTS), slaveAck_o=>slaveAck(SWITCH_PORTS),
387
      lookupStb_o=>masterLookupStb(SWITCH_PORTS),
388
      lookupAddr_o=>masterLookupAddr(SWITCH_PORTS),
389
      lookupData_i=>masterLookupData(SWITCH_PORTS), lookupAck_i=>masterLookupAck(SWITCH_PORTS),
390
      portLinkTimeout_o=>portLinkTimeout_o,
391
      linkInitialized_i=>linkInitialized_i,
392
      outputPortEnable_o=>outputPortEnable_o, inputPortEnable_o=>inputPortEnable_o,
393
      localAckIdWrite_o=>localAckIdWrite_o, clrOutstandingAckId_o=>clrOutstandingAckId_o,
394
      inboundAckId_o=>inboundAckId_o, outstandingAckId_o=>outstandingAckId_o,
395
      outboundAckId_o=>outboundAckId_o, inboundAckId_i=>inboundAckId_i,
396
      outstandingAckId_i=>outstandingAckId_i, outboundAckId_i=>outboundAckId_i,
397
      configStb_o=>configStb_o, configWe_o=>configWe_o, configAddr_o=>configAddr_o,
398 47 magro732
      configData_o=>configData_o, configData_i=>configData_i, configAck_i=>configAck_i);
399 2 magro732
 
400
end architecture;
401
 
402
 
403
 
404
-------------------------------------------------------------------------------
405 46 magro732
-- SwitchPort.
406 2 magro732
-------------------------------------------------------------------------------
407
library ieee;
408
use ieee.std_logic_1164.all;
409
use ieee.numeric_std.all;
410
use work.rio_common.all;
411
 
412
 
413
-------------------------------------------------------------------------------
414
-- Entity for SwitchPort.
415
-------------------------------------------------------------------------------
416
entity SwitchPort is
417
  generic(
418 46 magro732
    MAINTENANCE_LOOKUP : boolean;
419 2 magro732
    PORT_INDEX : natural);
420
  port(
421
    clk : in std_logic;
422
    areset_n : in std_logic;
423
 
424
    -- Master port signals.
425
    -- Write frames to other ports.
426
    masterCyc_o : out std_logic;
427
    masterStb_o : out std_logic;
428
    masterWe_o : out std_logic;
429
    masterAddr_o : out std_logic_vector(9 downto 0);
430
    masterData_o : out std_logic_vector(31 downto 0);
431
    masterData_i : in std_logic;
432
    masterAck_i : in std_logic;
433
 
434
    -- Slave port signals.
435
    -- Receives frames from other ports.
436
    slaveCyc_i : in std_logic;
437
    slaveStb_i : in std_logic;
438
    slaveWe_i : in std_logic;
439
    slaveAddr_i : in std_logic_vector(9 downto 0);
440
    slaveData_i : in std_logic_vector(31 downto 0);
441
    slaveData_o : out std_logic;
442
    slaveAck_o : out std_logic;
443
 
444
    -- Address-lookup interface.
445
    lookupStb_o : out std_logic;
446
    lookupAddr_o : out std_logic_vector(15 downto 0);
447
    lookupData_i : in std_logic_vector(7 downto 0);
448
    lookupAck_i : in std_logic;
449
 
450
    -- Physical port frame buffer interface.
451
    readFrameEmpty_i : in std_logic;
452
    readFrame_o : out std_logic;
453
    readContent_o : out std_logic;
454
    readContentEnd_i : in std_logic;
455
    readContentData_i : in std_logic_vector(31 downto 0);
456 46 magro732
    writeFramePort_o : out std_logic_vector(7 downto 0);
457 2 magro732
    writeFrameFull_i : in std_logic;
458
    writeFrame_o : out std_logic;
459
    writeFrameAbort_o : out std_logic;
460
    writeContent_o : out std_logic;
461
    writeContentData_o : out std_logic_vector(31 downto 0));
462
end entity;
463
 
464
 
465
-------------------------------------------------------------------------------
466
-- Architecture for SwitchPort.
467
-------------------------------------------------------------------------------
468
architecture SwitchPortImpl of SwitchPort is
469
 
470
  type MasterStateType is (STATE_IDLE,
471
                           STATE_WAIT_HEADER_0, STATE_READ_HEADER_0,
472
                           STATE_READ_PORT_LOOKUP,
473
                           STATE_READ_TARGET_PORT,
474
                           STATE_WAIT_TARGET_PORT,
475
                           STATE_WAIT_TARGET_WRITE,
476
                           STATE_WAIT_COMPLETE);
477
  signal masterState : MasterStateType;
478 46 magro732
  alias ftype : std_logic_vector(3 downto 0) is readContentData_i(19 downto 16);
479
  alias tt : std_logic_vector(1 downto 0) is readContentData_i(21 downto 20);
480
 
481 2 magro732
  type SlaveStateType is (STATE_IDLE, STATE_SEND_ACK);
482
  signal slaveState : SlaveStateType;
483
 
484
begin
485
 
486
  -----------------------------------------------------------------------------
487
  -- Master interface process.
488
  -----------------------------------------------------------------------------
489
  Master: process(clk, areset_n)
490
  begin
491
    if (areset_n = '0') then
492
      masterState <= STATE_IDLE;
493
 
494
      lookupStb_o <= '0';
495
      lookupAddr_o <= (others => '0');
496
 
497
      masterCyc_o <= '0';
498
      masterStb_o <= '0';
499
      masterWe_o <= '0';
500
      masterAddr_o <= (others => '0');
501
      masterData_o <= (others => '0');
502
 
503
      readContent_o <= '0';
504
      readFrame_o <= '0';
505
    elsif (clk'event and clk = '1') then
506
      readContent_o <= '0';
507
      readFrame_o <= '0';
508
 
509
      case masterState is
510
 
511
        when STATE_IDLE =>
512
          ---------------------------------------------------------------------
513
          -- Wait for a new packet or content of a new packet.
514
          ---------------------------------------------------------------------
515
 
516
          -- Reset bus signals.
517
          masterCyc_o <= '0';
518
          masterStb_o <= '0';
519
 
520
          -- Wait for frame content to be available.
521
          -- Use different signals to trigger the forwarding of packets depending
522
          -- on the switch philosofy.
523
          if (readFrameEmpty_i = '0') then
524
            readContent_o <= '1';
525
            masterState <= STATE_WAIT_HEADER_0;
526
          end if;
527
 
528
        when STATE_WAIT_HEADER_0 =>
529
          ---------------------------------------------------------------------
530
          -- Wait for the frame buffer output to be updated.
531
          ---------------------------------------------------------------------
532
 
533
          -- Wait for frame buffer output to be updated.
534
          masterState <= STATE_READ_HEADER_0;
535
 
536
        when STATE_READ_HEADER_0 =>
537
          ---------------------------------------------------------------------
538
          -- Check the FTYPE and forward it to the maintenance port if it is a
539
          -- maintenance packet. Otherwise, initiate an address lookup and wait
540
          -- for the result.
541
          ---------------------------------------------------------------------
542
 
543
          -- Check if the frame has ended.
544
          if (readContentEnd_i = '0') then
545
            -- The frame has not ended.
546
            -- This word contains the header and the source id.
547
 
548
            -- Read the tt-field to check the source and destination id size.
549
            if (tt = "01") then
550
              -- This frame contains 16-bit addresses.
551
 
552
              -- Read the new content.
553
              readContent_o <= '1';
554
 
555
              -- Save the content of the header and destination.
556
              masterData_o <= readContentData_i;
557
 
558
              -- Check if this is a maintenance frame.
559 46 magro732
              if ((not MAINTENANCE_LOOKUP) and (ftype = FTYPE_MAINTENANCE_CLASS)) then
560 2 magro732
                -- This is a maintenance frame.
561
 
562
                -- Always route these frames to the maintenance module in the
563
                -- switch by setting the MSB bit of the port address.
564
                masterAddr_o <= '1' & std_logic_vector(to_unsigned(PORT_INDEX, 8)) & '0';
565
 
566
                -- Start an access to the maintenance port.
567
                masterState <= STATE_READ_TARGET_PORT;
568
              else
569
                -- This is not a maintenance frame.
570
 
571
                -- Lookup the destination address and proceed to wait for the
572
                -- result.
573
                lookupStb_o <= '1';
574
                lookupAddr_o <= readContentData_i(15 downto 0);
575
 
576
                -- Wait for the port lookup to return a result.
577
                masterState <= STATE_READ_PORT_LOOKUP;
578
              end if;
579
            else
580
              -- Unsupported tt-value, discard the frame.
581
              readFrame_o <= '1';
582
              masterState <= STATE_IDLE;
583
            end if;
584
          else
585
            -- End of frame.
586
            -- The frame is too short to contain a valid frame. Discard it.
587
            readFrame_o <= '1';
588
            masterState <= STATE_IDLE;
589
          end if;
590
 
591
        when STATE_READ_PORT_LOOKUP =>
592
          ---------------------------------------------------------------------
593
          -- Wait for the address lookup to be complete.
594
          ---------------------------------------------------------------------
595
 
596
          -- Wait for the routing table to complete the request.
597
          if (lookupAck_i = '1') then
598
            -- The address lookup is complete.
599
 
600
            -- Terminate the lookup cycle.
601
            lookupStb_o <= '0';
602
 
603
            -- Proceed to read the target port.
604
            masterAddr_o <= '0' & lookupData_i & '0';
605
            masterState <= STATE_READ_TARGET_PORT;
606
          else
607
            -- Wait until the address lookup is complete.
608
            -- REMARK: Timeout here???
609
          end if;
610
 
611
        when STATE_READ_TARGET_PORT =>
612
          ---------------------------------------------------------------------
613
          -- Initiate an access to the target port.
614
          ---------------------------------------------------------------------
615
 
616
          -- Read the status of the target port using the result from the
617
          -- lookup in the routing table.
618
          masterCyc_o <= '1';
619
          masterStb_o <= '1';
620
          masterWe_o <= '0';
621
          masterState <= STATE_WAIT_TARGET_PORT;
622
 
623
        when STATE_WAIT_TARGET_PORT =>
624
          ---------------------------------------------------------------------
625
          -- Wait to get access to the target port. When the port is ready
626
          -- check if it is ready to accept a new frame. If it cannot accept a
627
          -- new frame, terminate the access and go back and start a new one.
628
          -- This is to free the interconnect to let other ports access it if
629
          -- it is a shared bus. If the port is ready, initiate a write access
630
          -- to the selected port.
631
          ---------------------------------------------------------------------
632
 
633
          -- Wait for the target port to complete the request.
634
          if (masterAck_i = '1') then
635
            -- Target port has completed the request.
636
 
637
            -- Check the status of the target port.
638
            if (masterData_i = '0') then
639
              -- The target port has empty buffers to receive the frame.
640
 
641
              -- Hold the bus with cyc until the cycle is complete.
642
              -- Write the first word of the frame to the target port.
643
              -- The masterData_o has already been assigned.
644
              masterCyc_o <= '1';
645
              masterStb_o <= '1';
646
              masterWe_o <= '1';
647
              masterAddr_o(0) <= '1';
648
 
649
              -- Change state to transfer the frame.
650
              masterState <= STATE_WAIT_TARGET_WRITE;
651
            else
652
              -- The target port has no empty buffer to receive the frame.
653
              -- Terminate the cycle and retry later.
654
              masterCyc_o <= '0';
655
              masterStb_o <= '0';
656
              masterState <= STATE_READ_TARGET_PORT;
657
            end if;
658
          else
659
            -- Target port has not completed the request.
660
            -- Dont to anything.
661
          end if;
662
 
663
        when STATE_WAIT_TARGET_WRITE =>
664
          ---------------------------------------------------------------------
665
          -- Wait for the write access to complete. When complete, write the
666
          -- next content and update the content to the next. If the frame does
667
          -- not have any more data ready, terminate the access but keep the
668
          -- cycle active and proceed to wait for new data.
669
          ---------------------------------------------------------------------
670
 
671
          -- Wait for the target port to complete the request.
672 48 magro732
          -- REMARK: Remove the ack-condition to increase performance, we know
673
          -- that the write takes one cycle.
674 2 magro732
          if (masterAck_i = '1') then
675
            -- The target port is ready.
676
 
677
            -- Check if the frame has ended.
678
            if (readContentEnd_i = '0') then
679
              -- The frame has not ended.
680
 
681
              -- There are more data to transfer.
682
              masterData_o <= readContentData_i;
683
              readContent_o <= '1';
684
            else
685
              -- There are no more data to transfer.
686
 
687
              -- Update to the next frame.
688
              readFrame_o <= '1';
689
 
690
              -- Tell the target port that the frame is complete.
691
              masterWe_o <= '1';
692
              masterAddr_o(0) <= '0';
693
              masterData_o <= x"00000001";
694
 
695
              -- Change state to wait for the target port to finalize the write
696
              -- of the full frame.
697
              masterState <= STATE_WAIT_COMPLETE;
698
            end if;
699
          else
700
            -- Wait for the target port to reply.
701
            -- Dont do anything.
702
          end if;
703
 
704
        when STATE_WAIT_COMPLETE =>
705
          ---------------------------------------------------------------------
706
          -- Wait for the target port to signal that the frame has been
707
          -- completed.
708
          ---------------------------------------------------------------------
709
 
710
          -- Wait for the target port to complete the final request.
711
          if (masterAck_i = '1') then
712
            -- The target port has finalized the write of the frame.
713
 
714
            -- Reset master bus signals.
715
            masterCyc_o <= '0';
716
            masterStb_o <= '0';
717
            masterState <= STATE_IDLE;
718
          else
719
            -- Wait for the target port to reply.
720
            -- REMARK: Timeout here???
721
          end if;
722
 
723
        when others =>
724
          ---------------------------------------------------------------------
725
          -- 
726
          ---------------------------------------------------------------------
727
      end case;
728
    end if;
729
  end process;
730
 
731
  -----------------------------------------------------------------------------
732
  -- Slave interface process.
733
  -- Addr |  Read  | Write
734
  --    0 |  full  | abort & complete
735
  --    1 |  full  | frameData
736 46 magro732
  -----------------------------------------------------------------------------
737 2 magro732
  writeContentData_o <= slaveData_i;
738
  Slave: process(clk, areset_n)
739
  begin
740
    if (areset_n = '0') then
741
      slaveState <= STATE_IDLE;
742
 
743
      slaveData_o <= '0';
744
 
745 46 magro732
      writeFramePort_o <= (others=>'0');
746 2 magro732
      writeFrame_o <= '0';
747
      writeFrameAbort_o <= '0';
748
      writeContent_o <= '0';
749
    elsif (clk'event and clk = '1') then
750
      writeFrame_o <= '0';
751
      writeFrameAbort_o <= '0';
752
      writeContent_o <= '0';
753
 
754
      case slaveState is
755
 
756
        when STATE_IDLE =>
757
          ---------------------------------------------------------------------
758
          -- Wait for an access from a master.
759
          ---------------------------------------------------------------------
760
 
761
          -- Check if any cycle is active.
762
          if ((slaveCyc_i = '1') and (slaveStb_i = '1')) then
763
            -- Cycle is active.
764
 
765
            -- Check if the cycle is accessing the status- or data address.
766
            if (slaveAddr_i(0) = '0') then
767
              -- Accessing port status address.
768
 
769
              -- Check if writing.
770
              if (slaveWe_i = '1') then
771
                -- Writing the status address.
772
                -- Update the buffering output signals according to the input
773
                -- data.
774 46 magro732
                writeFramePort_o <= slaveAddr_i(8 downto 1);
775 2 magro732
                writeFrame_o <= slaveData_i(0);
776
                writeFrameAbort_o <= slaveData_i(1);
777
              else
778
                -- Reading the status address.
779
                slaveData_o <= writeFrameFull_i;
780
              end if;
781
            else
782
              -- Accessing port data address.
783
 
784
              -- Check if writing.
785
              if (slaveWe_i = '1') then
786
                -- Write frame content into the frame buffer.
787
                writeContent_o <= '1';
788
              else
789
                slaveData_o <= writeFrameFull_i;
790
              end if;
791
            end if;
792
 
793
            -- Change state to send an ack to the master.
794
            slaveState <= STATE_SEND_ACK;
795
          end if;
796
 
797
        when STATE_SEND_ACK =>
798
          ---------------------------------------------------------------------
799
          -- Wait for acknowledge to be received by the master.
800
          ---------------------------------------------------------------------
801
 
802
          -- Go back to the idle state and wait for a new cycle.
803
          slaveState <= STATE_IDLE;
804
 
805
        when others =>
806
          ---------------------------------------------------------------------
807
          -- 
808
          ---------------------------------------------------------------------
809
          null;
810
 
811
      end case;
812
    end if;
813
  end process;
814
 
815
  -- Assign the acknowledge depending on the current slave state.
816
  slaveAck_o <= '1' when (slaveState = STATE_SEND_ACK) else '0';
817
 
818
end architecture;
819
 
820
 
821
 
822 46 magro732
 
823
 
824 2 magro732
-------------------------------------------------------------------------------
825
-- SwitchPortMaintenance
826
-------------------------------------------------------------------------------
827
 
828
library ieee;
829
use ieee.std_logic_1164.all;
830
use ieee.numeric_std.all;
831
use work.rio_common.all;
832
 
833
 
834
-------------------------------------------------------------------------------
835
-- Entity for SwitchPortMaintenance.
836
-------------------------------------------------------------------------------
837
entity SwitchPortMaintenance is
838
  generic(
839
    SWITCH_PORTS : natural range 0 to 255;
840
    DEVICE_IDENTITY : std_logic_vector(15 downto 0);
841
    DEVICE_VENDOR_IDENTITY : std_logic_vector(15 downto 0);
842
    DEVICE_REV : std_logic_vector(31 downto 0);
843
    ASSY_IDENTITY : std_logic_vector(15 downto 0);
844
    ASSY_VENDOR_IDENTITY : std_logic_vector(15 downto 0);
845
    ASSY_REV : std_logic_vector(15 downto 0));
846
  port(
847
    clk : in std_logic;
848
    areset_n : in std_logic;
849
 
850
    -- Routing table port lookup signals.
851
    lookupStb_i : in std_logic;
852
    lookupAddr_i : in std_logic_vector(15 downto 0);
853
    lookupData_o : out std_logic_vector(7 downto 0);
854
    lookupAck_o : out std_logic;
855
 
856
    -- Master port signals.
857
    -- Write frames to other ports.
858
    masterCyc_o : out std_logic;
859
    masterStb_o : out std_logic;
860
    masterWe_o : out std_logic;
861
    masterAddr_o : out std_logic_vector(9 downto 0);
862
    masterData_o : out std_logic_vector(31 downto 0);
863
    masterData_i : in std_logic;
864
    masterAck_i : in std_logic;
865
 
866
    -- Slave port signals.
867
    -- Receives frames from other ports.
868
    slaveCyc_i : in std_logic;
869
    slaveStb_i : in std_logic;
870
    slaveWe_i : in std_logic;
871
    slaveAddr_i : in std_logic_vector(9 downto 0);
872
    slaveData_i : in std_logic_vector(31 downto 0);
873
    slaveData_o : out std_logic;
874
    slaveAck_o : out std_logic;
875
 
876
    -- Address-lookup interface.
877
    lookupStb_o : out std_logic;
878
    lookupAddr_o : out std_logic_vector(15 downto 0);
879
    lookupData_i : in std_logic_vector(7 downto 0);
880
    lookupAck_i : in std_logic;
881
 
882
    -- Port common access interface.
883
    portLinkTimeout_o : out std_logic_vector(23 downto 0);
884
 
885
    -- Port specific access interface.
886
    linkInitialized_i : in Array1(SWITCH_PORTS-1 downto 0);
887
    outputPortEnable_o : out Array1(SWITCH_PORTS-1 downto 0);
888
    inputPortEnable_o : out Array1(SWITCH_PORTS-1 downto 0);
889
    localAckIdWrite_o : out Array1(SWITCH_PORTS-1 downto 0);
890
    clrOutstandingAckId_o : out Array1(SWITCH_PORTS-1 downto 0);
891
    inboundAckId_o : out Array5(SWITCH_PORTS-1 downto 0);
892
    outstandingAckId_o : out Array5(SWITCH_PORTS-1 downto 0);
893
    outboundAckId_o : out Array5(SWITCH_PORTS-1 downto 0);
894
    inboundAckId_i : in Array5(SWITCH_PORTS-1 downto 0);
895
    outstandingAckId_i : in Array5(SWITCH_PORTS-1 downto 0);
896
    outboundAckId_i : in Array5(SWITCH_PORTS-1 downto 0);
897
 
898
    -- Configuration space for implementation-defined space.
899
    configStb_o : out std_logic;
900
    configWe_o : out std_logic;
901
    configAddr_o : out std_logic_vector(23 downto 0);
902
    configData_o : out std_logic_vector(31 downto 0);
903 47 magro732
    configData_i : in std_logic_vector(31 downto 0);
904
    configAck_i : in std_logic);
905 2 magro732
end entity;
906
 
907
 
908
-------------------------------------------------------------------------------
909
-- Architecture for SwitchPort.
910
-------------------------------------------------------------------------------
911
architecture SwitchPortMaintenanceImpl of SwitchPortMaintenance is
912
 
913 46 magro732
  component SwitchPort is
914 2 magro732
    generic(
915 46 magro732
      MAINTENANCE_LOOKUP : boolean;
916
      PORT_INDEX : natural);
917 2 magro732
    port(
918 46 magro732
      clk : in std_logic;
919
      areset_n : in std_logic;
920 2 magro732
 
921 46 magro732
      masterCyc_o : out std_logic;
922
      masterStb_o : out std_logic;
923
      masterWe_o : out std_logic;
924
      masterAddr_o : out std_logic_vector(9 downto 0);
925
      masterData_o : out std_logic_vector(31 downto 0);
926
      masterData_i : in std_logic;
927
      masterAck_i : in std_logic;
928
 
929
      slaveCyc_i : in std_logic;
930
      slaveStb_i : in std_logic;
931
      slaveWe_i : in std_logic;
932
      slaveAddr_i : in std_logic_vector(9 downto 0);
933
      slaveData_i : in std_logic_vector(31 downto 0);
934
      slaveData_o : out std_logic;
935
      slaveAck_o : out std_logic;
936
 
937
      lookupStb_o : out std_logic;
938
      lookupAddr_o : out std_logic_vector(15 downto 0);
939
      lookupData_i : in std_logic_vector(7 downto 0);
940
      lookupAck_i : in std_logic;
941
 
942
      readFrameEmpty_i : in std_logic;
943
      readFrame_o : out std_logic;
944
      readContent_o : out std_logic;
945
      readContentEnd_i : in std_logic;
946
      readContentData_i : in std_logic_vector(31 downto 0);
947
      writeFramePort_o : out std_logic_vector(7 downto 0);
948
      writeFrameFull_i : in std_logic;
949
      writeFrame_o : out std_logic;
950
      writeFrameAbort_o : out std_logic;
951
      writeContent_o : out std_logic;
952
      writeContentData_o : out std_logic_vector(31 downto 0));
953 2 magro732
  end component;
954 46 magro732
 
955
  -----------------------------------------------------------------------------
956
  -- Signals between the port and the packet-queue.
957
  -----------------------------------------------------------------------------
958 2 magro732
 
959 47 magro732
  signal outboundFramePort, outboundFramePort0 : std_logic_vector(7 downto 0);
960 46 magro732
  signal outboundReadFrameEmpty : std_logic;
961
  signal outboundReadFrame : std_logic;
962
  signal outboundReadContent : std_logic;
963
  signal outboundReadContentEnd : std_logic;
964
  signal outboundReadContentData : std_logic_vector(31 downto 0);
965 47 magro732
  signal inboundFramePort, inboundFramePort0 : std_logic_vector(7 downto 0);
966 46 magro732
  signal inboundWriteFrameFull : std_logic;
967
  signal inboundWriteFrame : std_logic;
968
  signal inboundWriteFrameAbort : std_logic;
969
  signal inboundWriteContent : std_logic;
970
  signal inboundWriteContentData : std_logic_vector(31 downto 0);
971 2 magro732
 
972 46 magro732
  -----------------------------------------------------------------------------
973
  -- Signals between the packet-queue and RioLogicalCommon.
974
  -----------------------------------------------------------------------------
975 2 magro732
 
976 46 magro732
  signal inboundReadFrameEmpty : std_logic;
977
  signal inboundReadFrame : std_logic;
978
  signal inboundReadContent : std_logic;
979
  signal inboundReadContentEnd : std_logic;
980
  signal inboundReadContentData : std_logic_vector(31 downto 0);
981
  signal outboundWriteFrameFull : std_logic;
982
  signal outboundWriteFrame : std_logic;
983
  signal outboundWriteFrameAbort : std_logic;
984
  signal outboundWriteContent : std_logic;
985
  signal outboundWriteContentData : std_logic_vector(31 downto 0);
986 2 magro732
 
987 46 magro732
  -----------------------------------------------------------------------------
988
  -- Signals between RioLogicalCommon and PacketHandler.
989
  -----------------------------------------------------------------------------
990 2 magro732
 
991 46 magro732
  signal inboundStb : std_logic;
992 48 magro732
  signal inboundAdr : std_logic_vector(3 downto 0);
993 46 magro732
  signal inboundDat : std_logic_vector(31 downto 0);
994 48 magro732
  signal inboundStall : std_logic;
995 46 magro732
  signal outboundStb : std_logic_vector(0 downto 0);
996 48 magro732
  signal outboundAdr : std_logic_vector(0 downto 0);
997 46 magro732
  signal outboundDat : std_logic_vector(31 downto 0);
998 48 magro732
  signal outboundStall : std_logic_vector(0 downto 0);
999 2 magro732
 
1000 46 magro732
  -----------------------------------------------------------------------------
1001
  -- Signals between PacketHandlers and maintenance controllers.
1002
  -----------------------------------------------------------------------------
1003 2 magro732
 
1004
  signal vc : std_logic;
1005
  signal crf : std_logic;
1006
  signal prio : std_logic_vector(1 downto 0);
1007
  signal tt : std_logic_vector(1 downto 0);
1008 46 magro732
  signal tid : std_logic_vector(7 downto 0);
1009 47 magro732
  signal status : std_logic_vector(3 downto 0);
1010 2 magro732
 
1011 46 magro732
  signal readRequestInbound : std_logic;
1012
  signal writeRequestInbound : std_logic;
1013
  signal readResponseInbound : std_logic;
1014
  signal writeResponseInbound : std_logic;
1015
  signal portWriteInbound : std_logic;
1016
  signal dstIdInbound : std_logic_vector(31 downto 0);
1017
  signal srcIdInbound : std_logic_vector(31 downto 0);
1018 47 magro732
  signal sizeInbound : std_logic_vector(3 downto 0);
1019
  signal statusInbound : std_logic_vector(3 downto 0);
1020 46 magro732
  signal hopInbound : std_logic_vector(7 downto 0);
1021
  signal offsetInbound : std_logic_vector(20 downto 0);
1022
  signal wdptrInbound: std_logic;
1023 47 magro732
  signal payloadLengthInbound : std_logic_vector(2 downto 0);
1024
  signal payloadIndexInbound : std_logic_vector(2 downto 0);
1025
  signal payloadInbound : std_logic_vector(63 downto 0);
1026 46 magro732
  signal doneInbound : std_logic;
1027
 
1028
  signal readRequestOutbound : std_logic;
1029
  signal writeRequestOutbound : std_logic;
1030
  signal readResponseOutbound : std_logic;
1031
  signal writeResponseOutbound : std_logic;
1032
  signal portWriteOutbound : std_logic;
1033
  signal dstIdOutbound : std_logic_vector(31 downto 0);
1034
  signal srcIdOutbound : std_logic_vector(31 downto 0);
1035 47 magro732
  signal statusOutbound : std_logic_vector(3 downto 0);
1036 46 magro732
  signal hopOutbound : std_logic_vector(7 downto 0);
1037 47 magro732
  signal payloadLengthOutbound : std_logic_vector(2 downto 0);
1038
  signal payloadIndexOutbound : std_logic_vector(2 downto 0);
1039
  signal payloadOutbound : std_logic_vector(63 downto 0);
1040 46 magro732
  signal doneOutbound : std_logic;
1041
 
1042
  signal readRequestMaint : std_logic;
1043
  signal writeRequestMaint : std_logic;
1044
  signal readResponseMaint : std_logic;
1045
  signal writeResponseMaint : std_logic;
1046 47 magro732
  signal statusMaint : std_logic_vector(3 downto 0);
1047
  signal payloadLengthMaint : std_logic_vector(2 downto 0);
1048
  signal payloadIndexMaint : std_logic_vector(2 downto 0);
1049
  signal payloadMaint : std_logic_vector(63 downto 0);
1050 46 magro732
  signal doneMaint : std_logic;
1051
 
1052 2 magro732
  -----------------------------------------------------------------------------
1053 46 magro732
  -- 
1054
  -----------------------------------------------------------------------------
1055
 
1056
  signal sendPacket : std_logic;
1057
  signal forwardPacket : std_logic;
1058
 
1059
  -----------------------------------------------------------------------------
1060 2 magro732
  -- Route table access signals.
1061
  -----------------------------------------------------------------------------
1062
 
1063
  signal lookupEnable : std_logic;
1064
  signal lookupAddress : std_logic_vector(10 downto 0);
1065
  signal lookupData : std_logic_vector(7 downto 0);
1066
  signal lookupAck : std_logic;
1067
 
1068
  signal routeTableEnable : std_logic;
1069
  signal routeTableWrite : std_logic;
1070
  signal routeTableAddress : std_logic_vector(10 downto 0);
1071
  signal routeTablePortWrite : std_logic_vector(7 downto 0);
1072
  signal routeTablePortRead : std_logic_vector(7 downto 0);
1073
 
1074
  signal routeTablePortDefault : std_logic_vector(7 downto 0);
1075
 
1076
  -----------------------------------------------------------------------------
1077
  -- Configuration space signals.
1078
  -----------------------------------------------------------------------------
1079 46 magro732
 
1080 47 magro732
  signal configStb, configStbInternal : std_logic;
1081 46 magro732
  signal configWe : std_logic;
1082
  signal configAdr : std_logic_vector(23 downto 0);
1083
  signal configDataWrite : std_logic_vector(31 downto 0);
1084
  signal configDataRead, configDataReadInternal : std_logic_vector(31 downto 0);
1085 47 magro732
  signal configAck, configAckInternal : std_logic;
1086 46 magro732
 
1087 2 magro732
  signal discovered : std_logic;
1088
  signal hostBaseDeviceIdLocked : std_logic;
1089
  signal hostBaseDeviceId : std_logic_vector(15 downto 0);
1090
  signal componentTag : std_logic_vector(31 downto 0);
1091
  signal portLinkTimeout : std_logic_vector(23 downto 0);
1092
  signal outputPortEnable : Array1(SWITCH_PORTS-1 downto 0);
1093
  signal inputPortEnable : Array1(SWITCH_PORTS-1 downto 0);
1094
 
1095
begin
1096
 
1097
  -----------------------------------------------------------------------------
1098 46 magro732
  -- Normal switch port instance interfacing the switch interconnect.
1099 2 magro732
  -----------------------------------------------------------------------------
1100 48 magro732
  -- Note that PORT_INDEX is not used in this instantiation and set to zero.
1101 46 magro732
  PortInst: SwitchPort
1102 2 magro732
    generic map(
1103 46 magro732
      MAINTENANCE_LOOKUP=>true,
1104
      PORT_INDEX=>0)
1105 2 magro732
    port map(
1106 46 magro732
      clk=>clk, areset_n=>areset_n,
1107
      masterCyc_o=>masterCyc_o,
1108
      masterStb_o=>masterStb_o,
1109
      masterWe_o=>masterWe_o,
1110
      masterAddr_o=>masterAddr_o,
1111
      masterData_o=>masterData_o,
1112
      masterData_i=>masterData_i,
1113
      masterAck_i=>masterAck_i,
1114
      slaveCyc_i=>slaveCyc_i,
1115
      slaveStb_i=>slaveStb_i,
1116
      slaveWe_i=>slaveWe_i,
1117
      slaveAddr_i=>slaveAddr_i,
1118
      slaveData_i=>slaveData_i,
1119
      slaveData_o=>slaveData_o,
1120
      slaveAck_o=>slaveAck_o,
1121
      lookupStb_o=>open,
1122
      lookupAddr_o=>open,
1123 47 magro732
      lookupData_i=>outboundFramePort0,
1124 46 magro732
      lookupAck_i=>'1',
1125
      readFrameEmpty_i=>outboundReadFrameEmpty,
1126
      readFrame_o=>outboundReadFrame,
1127
      readContent_o=>outboundReadContent,
1128
      readContentEnd_i=>outboundReadContentEnd,
1129
      readContentData_i=>outboundReadContentData,
1130 47 magro732
      writeFramePort_o=>inboundFramePort0,
1131 46 magro732
      writeFrameFull_i=>inboundWriteFrameFull,
1132
      writeFrame_o=>inboundWriteFrame,
1133
      writeFrameAbort_o=>inboundWriteFrameAbort,
1134
      writeContent_o=>inboundWriteContent,
1135
      writeContentData_o=>inboundWriteContentData);
1136
 
1137 47 magro732
  process(clk)
1138
  begin
1139
    if (clk'event and clk = '1') then
1140
      if (inboundReadFrame = '1') then
1141
        inboundFramePort <= inboundFramePort0;
1142
      end if;
1143
      if (outboundWriteFrame = '1') then
1144
        outboundFramePort0 <= outboundFramePort;
1145
      end if;
1146
    end if;
1147
  end process;
1148
 
1149 46 magro732
  -----------------------------------------------------------------------------
1150
  -- Packet queue.
1151
  -- This queue should only contain one packet.
1152
  -----------------------------------------------------------------------------
1153 48 magro732
  -- REMARK: Use a packet-buffer with a configurable maximum sized packet. The
1154
  -- size of the resulting memory is larger than needed since maintenance
1155
  -- packets never contain more than 8 double-words.
1156 46 magro732
  PacketQueue: RioPacketBuffer
1157
    generic map(SIZE_ADDRESS_WIDTH=>1, CONTENT_ADDRESS_WIDTH=>7)
1158
    port map(
1159
      clk=>clk, areset_n=>areset_n,
1160
      inboundWriteFrameFull_o=>inboundWriteFrameFull,
1161
      inboundWriteFrame_i=>inboundWriteFrame,
1162
      inboundWriteFrameAbort_i=>inboundWriteFrameAbort,
1163
      inboundWriteContent_i=>inboundWriteContent,
1164
      inboundWriteContentData_i=>inboundWriteContentData,
1165
      inboundReadFrameEmpty_o=>inboundReadFrameEmpty,
1166
      inboundReadFrame_i=>inboundReadFrame,
1167
      inboundReadFrameRestart_i=>'0',
1168
      inboundReadFrameAborted_o=>open,
1169
      inboundReadContentEmpty_o=>open,
1170
      inboundReadContent_i=>inboundReadContent,
1171
      inboundReadContentEnd_o=>inboundReadContentEnd,
1172
      inboundReadContentData_o=>inboundReadContentData,
1173
      outboundWriteFrameFull_o=>outboundWriteFrameFull,
1174
      outboundWriteFrame_i=>outboundWriteFrame,
1175
      outboundWriteFrameAbort_i=>outboundWriteFrameAbort,
1176
      outboundWriteContent_i=>outboundWriteContent,
1177
      outboundWriteContentData_i=>outboundWriteContentData,
1178
      outboundReadFrameEmpty_o=>outboundReadFrameEmpty,
1179
      outboundReadFrame_i=>outboundReadFrame,
1180
      outboundReadFrameRestart_i=>'0',
1181
      outboundReadFrameAborted_o=>open,
1182
      outboundReadContentEmpty_o=>open,
1183
      outboundReadContent_i=>outboundReadContent,
1184
      outboundReadContentEnd_o=>outboundReadContentEnd,
1185
      outboundReadContentData_o=>outboundReadContentData);
1186 2 magro732
 
1187
  -----------------------------------------------------------------------------
1188 46 magro732
  -- Logical common packet parser.
1189
  -- This module removes CRC and unpack addresses in the inbound direction and
1190
  -- adds CRC and packs addresses in the outbound direction.
1191 2 magro732
  -----------------------------------------------------------------------------
1192 46 magro732
  LogicalCommon: RioLogicalCommon
1193
    generic map(PORTS=>1)
1194
    port map(
1195
      clk=>clk, areset_n=>areset_n, enable=>'1',
1196
      readFrameEmpty_i=>inboundReadFrameEmpty,
1197
      readFrame_o=>inboundReadFrame,
1198
      readContent_o=>inboundReadContent,
1199
      readContentEnd_i=>inboundReadContentEnd,
1200
      readContentData_i=>inboundReadContentData,
1201
      writeFrameFull_i=>outboundWriteFrameFull,
1202
      writeFrame_o=>outboundWriteFrame,
1203
      writeFrameAbort_o=>outboundWriteFrameAbort,
1204
      writeContent_o=>outboundWriteContent,
1205
      writeContentData_o=>outboundWriteContentData,
1206
      inboundStb_o=>inboundStb,
1207
      inboundAdr_o=>inboundAdr,
1208
      inboundDat_o=>inboundDat,
1209 48 magro732
      inboundStall_i=>inboundStall,
1210
      outboundStb_i=>outboundStb,
1211
      outboundAdr_i=>outboundAdr,
1212 46 magro732
      outboundDat_i=>outboundDat,
1213 48 magro732
      outboundStall_o=>outboundStall);
1214 2 magro732
 
1215 46 magro732
  -----------------------------------------------------------------------------
1216
  -- Inbound maintenance packet parser.
1217
  -- Unpack inbound maintenance packets.
1218
  -----------------------------------------------------------------------------
1219
  payloadIndexInbound <= payloadIndexOutbound when (forwardPacket = '1') else payloadIndexMaint;
1220
  doneInbound <= doneOutbound when (forwardPacket = '1') else doneMaint;
1221
  InboundPacket: MaintenanceInbound
1222 2 magro732
    port map(
1223 46 magro732
      clk=>clk, areset_n=>areset_n, enable=>'1',
1224
      readRequestReady_o=>readRequestInbound,
1225
      writeRequestReady_o=>writeRequestInbound,
1226
      readResponseReady_o=>readResponseInbound,
1227
      writeResponseReady_o=>writeResponseInbound,
1228
      portWriteReady_o=>portWriteInbound,
1229
      vc_o=>vc,
1230
      crf_o=>crf,
1231
      prio_o=>prio,
1232
      tt_o=>tt,
1233
      dstid_o=>dstIdInbound,
1234
      srcid_o=>srcIdInbound,
1235 47 magro732
      size_o=>sizeInbound,
1236
      status_o=>statusInbound,
1237 46 magro732
      tid_o=>tid,
1238
      hop_o=>hopInbound,
1239
      offset_o=>offsetInbound,
1240
      wdptr_o=>wdptrInbound,
1241
      payloadLength_o=>payloadLengthInbound,
1242
      payloadIndex_i=>payloadIndexInbound,
1243
      payload_o=>payloadInbound,
1244
      done_i=>doneInbound,
1245
      inboundStb_i=>inboundStb,
1246
      inboundAdr_i=>inboundAdr,
1247
      inboundDat_i=>inboundDat,
1248 48 magro732
      inboundStall_o=>inboundStall);
1249 46 magro732
 
1250
  -----------------------------------------------------------------------------
1251
  -- Outbound maintenance packet generator.
1252
  -----------------------------------------------------------------------------
1253
  readRequestOutbound <= (readRequestInbound and sendPacket) when (forwardPacket = '1') else '0';
1254
  writeRequestOutbound <= (writeRequestInbound and sendPacket) when (forwardPacket = '1') else '0';
1255
  readResponseOutbound <= (readResponseInbound and sendPacket) when (forwardPacket = '1') else readResponseMaint;
1256
  writeResponseOutbound <= (writeResponseInbound and sendPacket) when (forwardPacket = '1') else writeResponseMaint;
1257
  portWriteOutbound <= (portWriteInbound and sendPacket) when (forwardPacket = '1') else '0';
1258
  srcIdOutbound <= srcIdInbound when (forwardPacket = '1') else dstIdInbound;
1259
  dstIdOutbound <= dstIdInbound when (forwardPacket = '1') else srcIdInbound;
1260 47 magro732
  statusOutbound <= statusInbound when (forwardPacket = '1') else statusMaint;
1261 46 magro732
  hopOutbound <= std_logic_vector(unsigned(hopInbound)-1) when (forwardPacket = '1') else x"ff";
1262
  payloadLengthOutbound <= payloadLengthInbound when (forwardPacket = '1') else payloadLengthMaint;
1263
  payloadOutbound <= payloadInbound when (forwardPacket = '1') else payloadMaint;
1264
  OutboundPacket: MaintenanceOutbound
1265 2 magro732
    port map(
1266 46 magro732
      clk=>clk, areset_n=>areset_n, enable=>'1',
1267
      readRequestReady_i=>readRequestOutbound,
1268
      writeRequestReady_i=>writeRequestOutbound,
1269
      readResponseReady_i=>readResponseOutbound,
1270
      writeResponseReady_i=>writeResponseOutbound,
1271
      portWriteReady_i=>portWriteOutbound,
1272
      vc_i=>vc,
1273
      crf_i=>crf,
1274
      prio_i=>prio,
1275
      tt_i=>tt,
1276
      dstid_i=>dstIdOutbound,
1277
      srcid_i=>srcIdOutbound,
1278 47 magro732
      size_i=>sizeInbound,
1279
      status_i=>statusOutbound,
1280 46 magro732
      tid_i=>tid,
1281
      hop_i=>hopOutbound,
1282
      offset_i=>offsetInbound,
1283 47 magro732
      wdptr_i=>wdptrInbound,
1284 46 magro732
      payloadLength_i=>payloadLengthOutbound,
1285
      payloadIndex_o=>payloadIndexOutbound,
1286
      payload_i=>payloadOutbound,
1287
      done_o=>doneOutbound,
1288 48 magro732
      outboundStb_o=>outboundStb(0),
1289
      outboundAdr_o=>outboundAdr(0),
1290 46 magro732
      outboundDat_o=>outboundDat,
1291 48 magro732
      outboundStall_i=>outboundStall(0));
1292 46 magro732
 
1293 2 magro732
  -----------------------------------------------------------------------------
1294 46 magro732
  -- Main switch maintenance controller.
1295
  -- This controller decides when to forward packets and when to consume and
1296
  -- produce responses instead.
1297
  -- It also determines when portWrite-packets are allowed to be sent.
1298 2 magro732
  -----------------------------------------------------------------------------
1299 46 magro732
  RioSwitchMaintenance: process(clk, areset_n)
1300
    type MasterStateType is (STATE_IDLE,
1301
                             STATE_START_PORT_LOOKUP,
1302 48 magro732
                             STATE_WAIT_PORT_LOOKUP,
1303 46 magro732
                             STATE_WAIT_COMPLETE);
1304
    variable masterState : MasterStateType;
1305 2 magro732
  begin
1306
    if (areset_n = '0') then
1307 46 magro732
      masterState := STATE_IDLE;
1308 2 magro732
 
1309 46 magro732
      sendPacket <= '0';
1310
      forwardPacket <= '0';
1311
      outboundFramePort <= (others=>'0');
1312
 
1313 2 magro732
      lookupStb_o <= '0';
1314
      lookupAddr_o <= (others => '0');
1315
    elsif (clk'event and clk = '1') then
1316
      case masterState is
1317
 
1318
        when STATE_IDLE =>
1319
          ---------------------------------------------------------------------
1320 48 magro732
          -- Wait for frame to be available.
1321 2 magro732
          ---------------------------------------------------------------------
1322 46 magro732
          -- REMARK: Discard erronous frames.
1323
          sendPacket <= '0';
1324
          if (((readRequestInbound = '1') or (writeRequestInbound = '1')) and (hopInbound = x"00")) then
1325
            masterState := STATE_WAIT_COMPLETE;
1326
            forwardPacket <= '0';
1327
            outboundFramePort <= inboundFramePort;
1328 48 magro732
          elsif ((readResponseInbound = '1') or
1329
                 ((readRequestInbound = '1') and (hopInbound /= x"00")) or
1330
                 (writeResponseInbound = '1') or
1331
                 ((writeRequestInbound = '1') and (hopInbound /= x"00")) or
1332 46 magro732
                 (portWriteInbound = '1')) then
1333
            masterState := STATE_START_PORT_LOOKUP;
1334
            forwardPacket <= '1';
1335 2 magro732
          end if;
1336
 
1337
        when STATE_START_PORT_LOOKUP =>
1338
          ---------------------------------------------------------------------
1339 48 magro732
          -- The destination port of the packet should be read from the routing
1340
          -- table.
1341 2 magro732
          ---------------------------------------------------------------------
1342
 
1343
          -- Initiate a port-lookup of the destination address.
1344
          lookupStb_o <= '1';
1345 46 magro732
          lookupAddr_o <= dstIdInbound(15 downto 0);
1346 48 magro732
          masterState := STATE_WAIT_PORT_LOOKUP;
1347 2 magro732
 
1348 48 magro732
        when STATE_WAIT_PORT_LOOKUP =>
1349 2 magro732
          ---------------------------------------------------------------------
1350 48 magro732
          -- Wait for the destination port lookup to complete.
1351 2 magro732
          ---------------------------------------------------------------------
1352
 
1353
          if (lookupAck_i = '1') then
1354
            -- The address lookup is complete.
1355
 
1356
            -- Terminate the lookup cycle.
1357
            lookupStb_o <= '0';
1358
 
1359
            -- Wait for the target port to reply.
1360 46 magro732
            outboundFramePort <= lookupData_i;
1361
            masterState := STATE_WAIT_COMPLETE;
1362 2 magro732
          else
1363
            -- Wait until the address lookup is complete.
1364
            -- REMARK: Timeout here???
1365
          end if;
1366
 
1367
        when STATE_WAIT_COMPLETE =>
1368
          ---------------------------------------------------------------------
1369 48 magro732
          -- Indicate that the packet can be sent and wait for it to be
1370
          -- transmitted.
1371 2 magro732
          ---------------------------------------------------------------------
1372 46 magro732
          sendPacket <= '1';
1373 47 magro732
          if (doneInbound = '1') then
1374 46 magro732
            masterState := STATE_IDLE;
1375 2 magro732
          end if;
1376
 
1377
        when others =>
1378
          ---------------------------------------------------------------------
1379
          -- 
1380
          ---------------------------------------------------------------------
1381
      end case;
1382
    end if;
1383
  end process;
1384
 
1385
  -----------------------------------------------------------------------------
1386 46 magro732
  -- Bridge between the inbound RapidIO maintenance packets to the internal
1387
  -- config-space bus.
1388 2 magro732
  -----------------------------------------------------------------------------
1389 46 magro732
  readRequestMaint <= (readRequestInbound and sendPacket) when (forwardPacket = '0') else '0';
1390
  writeRequestMaint <= (writeRequestInbound and sendPacket) when (forwardPacket = '0') else '0';
1391
  MaintenanceBridge: RioLogicalMaintenance
1392 2 magro732
    port map(
1393 46 magro732
      clk=>clk, areset_n=>areset_n, enable=>'1',
1394
      readRequestReady_i=>readRequestMaint,
1395 47 magro732
      writeRequestReady_i=>writeRequestMaint,
1396
      size_i=>sizeInbound,
1397 46 magro732
      offset_i=>offsetInbound,
1398
      wdptr_i=>wdptrInbound,
1399
      payloadLength_i=>payloadLengthInbound,
1400
      payloadIndex_o=>payloadIndexMaint,
1401
      payload_i=>payloadInbound,
1402
      done_o=>doneMaint,
1403
      readResponseReady_o=>readResponseMaint,
1404 47 magro732
      writeResponseReady_o=>writeResponseMaint,
1405
      status_o=>statusMaint,
1406 46 magro732
      payloadLength_o=>payloadLengthMaint,
1407
      payloadIndex_i=>payloadIndexOutbound,
1408
      payload_o=>payloadMaint,
1409
      done_i=>doneOutbound,
1410
      configStb_o=>configStb,
1411
      configWe_o=>configWe,
1412
      configAdr_o=>configAdr(23 downto 2),
1413
      configDat_o=>configDataWrite,
1414
      configDat_i=>configDataRead,
1415
      configAck_i=>configAck);
1416
  configAdr(1 downto 0) <= "00";
1417 2 magro732
 
1418
  -----------------------------------------------------------------------------
1419 46 magro732
  -- Switch configuration memory.
1420 2 magro732
  -----------------------------------------------------------------------------
1421
  portLinkTimeout_o <= portLinkTimeout;
1422
  outputPortEnable_o <= outputPortEnable;
1423
  inputPortEnable_o <= inputPortEnable;
1424 46 magro732
 
1425
  configStb_o <= '1' when ((configStb = '1') and (configAdr(23 downto 16) /= x"00")) else '0';
1426 47 magro732
  configStbInternal <= '1' when ((configStb = '1') and (configAdr(23 downto 16) = x"00")) else '0';
1427 46 magro732
  configWe_o <= configWe;
1428
  configAddr_o <= configAdr;
1429 2 magro732
  configData_o <= configDataWrite;
1430 47 magro732
  configDataRead <= configData_i when (configStbInternal = '0') else configDataReadInternal;
1431
  configAck <= configAck_i when (configStbInternal = '0') else configAckInternal;
1432 2 magro732
 
1433
  ConfigMemory: process(areset_n, clk)
1434
  begin
1435
    if (areset_n = '0') then
1436
      configDataReadInternal <= (others => '0');
1437 47 magro732
      configAckInternal <= '0';
1438 2 magro732
 
1439
      routeTableEnable <= '1';
1440
      routeTableWrite <= '0';
1441
      routeTableAddress <= (others => '0');
1442
      routeTablePortWrite <= (others => '0');
1443
      routeTablePortDefault <= (others => '0');
1444
 
1445
      discovered <= '0';
1446
 
1447
      hostBaseDeviceIdLocked <= '0';
1448
      hostBaseDeviceId <= (others => '1');
1449
      componentTag <= (others => '0');
1450
 
1451
      portLinkTimeout <= (others => '1');
1452
 
1453
      -- REMARK: These should be set to zero when a port gets initialized...
1454
      outputPortEnable <= (others => '0');
1455
      inputPortEnable <= (others => '0');
1456
 
1457
      localAckIdWrite_o <= (others => '0');
1458
    elsif (clk'event and clk = '1') then
1459
      routeTableWrite <= '0';
1460
      localAckIdWrite_o <= (others => '0');
1461
 
1462 47 magro732
      if (configAckInternal = '0') then
1463
        if (configStbInternal = '1') then
1464
          configAckInternal <= '1';
1465 2 magro732
 
1466 46 magro732
          -- Check if the access is into implementation defined space or if the
1467
          -- access should be handled here.
1468
          if (configAdr(23 downto 16) /= x"00") then
1469
            -- Accessing implementation defined space.
1470
            -- Make an external access and return the resonse.
1471
            configDataReadInternal <= (others=>'0');
1472
          else
1473
            -- Access should be handled here.
1474
 
1475
            case (configAdr) is
1476
              when x"000000" =>
1477
                -----------------------------------------------------------------
1478
                -- Device Identity CAR. Read-only.
1479
                -----------------------------------------------------------------
1480 2 magro732
 
1481 46 magro732
                configDataReadInternal(31 downto 16) <= DEVICE_IDENTITY;
1482
                configDataReadInternal(15 downto 0) <= DEVICE_VENDOR_IDENTITY;
1483
 
1484
              when x"000004" =>
1485
                -----------------------------------------------------------------
1486
                -- Device Information CAR. Read-only.
1487
                -----------------------------------------------------------------
1488 2 magro732
 
1489 46 magro732
                configDataReadInternal(31 downto 0) <= DEVICE_REV;
1490
 
1491
              when x"000008" =>
1492
                -----------------------------------------------------------------
1493
                -- Assembly Identity CAR. Read-only.
1494
                -----------------------------------------------------------------
1495 2 magro732
 
1496 46 magro732
                configDataReadInternal(31 downto 16) <= ASSY_IDENTITY;
1497
                configDataReadInternal(15 downto 0) <= ASSY_VENDOR_IDENTITY;
1498
 
1499
              when x"00000c" =>
1500
                -----------------------------------------------------------------
1501
                -- Assembly Informaiton CAR. Read-only.
1502
                -----------------------------------------------------------------
1503 2 magro732
 
1504 46 magro732
                configDataReadInternal(31 downto 16) <= ASSY_REV;
1505
                configDataReadInternal(15 downto 0) <= x"0100";
1506
 
1507
              when x"000010" =>
1508
                -----------------------------------------------------------------
1509
                -- Processing Element Features CAR. Read-only.
1510
                -----------------------------------------------------------------
1511
 
1512
                -- Bridge.
1513
                configDataReadInternal(31) <= '0';
1514
 
1515
                -- Memory.
1516
                configDataReadInternal(30) <= '0';
1517
 
1518
                -- Processor.
1519
                configDataReadInternal(29) <= '0';
1520
 
1521
                -- Switch.
1522
                configDataReadInternal(28) <= '1';
1523
 
1524
                -- Reserved.
1525
                configDataReadInternal(27 downto 10) <= (others => '0');
1526
 
1527
                -- Extended route table configuration support.
1528
                configDataReadInternal(9) <= '0';
1529
 
1530
                -- Standard route table configuration support.
1531
                configDataReadInternal(8) <= '1';
1532
 
1533
                -- Reserved.
1534
                configDataReadInternal(7 downto 5) <= (others => '0');
1535
 
1536
                -- Common transport large system support.
1537
                configDataReadInternal(4) <= '1';
1538
 
1539
                -- Extended features.
1540
                configDataReadInternal(3) <= '1';
1541
 
1542
                -- Extended addressing support.
1543
                -- Not a processing element.
1544
                configDataReadInternal(2 downto 0) <= "000";
1545
 
1546
              when x"000014" =>
1547
                -----------------------------------------------------------------
1548
                -- Switch Port Information CAR. Read-only.
1549
                -----------------------------------------------------------------
1550 2 magro732
 
1551 46 magro732
                -- Reserved.
1552
                configDataReadInternal(31 downto 16) <= (others => '0');
1553 2 magro732
 
1554 46 magro732
                -- PortTotal.
1555
                configDataReadInternal(15 downto 8) <=
1556
                  std_logic_vector(to_unsigned(SWITCH_PORTS, 8));
1557 2 magro732
 
1558 46 magro732
                -- PortNumber.
1559
                configDataReadInternal(7 downto 0) <= inboundFramePort;
1560
 
1561
              when x"000034" =>
1562
                -----------------------------------------------------------------
1563
                -- Switch Route Table Destination ID Limit CAR.
1564
                -----------------------------------------------------------------
1565 2 magro732
 
1566 46 magro732
                -- Max_destId.
1567
                -- Support 2048 addresses.
1568
                configDataReadInternal(15 downto 0) <= x"0800";
1569
 
1570
              when x"000068" =>
1571
                -----------------------------------------------------------------
1572
                -- Host Base Device ID Lock CSR.
1573
                -----------------------------------------------------------------
1574 2 magro732
 
1575 46 magro732
                if (configWe = '1') then
1576
                  -- Check if this field has been written before.
1577
                  if (hostBaseDeviceIdLocked = '0') then
1578
                    -- The field has not been written.
1579
                    -- Lock the field and set the host base device id.
1580
                    hostBaseDeviceIdLocked <= '1';
1581
                    hostBaseDeviceId <= configDataWrite(15 downto 0);
1582 2 magro732
                  else
1583 46 magro732
                    -- The field has been written.
1584
                    -- Check if the written data is the same as the stored.
1585
                    if (hostBaseDeviceId = configDataWrite(15 downto 0)) then
1586
                      -- Same as stored, reset the value to its initial value.
1587
                      hostBaseDeviceIdLocked <= '0';
1588
                      hostBaseDeviceId <= (others => '1');
1589
                    else
1590
                      -- Not writing the same as the stored value.
1591
                      -- Ignore the write.
1592
                    end if;
1593 2 magro732
                  end if;
1594
                end if;
1595 46 magro732
 
1596
                configDataReadInternal(31 downto 16) <= (others => '0');
1597
                configDataReadInternal(15 downto 0) <= hostBaseDeviceId;
1598
 
1599
              when x"00006c" =>
1600
                -----------------------------------------------------------------
1601
                -- Component TAG CSR.
1602
                -----------------------------------------------------------------
1603 2 magro732
 
1604 46 magro732
                if (configWe = '1') then
1605
                  componentTag <= configDataWrite;
1606
                end if;
1607
 
1608
                configDataReadInternal <= componentTag;
1609
 
1610
              when x"000070" =>
1611
                -----------------------------------------------------------------
1612
                -- Standard Route Configuration Destination ID Select CSR.
1613
                -----------------------------------------------------------------             
1614 2 magro732
 
1615 46 magro732
                if (configWe = '1') then
1616
                  -- Write the address to access the routing table.
1617
                  routeTableAddress <= configDataWrite(10 downto 0);
1618
                end if;
1619
 
1620
                configDataReadInternal(31 downto 11) <= (others => '0');
1621
                configDataReadInternal(10 downto 0) <= routeTableAddress;
1622
 
1623
              when x"000074" =>
1624
                -----------------------------------------------------------------
1625
                -- Standard Route Configuration Port Select CSR.
1626
                -----------------------------------------------------------------
1627 2 magro732
 
1628 46 magro732
                if (configWe = '1') then
1629
                  -- Write the port information for the address selected by the
1630
                  -- above register.
1631
                  routeTableWrite <= '1';
1632
                  routeTablePortWrite <= configDataWrite(7 downto 0);
1633
                end if;
1634 2 magro732
 
1635 46 magro732
                configDataReadInternal(31 downto 8) <= (others => '0');
1636
                configDataReadInternal(7 downto 0) <= routeTablePortRead;
1637
 
1638
              when x"000078" =>
1639
                -----------------------------------------------------------------
1640
                -- Standard Route Default Port CSR.
1641
                -----------------------------------------------------------------
1642 2 magro732
 
1643 46 magro732
                if (configWe = '1') then
1644
                  -- Write the default route device id.
1645
                  routeTablePortDefault <= configDataWrite(7 downto 0);
1646
                end if;
1647
 
1648
                configDataReadInternal(31 downto 8) <= (others => '0');
1649
                configDataReadInternal(7 downto 0) <= routeTablePortDefault;
1650
 
1651
              when x"000100" =>
1652
                -----------------------------------------------------------------
1653
                -- Extended features. LP-Serial Register Block Header.
1654
                -----------------------------------------------------------------
1655 2 magro732
 
1656 46 magro732
                -- One feature only, 0x0003=Generic End Point Free Device.
1657
                configDataReadInternal(31 downto 16) <= x"0000";
1658
                configDataReadInternal(15 downto 0) <= x"0003";
1659
 
1660
              when x"000120" =>
1661
                -----------------------------------------------------------------
1662
                -- Port Link Timeout Control CSR.
1663
                -----------------------------------------------------------------
1664 2 magro732
 
1665 46 magro732
                if (configWe = '1') then
1666
                  portLinkTimeout <= configDataWrite(31 downto 8);
1667
                end if;
1668
 
1669
                configDataReadInternal(31 downto 8) <= portLinkTimeout;
1670
                configDataReadInternal(7 downto 0) <= x"00";
1671
 
1672
              when x"00013c" =>
1673
                -----------------------------------------------------------------
1674
                -- Port General Control CSR.
1675
                -----------------------------------------------------------------
1676 2 magro732
 
1677 46 magro732
                if (configWe = '1') then
1678
                  discovered <= configDataWrite(29);
1679
                end if;
1680
 
1681
                configDataReadInternal(31 downto 30) <= "00";
1682
                configDataReadInternal(29) <= discovered;
1683
                configDataReadInternal(28 downto 0) <= (others => '0');
1684 2 magro732
 
1685 46 magro732
              when others =>
1686
                -----------------------------------------------------------------
1687
                -- Other port specific registers.
1688
                -----------------------------------------------------------------
1689
 
1690
                -- Make sure the output is always set to something.
1691
                configDataReadInternal <= (others=>'0');
1692 2 magro732
 
1693 46 magro732
                -- Iterate through all active ports.
1694
                for portIndex in 0 to SWITCH_PORTS-1 loop
1695 2 magro732
 
1696 46 magro732
                  if(unsigned(configAdr) = (x"000148" + (x"000020"*portIndex))) then
1697
                    -----------------------------------------------------------------
1698
                    -- Port N Local ackID CSR.
1699
                    -----------------------------------------------------------------
1700
                    if (configWe = '1') then
1701
                      localAckIdWrite_o(portIndex) <= '1';
1702
                      clrOutstandingAckId_o(portIndex) <= configDataWrite(31);
1703
                      inboundAckId_o(portIndex) <= configDataWrite(28 downto 24);
1704
                      outstandingAckId_o(portIndex) <= configDataWrite(12 downto 8);
1705
                      outboundAckId_o(portIndex) <= configDataWrite(4 downto 0);
1706
                    end if;
1707
                    configDataReadInternal(31 downto 29) <= (others => '0');
1708
                    configDataReadInternal(28 downto 24) <= inboundAckId_i(portIndex);
1709
                    configDataReadInternal(23 downto 13) <= (others => '0');
1710
                    configDataReadInternal(12 downto 8) <= outstandingAckId_i(portIndex);
1711
                    configDataReadInternal(7 downto 5) <= (others => '0');
1712
                    configDataReadInternal(4 downto 0) <= outboundAckId_i(portIndex);
1713
 
1714
                  elsif(unsigned(configAdr) = (x"000154" + (x"000020"*portIndex))) then
1715
                    -----------------------------------------------------------------
1716
                    -- Port N Control 2 CSR.
1717
                    -----------------------------------------------------------------
1718
                    configDataReadInternal <= (others => '0');
1719
 
1720
                  elsif(unsigned(configAdr) = (x"000158" + (x"000020"*portIndex))) then
1721
                    -----------------------------------------------------------------
1722
                    -- Port N Error and Status CSR.
1723
                    -----------------------------------------------------------------
1724
                    -- Idle Sequence 2 Support.
1725
                    configDataReadInternal(31) <= '0';
1726
 
1727
                    -- Idle Sequence 2 Enable.
1728
                    configDataReadInternal(30) <= '0';
1729
 
1730
                    -- Idle Sequence.
1731
                    configDataReadInternal(29) <= '0';
1732
 
1733
                    -- Reserved.
1734
                    configDataReadInternal(28) <= '0';
1735
 
1736
                    -- Flow Control Mode.
1737
                    configDataReadInternal(27) <= '0';
1738
 
1739
                    -- Reserved.
1740
                    configDataReadInternal(26 downto 21) <= (others => '0');
1741
 
1742
                    -- Output retry-encountered.
1743
                    configDataReadInternal(20) <= '0';
1744
 
1745
                    -- Output retried.
1746
                    configDataReadInternal(19) <= '0';
1747
 
1748
                    -- Output retried-stopped.
1749
                    configDataReadInternal(18) <= '0';
1750
 
1751
                    -- Output error-encountered.
1752
                    configDataReadInternal(17) <= '0';
1753
 
1754
                    -- Output error-stopped.
1755
                    configDataReadInternal(16) <= '0';
1756
 
1757
                    -- Reserved.
1758
                    configDataReadInternal(15 downto 11) <= (others => '0');
1759
 
1760
                    -- Input retry-stopped.
1761
                    configDataReadInternal(10) <= '0';
1762
 
1763
                    -- Input error-encountered.
1764
                    configDataReadInternal(9) <= '0';
1765
 
1766
                    -- Input error-stopped.
1767
                    configDataReadInternal(8) <= '0';
1768 2 magro732
 
1769 46 magro732
                    -- Reserved.
1770
                    configDataReadInternal(7 downto 5) <= (others => '0');
1771 2 magro732
 
1772 46 magro732
                    -- Port-write pending.
1773
                    configDataReadInternal(4) <= '0';
1774
 
1775
                    -- Port unavailable.
1776
                    configDataReadInternal(3) <= '0';
1777
 
1778
                    -- Port error.
1779
                    configDataReadInternal(2) <= '0';
1780
 
1781
                    -- Port OK.
1782
                    configDataReadInternal(1) <= linkInitialized_i(portIndex);
1783
 
1784
                    -- Port uninitialized.
1785
                    configDataReadInternal(0) <= not linkInitialized_i(portIndex);
1786
 
1787
                  elsif(unsigned(configAdr) = (x"00015c" + (x"000020"*portIndex))) then
1788
                    -----------------------------------------------------------------
1789
                    -- Port N Control CSR.
1790
                    -----------------------------------------------------------------
1791
 
1792
                    -- Port Width Support.
1793
                    configDataReadInternal(31 downto 30) <= (others=>'0');
1794 2 magro732
 
1795 46 magro732
                    -- Initialized Port Width.
1796
                    configDataReadInternal(29 downto 27) <= (others=>'0');
1797 2 magro732
 
1798 46 magro732
                    -- Port Width Override.
1799
                    configDataReadInternal(26 downto 24) <= (others=>'0');
1800 2 magro732
 
1801 46 magro732
                    -- Port disable.
1802
                    configDataReadInternal(23) <= '0';
1803
 
1804
                    -- Output Port Enable.
1805
                    if (configWe = '1') then
1806
                      outputPortEnable(portIndex) <= configDataWrite(22);
1807
                    end if;
1808
                    configDataReadInternal(22) <= outputPortEnable(portIndex);
1809
 
1810
                    -- Input Port Enable.
1811
                    if (configWe = '1') then
1812
                      inputPortEnable(portIndex) <= configDataWrite(21);
1813
                    end if;
1814
                    configDataReadInternal(21) <= inputPortEnable(portIndex);
1815 2 magro732
 
1816 46 magro732
                    -- Error Checking Disabled.
1817
                    configDataReadInternal(20) <= '0';
1818
 
1819
                    -- Multicast-event Participant.
1820
                    configDataReadInternal(19) <= '0';
1821
 
1822
                    -- Reserved.
1823
                    configDataReadInternal(18) <= '0';
1824
 
1825
                    -- Enumeration Boundry.
1826
                    configDataReadInternal(17) <= '0';
1827 2 magro732
 
1828 46 magro732
                    -- Reserved.
1829
                    configDataReadInternal(16) <= '0';
1830 2 magro732
 
1831 46 magro732
                    -- Extended Port Width Override.
1832
                    configDataReadInternal(15 downto 14) <= (others=>'0');
1833 2 magro732
 
1834 46 magro732
                    -- Extended Port Width Support.
1835
                    configDataReadInternal(13 downto 12) <= (others=>'0');
1836
 
1837
                    -- Implementation defined.
1838
                    configDataReadInternal(11 downto 4) <= (others=>'0');
1839 2 magro732
 
1840 46 magro732
                    -- Reserved.
1841
                    configDataReadInternal(3 downto 1) <= (others=>'0');
1842 2 magro732
 
1843 46 magro732
                    -- Port Type.
1844
                    configDataReadInternal(0) <= '1';
1845
                  end if;
1846
                end loop;
1847 2 magro732
 
1848 46 magro732
            end case;
1849
          end if;
1850
        else
1851
          -- Config memory not enabled.
1852 2 magro732
        end if;
1853
      else
1854 47 magro732
        configAckInternal <= '0';
1855 2 magro732
      end if;
1856
    end if;
1857
  end process;
1858
 
1859 46 magro732
  -----------------------------------------------------------------------------
1860
  -- Logic implementing the routing table access.
1861
  -----------------------------------------------------------------------------
1862
 
1863
  -- Lookup interface port memory signals.
1864
  lookupEnable <= '1' when (lookupStb_i = '1') and (lookupAddr_i(15 downto 11) = "00000") else '0';
1865
  lookupAddress <= lookupAddr_i(10 downto 0);
1866
  lookupData_o <= lookupData when (lookupEnable = '1') else routeTablePortDefault;
1867
  lookupAck_o <= lookupAck;
1868
  LookupProcess: process(clk, areset_n)
1869
  begin
1870
    if (areset_n = '0') then
1871
      lookupAck <= '0';
1872
    elsif (clk'event and clk = '1') then
1873
      if ((lookupStb_i = '1') and (lookupAck = '0')) then
1874
        lookupAck <= '1';
1875
      else
1876
        lookupAck <= '0';
1877
      end if;
1878
    end if;
1879
  end process;
1880
 
1881
  -- Dual port memory containing the routing table.
1882
  RoutingTable: MemoryDualPort
1883
    generic map(
1884
      ADDRESS_WIDTH=>11, DATA_WIDTH=>8)
1885
    port map(
1886
      clkA_i=>clk, enableA_i=>routeTableEnable, writeEnableA_i=>routeTableWrite,
1887
      addressA_i=>routeTableAddress,
1888
      dataA_i=>routeTablePortWrite, dataA_o=>routeTablePortRead,
1889
      clkB_i=>clk, enableB_i=>lookupEnable,
1890
      addressB_i=>lookupAddress, dataB_o=>lookupData);
1891
 
1892 2 magro732
end architecture;
1893
 
1894
 
1895
-------------------------------------------------------------------------------
1896
-- 
1897
-------------------------------------------------------------------------------
1898
 
1899
library ieee;
1900
use ieee.std_logic_1164.all;
1901
use ieee.numeric_std.all;
1902
use work.rio_common.all;
1903
 
1904
 
1905
-------------------------------------------------------------------------------
1906
-- 
1907
-------------------------------------------------------------------------------
1908
entity RouteTableInterconnect is
1909
  generic(
1910
    WIDTH : natural range 1 to 256 := 8);
1911
  port(
1912
    clk : in std_logic;
1913
    areset_n : in std_logic;
1914
 
1915
    stb_i : in Array1(WIDTH-1 downto 0);
1916
    addr_i : in Array16(WIDTH-1 downto 0);
1917
    dataM_o : out Array8(WIDTH-1 downto 0);
1918
    ack_o : out Array1(WIDTH-1 downto 0);
1919
 
1920
    stb_o : out std_logic;
1921
    addr_o : out std_logic_vector(15 downto 0);
1922
    dataS_i : in std_logic_vector(7 downto 0);
1923
    ack_i : in std_logic);
1924
end entity;
1925
 
1926
 
1927
-------------------------------------------------------------------------------
1928
-- 
1929
-------------------------------------------------------------------------------
1930
architecture RouteTableInterconnectImpl of RouteTableInterconnect is
1931
  signal activeCycle : std_logic;
1932
  signal selectedMaster : natural range 0 to WIDTH-1;
1933
begin
1934
 
1935
  -----------------------------------------------------------------------------
1936
  -- Arbitration.
1937
  -----------------------------------------------------------------------------
1938
  Arbiter: process(areset_n, clk)
1939
  begin
1940
    if (areset_n = '0') then
1941
      activeCycle <= '0';
1942
      selectedMaster <= 0;
1943
    elsif (clk'event and clk = '1') then
1944
      if (activeCycle = '0') then
1945
        for i in 0 to WIDTH-1 loop
1946
          if (stb_i(i) = '1') then
1947
            activeCycle <= '1';
1948
            selectedMaster <= i;
1949
          end if;
1950
        end loop;
1951
      else
1952
        if (stb_i(selectedMaster) = '0') then
1953
          activeCycle <= '0';
1954
        end if;
1955
      end if;
1956
    end if;
1957
  end process;
1958
 
1959
  -----------------------------------------------------------------------------
1960
  -- Interconnection.
1961
  -----------------------------------------------------------------------------
1962
  stb_o <= stb_i(selectedMaster);
1963
  addr_o <= addr_i(selectedMaster);
1964
 
1965
  Interconnect: for i in 0 to WIDTH-1 generate
1966
    dataM_o(i) <= dataS_i;
1967
    ack_o(i) <= ack_i when (selectedMaster = i) else '0';
1968
  end generate;
1969
 
1970
end architecture;
1971
 
1972
 
1973
-------------------------------------------------------------------------------
1974
-- 
1975
-------------------------------------------------------------------------------
1976
 
1977
library ieee;
1978
use ieee.std_logic_1164.all;
1979
use ieee.numeric_std.all;
1980
use work.rio_common.all;
1981
 
1982
 
1983
-------------------------------------------------------------------------------
1984
-- 
1985
-------------------------------------------------------------------------------
1986
entity SwitchPortInterconnect is
1987
  generic(
1988
    WIDTH : natural range 1 to 256 := 8);
1989
  port(
1990
    clk : in std_logic;
1991
    areset_n : in std_logic;
1992
 
1993
    masterCyc_i : in Array1(WIDTH-1 downto 0);
1994
    masterStb_i : in Array1(WIDTH-1 downto 0);
1995
    masterWe_i : in Array1(WIDTH-1 downto 0);
1996
    masterAddr_i : in Array10(WIDTH-1 downto 0);
1997
    masterData_i : in Array32(WIDTH-1 downto 0);
1998
    masterData_o : out Array1(WIDTH-1 downto 0);
1999
    masterAck_o : out Array1(WIDTH-1 downto 0);
2000
 
2001
    slaveCyc_o : out Array1(WIDTH-1 downto 0);
2002
    slaveStb_o : out Array1(WIDTH-1 downto 0);
2003
    slaveWe_o : out Array1(WIDTH-1 downto 0);
2004
    slaveAddr_o : out Array10(WIDTH-1 downto 0);
2005
    slaveData_o : out Array32(WIDTH-1 downto 0);
2006
    slaveData_i : in Array1(WIDTH-1 downto 0);
2007
    slaveAck_i : in Array1(WIDTH-1 downto 0));
2008
end entity;
2009
 
2010
 
2011
-------------------------------------------------------------------------------
2012
-- 
2013
-------------------------------------------------------------------------------
2014
architecture SwitchPortInterconnectImpl of SwitchPortInterconnect is
2015
  --component ChipscopeIcon1 is
2016
  --  port (
2017
  --    CONTROL0 : inout STD_LOGIC_VECTOR ( 35 downto 0 )
2018
  --    );
2019
  --end component;
2020
  --component ChipscopeIlaWb is
2021
  --  port (
2022
  --    CLK : in STD_LOGIC := 'X';
2023
  --    TRIG0 : in STD_LOGIC_VECTOR ( 46 downto 0);
2024
  --    CONTROL : inout STD_LOGIC_VECTOR ( 35 downto 0 ) 
2025
  --    );
2026
  --end component;
2027
  --signal control : std_logic_vector(35 downto 0);
2028
  --signal trig : std_logic_vector(46 downto 0);
2029
 
2030
  signal activeCycle : std_logic;
2031
  signal selectedMaster : natural range 0 to WIDTH-1;
2032
  signal selectedSlave : natural range 0 to WIDTH-1;
2033
 
2034
begin
2035
 
2036
  -----------------------------------------------------------------------------
2037
  -- Arbitration process.
2038
  -----------------------------------------------------------------------------
2039
 
2040
  RoundRobinArbiter: process(areset_n, clk)
2041
    variable index : natural range 0 to WIDTH-1;
2042
  begin
2043
    if (areset_n = '0') then
2044
      activeCycle <= '0';
2045
      selectedMaster <= 0;
2046
    elsif (clk'event and clk = '1') then
2047
      -- Check if a cycle is ongoing.
2048
      if (activeCycle = '0') then
2049
        -- No ongoing cycles.
2050
 
2051
        -- Iterate through all ports and check if any new cycle has started.
2052
        for i in 0 to WIDTH-1 loop
2053
          if ((selectedMaster+i) >= WIDTH) then
2054
            index := (selectedMaster+i) - WIDTH;
2055
          else
2056
            index := (selectedMaster+i);
2057
          end if;
2058
 
2059
          if (masterCyc_i(index) = '1') then
2060
            activeCycle <= '1';
2061
            selectedMaster <= index;
2062
          end if;
2063
        end loop;
2064
      else
2065
        -- Ongoing cycle.
2066
 
2067
        -- Check if the cycle has ended.
2068
        if (masterCyc_i(selectedMaster) = '0') then
2069
          -- Cycle has ended.
2070
          activeCycle <= '0';
2071
 
2072
          -- Check if a new cycle has started from another master.
2073
          -- Start to check from the one that ended its cycle, this way, the
2074
          -- ports will be scheduled like round-robin.
2075
          for i in 0 to WIDTH-1 loop
2076
            if ((selectedMaster+i) >= WIDTH) then
2077
              index := (selectedMaster+i) - WIDTH;
2078
            else
2079
              index := (selectedMaster+i);
2080
            end if;
2081
 
2082
            if (masterCyc_i(index) = '1') then
2083
              activeCycle <= '1';
2084
              selectedMaster <= index;
2085
            end if;
2086
          end loop;
2087
        end if;
2088
      end if;
2089
    end if;
2090
  end process;
2091
 
2092
  -----------------------------------------------------------------------------
2093
  -- Address decoding.
2094
  -----------------------------------------------------------------------------
2095
 
2096
  -- Select the last port when the top bit is set.
2097
  -- The last port must be the maintenance slave port.
2098
  selectedSlave <= WIDTH-1 when masterAddr_i(selectedMaster)(9) = '1' else
2099
                   to_integer(unsigned(masterAddr_i(selectedMaster)(8 downto 1)));
2100
 
2101
  -----------------------------------------------------------------------------
2102
  -- Interconnection matrix.
2103
  -----------------------------------------------------------------------------
2104
  Interconnect: for i in 0 to WIDTH-1 generate
2105 51 magro732
    slaveCyc_o(i) <= masterCyc_i(selectedMaster) when ((activeCycle = '1') and (selectedSlave = i)) else '0';
2106
    slaveStb_o(i) <= masterStb_i(selectedMaster) when ((activeCycle = '1') and (selectedSlave = i)) else '0';
2107 2 magro732
    slaveWe_o(i) <= masterWe_i(selectedMaster);
2108
    slaveAddr_o(i) <= masterAddr_i(selectedMaster);
2109
    slaveData_o(i) <= masterData_i(selectedMaster);
2110
    masterData_o(i) <= slaveData_i(selectedSlave);
2111
    masterAck_o(i) <= slaveAck_i(selectedSlave) when (selectedMaster = i) else '0';
2112
  end generate;
2113
 
2114
  -----------------------------------------------------------------------------
2115
  -- Chipscope debugging probe.
2116
  -----------------------------------------------------------------------------
2117
  --trig <= masterCyc_i(selectedMaster) & masterStb_i(selectedMaster) &
2118
  --        masterWe_i(selectedMaster) &  masterAddr_i(selectedMaster) &
2119
  --        masterData_i(selectedMaster) & slaveData_i(selectedSlave) &
2120
  --        slaveAck_i(selectedSlave);
2121
  --ChipscopeIconInst: ChipscopeIcon1
2122
  --  port map(CONTROL0=>control);
2123
  --ChipscopeIlaInst: ChipscopeIlaWb
2124
  --  port map(CLK=>clk, TRIG0=>trig, CONTROL=>control);
2125
 
2126
end architecture;
2127
 
2128
 
2129
 

powered by: WebSVN 2.1.0

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