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

Subversion Repositories nocem

[/] [nocem/] [trunk/] [VHDL/] [pkg_nocem.vhd] - Blame information for rev 8

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 schelleg
 
2
-----------------------------------------------------------------------------
3
-- NoCem -- Network on Chip Emulation Tool for System on Chip Research 
4
-- and Implementations
5
-- 
6
-- Copyright (C) 2006  Graham Schelle, Dirk Grunwald
7
-- 
8
-- This program is free software; you can redistribute it and/or
9
-- modify it under the terms of the GNU General Public License
10
-- as published by the Free Software Foundation; either version 2
11
-- of the License, or (at your option) any later version.
12
-- 
13
-- This program is distributed in the hope that it will be useful,
14
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
15
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
-- GNU General Public License for more details.
17
-- 
18
-- You should have received a copy of the GNU General Public License
19
-- along with this program; if not, write to the Free Software
20
-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  
21
-- 02110-1301, USA.
22
-- 
23
-- The authors can be contacted by email: <schelleg,grunwald>@cs.colorado.edu 
24
-- 
25
-- or by mail: Campus Box 430, Department of Computer Science,
26
-- University of Colorado at Boulder, Boulder, Colorado 80309
27
-------------------------------------------------------------------------------- 
28
 
29
 
30
-- 
31
-- Filename: pkg_nocem.vhd
32
-- 
33
-- Description: toplevel package file for nocem
34
-- 
35
 
36
 
37
--      THE Package File For NOCEM
38
--
39
--      Purpose: This package defines supplemental types, subtypes, 
40
--               constants, and functions.  Any design utilizing Nocem
41
--     must include this file....
42
--
43
 
44
 
45
 
46
library IEEE;
47
use IEEE.STD_LOGIC_1164.all;
48
use IEEE.STD_LOGIC_ARITH.ALL;
49
use IEEE.STD_LOGIC_UNSIGNED.ALL;
50
 
51
 
52
---------------------------------------------------------
53
---------------------------------------------------------
54
-- enumerations and derivative type definitions are      --
55
-- given here.  The values can be changed to change      --
56
-- the underlying functionality/performance of the NoC --
57
---------------------------------------------------------
58
---------------------------------------------------------
59
 
60
 
61
package pkg_nocem is
62
 
63
 
64
-- enumerate the NOC types here
65
constant NOCEM_BUS_TYPE                         : integer := 0;
66
constant NOCEM_SIMPLE_PKT_TYPE                  : integer := 1;
67
constant NOCEM_SIMPLE_PKT_ARBSIZE_TYPE          : integer := 2;
68
constant NOCEM_VC_TYPE                          : integer := 3;
69
 
70
 
71
-- enumerate channel FIFO types here
72
constant NOCEM_CHFIFO_NOVC_TYPE            : integer := 2;
73
constant NOCEM_CHFIFO_VC_TYPE              : integer := 3;
74
 
75
 
76
--enumerate FIFO implementation type here
77
-----------------------------------------------------------
78
--  WITHIN THE NOC CHANNELS CAN USE EITHER BRAM OR LUT   --
79
--  BASED FIFO IMPLEMENTATIONS.                          --
80
-----------------------------------------------------------
81
constant NOCEM_FIFO_LUT_TYPE             : integer := 0;
82
 
83
 
84
 
85
-- enumerate topology types here
86
--
87
-- MESH: connections in grid style, no torus
88
--
89
--
90
-- TORUS STRUCTURE: mesh connections plus connections looping
91
--                  top to bottom
92
--
93
--      DOUBLE TORUS STRUCTURE: torus structure plus connections
94
--                         looping left edge to right edge
95
--
96
constant NOCEM_TOPOLOGY_MESH            : integer := 0;
97
constant NOCEM_TOPOLOGY_TORUS           : integer := 1;
98
constant NOCEM_TOPOLOGY_DTORUS          : integer := 2;
99
 
100
 
101
 
102
 
103
 
104
 
105
 
106
 
107
------------------------------------------------------------------------------------------
108
------------------------------------------------------------------------------------------
109
------------------------------------------------------------------------------------------
110
-- system wide constants.  This is where the NoC is defined and these constants can              --
111
-- can be changed and modified to change behavior of the network                                                                 --
112
------------------------------------------------------------------------------------------
113
------------------------------------------------------------------------------------------
114
------------------------------------------------------------------------------------------
115
 
116
 
117
constant NOCEM_TYPE                                     : integer := NOCEM_CHFIFO_VC_TYPE;
118
constant NOCEM_CHFIFO_TYPE                              : integer := NOCEM_CHFIFO_VC_TYPE;
119
constant NOCEM_TOPOLOGY_TYPE                            : integer := NOCEM_TOPOLOGY_MESH;
120
constant NOCEM_FIFO_IMPLEMENTATION                      : integer := NOCEM_FIFO_LUT_TYPE;
121
 
122
constant NOCEM_NUM_AP                                   : integer := 4;
123
constant NOCEM_NUM_COLS                                 : integer := 2;
124
constant NOCEM_NUM_ROWS                                 : integer := NOCEM_NUM_AP / NOCEM_NUM_COLS;
125
 
126
constant NOCEM_DW                                       : integer := 8;
127
constant NOCEM_AW                                       : integer := 2;
128
 
129
 
130
constant NOCEM_NUM_VC                                   : integer := 2;                           -- 2,4 VC's supported
131
constant NOCEM_VC_ID_WIDTH                              : integer := NOCEM_NUM_VC;   -- one hot encoding (do not change this!)
132
 
133
constant NOCEM_CHFIFO_DEPTH                             : integer := 4; -- MUST BE POWER OF 2 for LUTRAM,VC CHANNEL TYPES
134
constant NOCEM_MAX_PACKET_LENGTH                        : integer := 8; -- MUST BE POWER OF 2 for LUTRAM,VC CHANNEL TYPES
135
 
136
 
137
 
138
 
139
--------------------------------------------------------------
140
-- channel indexing for a variety of arbitration decisions      --
141
--------------------------------------------------------------
142
 
143
constant NOCEM_NORTH_IX : integer := 4;
144
constant NOCEM_SOUTH_IX : integer := 3;
145
constant NOCEM_EAST_IX  : integer := 2;
146
constant NOCEM_WEST_IX  : integer := 1;
147
constant NOCEM_AP_IX    : integer := 0;
148
 
149
constant ARB_NORTH              : std_logic_vector(4 downto 0) := "10000";
150
constant ARB_SOUTH                      : std_logic_vector(4 downto 0) := "01000";
151
constant ARB_EAST                               : std_logic_vector(4 downto 0) := "00100";
152
constant ARB_WEST                               : std_logic_vector(4 downto 0) := "00010";
153
constant ARB_AP                         : std_logic_vector(4 downto 0) := "00001";
154
constant ARB_NODECISION         : std_logic_vector(4 downto 0) := "00000";
155
constant NOCEM_ARB_IX_SIZE : integer := 5;
156
 
157
 
158
------------------------------------------------------
159
--------------- STANDARD CHANNEL CONSTANTS -----------
160
------------------------------------------------------
161
 
162
constant NOCEM_CHFIFO_DATA_RE_IX                : integer := 0;
163
constant NOCEM_CHFIFO_DATA_WE_IX                : integer := 1;
164
constant NOCEM_CHFIFO_DATA_FULL_N_IX    : integer := 2;
165
constant NOCEM_CHFIFO_DATA_EMPTY_N_IX   : integer := 3;
166
 
167
constant NOCEM_CHFIFO_CNTRL_RE_IX               : integer := 4;
168
constant NOCEM_CHFIFO_CNTRL_WE_IX               : integer := 5;
169
constant NOCEM_CHFIFO_CNTRL_FULL_N_IX   : integer := 6;
170
constant NOCEM_CHFIFO_CNTRL_EMPTY_N_IX : integer := 7;
171
 
172
constant NOCEM_CHFIFO_CNTRL_STANDARD_WIDTH : integer := NOCEM_CHFIFO_CNTRL_EMPTY_N_IX+1;
173
 
174
------------------------------------------------------
175
--------------- VC CHANNEL CONSTANTS -----------------
176
------------------------------------------------------
177
 
178
constant NOCEM_CHFIFO_VC_WR_ADDR_LIX  : integer                         := NOCEM_CHFIFO_CNTRL_STANDARD_WIDTH;     --8
179
constant NOCEM_CHFIFO_VC_WR_ADDR_HIX  : integer                         := NOCEM_CHFIFO_VC_WR_ADDR_LIX+NOCEM_VC_ID_WIDTH-1;
180
 
181
constant NOCEM_CHFIFO_VC_CHDEST_LIX       : integer                     := NOCEM_CHFIFO_VC_WR_ADDR_HIX+1;--12             --10
182
constant NOCEM_CHFIFO_VC_CHDEST_HIX       : integer                     := NOCEM_CHFIFO_VC_CHDEST_LIX+NOCEM_ARB_IX_SIZE-1;
183
 
184
constant NOCEM_CHFIFO_VC_VCDEST_LIX       : integer                     := NOCEM_CHFIFO_VC_CHDEST_HIX+1;                  --17          --15
185
constant NOCEM_CHFIFO_VC_VCDEST_HIX       : integer                     := NOCEM_CHFIFO_VC_VCDEST_LIX+NOCEM_VC_ID_WIDTH-1;
186
 
187
constant NOCEM_CHFIFO_VC_ALLOC_FROMNODE_LIX      : integer      := NOCEM_CHFIFO_VC_VCDEST_HIX+1;                        --21              --17
188
constant NOCEM_CHFIFO_VC_ALLOC_FROMNODE_HIX      : integer      := NOCEM_CHFIFO_VC_ALLOC_FROMNODE_LIX+NOCEM_VC_ID_WIDTH-1;
189
 
190
constant NOCEM_CHFIFO_VC_REQER_FROMNODE_LIX      : integer      := NOCEM_CHFIFO_VC_ALLOC_FROMNODE_HIX+1;         --25            --19
191
constant NOCEM_CHFIFO_VC_REQER_FROMNODE_HIX      : integer      := NOCEM_CHFIFO_VC_REQER_FROMNODE_LIX+NOCEM_VC_ID_WIDTH-1;
192
 
193
constant NOCEM_CHFIFO_VC_REQER_DEST_CH_LIX   : integer  := NOCEM_CHFIFO_VC_REQER_FROMNODE_HIX+1;        --29    --21
194
constant NOCEM_CHFIFO_VC_REQER_DEST_CH_HIX   : integer  := NOCEM_CHFIFO_VC_REQER_DEST_CH_LIX+NOCEM_ARB_IX_SIZE-1;
195
 
196
constant NOCEM_CHFIFO_VC_REQER_VCID_LIX   : integer     := NOCEM_CHFIFO_VC_REQER_DEST_CH_HIX+1;           --34  --26
197
constant NOCEM_CHFIFO_VC_REQER_VCID_HIX           : integer     := NOCEM_CHFIFO_VC_REQER_VCID_LIX+NOCEM_VC_ID_WIDTH-1;
198
 
199
constant NOCEM_CHFIFO_VC_EMPTY_LIX        : integer             := NOCEM_CHFIFO_VC_REQER_VCID_HIX+1;    --38    --28
200
constant NOCEM_CHFIFO_VC_EMPTY_HIX        : integer                     := NOCEM_CHFIFO_VC_EMPTY_LIX+NOCEM_NUM_VC-1;
201
 
202
constant NOCEM_CHFIFO_VC_FULL_LIX         : integer                     := NOCEM_CHFIFO_VC_EMPTY_HIX+1; --42              --30
203
constant NOCEM_CHFIFO_VC_FULL_HIX         : integer                     := NOCEM_CHFIFO_VC_FULL_LIX+NOCEM_NUM_VC-1;
204
 
205
constant NOCEM_CHFIFO_VC_EOP_RD_LIX               : integer             := NOCEM_CHFIFO_VC_FULL_HIX+1; --46                             --32
206
constant NOCEM_CHFIFO_VC_EOP_RD_HIX             : integer               := NOCEM_CHFIFO_VC_EOP_RD_LIX+NOCEM_NUM_VC-1;
207
 
208
constant NOCEM_CHFIFO_VC_EOP_WR_LIX               : integer             := NOCEM_CHFIFO_VC_EOP_RD_HIX+1;          --50            --34
209
constant NOCEM_CHFIFO_VC_EOP_WR_HIX             : integer               := NOCEM_CHFIFO_VC_EOP_WR_LIX+NOCEM_NUM_VC-1;
210
 
211
constant NOCEM_CHFIFO_VC_RD_ADDR_LIX              : integer     := NOCEM_CHFIFO_VC_EOP_WR_HIX+1;                 --54             --36
212
constant NOCEM_CHFIFO_VC_RD_ADDR_HIX            : integer               := NOCEM_CHFIFO_VC_RD_ADDR_LIX+NOCEM_VC_ID_WIDTH-1;
213
 
214
constant NOCEM_CHFIFO_VC_VCSRC_LIX        : integer                     := NOCEM_CHFIFO_VC_RD_ADDR_HIX+1; -- 58          --38
215
constant NOCEM_CHFIFO_VC_VCSRC_HIX        : integer                     := NOCEM_CHFIFO_VC_VCSRC_LIX+NOCEM_VC_ID_WIDTH-1;
216
 
217
 
218
 
219
constant NOCEM_CHFIFO_CNTRL_WIDTH : integer                                     := NOCEM_CHFIFO_VC_VCSRC_HIX+1; --62             --40
220
 
221
 
222
 
223
--------------------------------------------------------------------------------
224
-- constants that have their usage defined by the underlying noc.                                       --
225
--------------------------------------------------------------------------------
226
 
227
-- depending on what is in the control packet, can set an arbitrary width
228
-- e.g. for simple packets, dest_addr/SOP/EOP are all that is needed and are
229
-- both placed in a single word
230
 
231
 
232
 
233
-- pkt control structure
234
constant NOCEM_PKTCNTRL_DEST_ADDR_LIX  : integer := 0;
235
constant NOCEM_PKTCNTRL_DEST_ADDR_HIX  : integer := NOCEM_AW-1;                         --1
236
constant NOCEM_PKTCNTRL_SOP_IX                  : integer := NOCEM_PKTCNTRL_DEST_ADDR_HIX+1;    --2
237
constant NOCEM_PKTCNTRL_EOP_IX                  : integer := NOCEM_PKTCNTRL_SOP_IX+1;   --3
238
constant NOCEM_PKTCNTRL_OS_PKT_IX               : integer := NOCEM_PKTCNTRL_EOP_IX+1;
239
 
240
 
241
constant NOCEM_PKT_CNTRL_WIDTH                  : integer := NOCEM_PKTCNTRL_OS_PKT_IX+1;                --4
242
 
243
 
244
 
245
 
246
constant NOCEM_ARB_CNTRL_VC_MUX_WR_LIX  : integer := 0;
247
constant NOCEM_ARB_CNTRL_VC_MUX_WR_HIX  : integer := NOCEM_ARB_CNTRL_VC_MUX_WR_LIX+NOCEM_VC_ID_WIDTH-1;
248
 
249
constant NOCEM_ARB_CNTRL_VC_MUX_RD_LIX  : integer := NOCEM_ARB_CNTRL_VC_MUX_WR_HIX+1;   --4 --2                                                                                                   
250
constant NOCEM_ARB_CNTRL_VC_MUX_RD_HIX  : integer := NOCEM_ARB_CNTRL_VC_MUX_RD_LIX+NOCEM_VC_ID_WIDTH-1;
251
 
252
 
253
constant NOCEM_ARB_CNTRL_VC_EOP_RD_LIX : integer := NOCEM_ARB_CNTRL_VC_MUX_RD_HIX+1;    --8  --4
254
constant NOCEM_ARB_CNTRL_VC_EOP_RD_HIX : integer := NOCEM_ARB_CNTRL_VC_EOP_RD_LIX+NOCEM_NUM_VC-1;
255
 
256
constant NOCEM_ARB_CNTRL_VC_EOP_WR_LIX : integer := NOCEM_ARB_CNTRL_VC_EOP_RD_HIX+1;    --12    --6
257
constant NOCEM_ARB_CNTRL_VC_EOP_WR_HIX : integer := NOCEM_ARB_CNTRL_VC_EOP_WR_LIX+NOCEM_NUM_VC-1;
258
 
259
constant NOCEM_ARB_CNTRL_WIDTH                  : integer := NOCEM_ARB_CNTRL_VC_EOP_WR_HIX+1;
260
 
261
 
262
 
263
 
264
 
265
 
266
--------------------------------------------------------------------------------
267
--These are the various subtypes that are used to easily index multibit words   --
268
--that are needed within nocem.  They are also used on interfaces to the                --
269
--toplevel nocem instantiation                                                                                                                          --
270
--------------------------------------------------------------------------------
271
 
272
subtype pkt_cntrl_word is std_logic_vector(NOCEM_PKT_CNTRL_WIDTH-1 downto 0);
273
type pkt_cntrl_array  is array(natural range <>) of pkt_cntrl_word;
274
 
275
subtype data_word is std_logic_vector(NOCEM_DW-1 downto 0);
276
type data_array  is array(natural range <>) of data_word;
277
 
278
subtype arb_cntrl_word is std_logic_vector(NOCEM_ARB_CNTRL_WIDTH-1 downto 0);
279
type arb_cntrl_array  is array(natural range <>) of arb_cntrl_word;
280
 
281
subtype channel_cntrl_word is std_logic_vector(NOCEM_CHFIFO_CNTRL_WIDTH-1 downto 0);
282
type channel_cntrl_array  is array(natural range <>) of channel_cntrl_word;
283
 
284
subtype node_addr_word is std_logic_vector(NOCEM_AW-1 downto 0);
285
type node_addr_array  is array(natural range <>) of node_addr_word;
286
 
287
subtype arb_decision is std_logic_vector(NOCEM_ARB_IX_SIZE-1 downto 0);
288
type arb_decision_array  is array(natural range <>) of arb_decision;
289
 
290
subtype vc_addr_word is std_logic_vector(NOCEM_VC_ID_WIDTH-1 downto 0);
291
type vc_addr_array  is array(natural range <>) of vc_addr_word;
292
 
293
 
294
 
295
 
296
 
297
 
298
 
299
 
300
--------------------------------------------------------------------------------
301
--------------------------------------------------------------------------------
302
--  components used in nocem, including the bridges                                                                     --
303
--------------------------------------------------------------------------------
304
--------------------------------------------------------------------------------
305
 
306
 
307
component fifo_fwft_bram_nfc_v5
308
        port (
309
        din: IN std_logic_VECTOR(31 downto 0);
310
        rd_clk: IN std_logic;
311
        rd_en: IN std_logic;
312
        rst: IN std_logic;
313
        wr_clk: IN std_logic;
314
        wr_en: IN std_logic;
315
        dout: OUT std_logic_VECTOR(31 downto 0);
316
        empty: OUT std_logic;
317
        full: OUT std_logic);
318
end component;
319
 
320
component fifo_fwft_bram_v5
321
        port (
322
        clk: IN std_logic;
323
        din: IN std_logic_VECTOR(31 downto 0);
324
        rd_en: IN std_logic;
325
        rst: IN std_logic;
326
        wr_en: IN std_logic;
327
        dout: OUT std_logic_VECTOR(31 downto 0);
328
        empty: OUT std_logic;
329
        full: OUT std_logic);
330
end component;
331
 
332
component fifo_fwft_bram_v2p
333
        port (
334
        din: IN std_logic_VECTOR(31 downto 0);
335
        rd_clk: IN std_logic;
336
        rd_en: IN std_logic;
337
        rst: IN std_logic;
338
        wr_clk: IN std_logic;
339
        wr_en: IN std_logic;
340
        dout: OUT std_logic_VECTOR(31 downto 0);
341
        empty: OUT std_logic;
342
        full: OUT std_logic);
343
end component;
344
 
345
component fifo_fwft_bram
346
        port (
347
        din: IN std_logic_VECTOR(31 downto 0);
348
        rd_clk: IN std_logic;
349
        rd_en: IN std_logic;
350
        rst: IN std_logic;
351
        wr_clk: IN std_logic;
352
        wr_en: IN std_logic;
353
        dout: OUT std_logic_VECTOR(31 downto 0);
354
        empty: OUT std_logic;
355
        full: OUT std_logic);
356
end component;
357
 
358
 
359
        COMPONENT noc2proc_bridge2
360
  generic
361
  (
362
    C_AWIDTH                       : integer              := 32;
363
    C_DWIDTH                       : integer              := 64;
364
    C_NUM_CS                       : integer              := 1;
365
    C_NUM_CE                       : integer              := 2;
366
    C_IP_INTR_NUM                  : integer              := 1
367
  );
368
  port
369
  (
370
                noc_arb_req         : out  std_logic;
371
                noc_arb_cntrl_out       : out  arb_cntrl_word;
372
                noc_arb_grant       : in  std_logic;
373
                noc_arb_cntrl_in        : in  arb_cntrl_word;
374
                noc_datain        : in   std_logic_vector(NOCEM_DW-1 downto 0);
375
                noc_datain_valid  : in   std_logic;
376
                noc_datain_recvd  : out  std_logic;
377
                noc_dataout       : out std_logic_vector(NOCEM_DW-1 downto 0);
378
                noc_dataout_valid : out std_logic;
379
                noc_dataout_recvd : in  std_logic;
380
                noc_pkt_cntrl_in        : in   pkt_cntrl_word;
381
                noc_pkt_cntrl_in_valid  : in   std_logic;
382
                noc_pkt_cntrl_in_recvd  : out  std_logic;
383
                noc_pkt_cntrl_out       : out pkt_cntrl_word;
384
                noc_pkt_cntrl_out_valid : out std_logic;
385
                noc_pkt_cntrl_out_recvd : in  std_logic;
386
                Bus2IP_Clk                     : in  std_logic;
387
                Bus2IP_Reset                   : in  std_logic;
388
                IP2Bus_IntrEvent               : out std_logic_vector(0 to C_IP_INTR_NUM-1);
389
                Bus2IP_Addr                    : in  std_logic_vector(0 to C_AWIDTH-1);
390
                Bus2IP_Data                    : in  std_logic_vector(0 to C_DWIDTH-1);
391
                Bus2IP_BE                      : in  std_logic_vector(0 to C_DWIDTH/8-1);
392
                Bus2IP_Burst                   : in  std_logic;
393
                Bus2IP_CS                      : in  std_logic_vector(0 to C_NUM_CS-1);
394
                Bus2IP_CE                      : in  std_logic_vector(0 to C_NUM_CE-1);
395
                Bus2IP_RdCE                    : in  std_logic_vector(0 to C_NUM_CE-1);
396
                Bus2IP_WrCE                    : in  std_logic_vector(0 to C_NUM_CE-1);
397
                Bus2IP_RdReq                   : in  std_logic;
398
                Bus2IP_WrReq                   : in  std_logic;
399
                IP2Bus_Data                    : out std_logic_vector(0 to C_DWIDTH-1);
400
                IP2Bus_Retry                   : out std_logic;
401
                IP2Bus_Error                   : out std_logic;
402
                IP2Bus_ToutSup                 : out std_logic;
403
                IP2Bus_RdAck                   : out std_logic;
404
                IP2Bus_WrAck                   : out std_logic
405
 
406
        );
407
  END COMPONENT;
408
 
409
 
410
 
411
 
412
        COMPONENT vc_node_ch_arbiter
413
    Port (
414
                -- needed to mux outputs for the accompanying switch
415
                arb_grant_output : out arb_decision_array(4 downto 0);
416
           n_channel_cntrl_in  : in channel_cntrl_word;
417
           n_channel_cntrl_out : out channel_cntrl_word;
418
           s_channel_cntrl_in  : in channel_cntrl_word;
419
           s_channel_cntrl_out : out channel_cntrl_word;
420
           e_channel_cntrl_in  : in channel_cntrl_word;
421
           e_channel_cntrl_out : out channel_cntrl_word;
422
           w_channel_cntrl_in  : in channel_cntrl_word;
423
           w_channel_cntrl_out : out channel_cntrl_word;
424
           ap_channel_cntrl_in  : in channel_cntrl_word;
425
           ap_channel_cntrl_out : out channel_cntrl_word;
426
           clk : in std_logic;
427
      rst : in std_logic
428
                );
429
        END COMPONENT;
430
 
431
 
432
        COMPONENT vc_node_vc_allocator
433
    Port (
434
                local_ch_addr : in std_logic_vector(4 downto 0);
435
                outoing_vc_status : in std_logic_vector(NOCEM_NUM_VC-1 downto 0);
436
           n_channel_cntrl_in  : in channel_cntrl_word;
437
           n_channel_cntrl_out : out channel_cntrl_word;
438
           s_channel_cntrl_in  : in channel_cntrl_word;
439
           s_channel_cntrl_out : out channel_cntrl_word;
440
           e_channel_cntrl_in  : in channel_cntrl_word;
441
           e_channel_cntrl_out : out channel_cntrl_word;
442
           w_channel_cntrl_in  : in channel_cntrl_word;
443
           w_channel_cntrl_out : out channel_cntrl_word;
444
           ap_channel_cntrl_in  : in channel_cntrl_word;
445
           ap_channel_cntrl_out : out channel_cntrl_word;
446
           clk : in std_logic;
447
      rst : in std_logic
448
                );
449
        END COMPONENT;
450
 
451
        COMPONENT mux2to1
452
                generic (
453
                        DWIDTH : integer;
454
                        REG_OUTPUT : integer
455
                );
456
                port (
457
                        din0 : in std_logic_vector( DWIDTH-1 downto 0);
458
                        din1 : in std_logic_vector( DWIDTH-1 downto 0);
459
                        sel  : in std_logic_vector( 1 downto 0);
460
                        dout : out std_logic_vector( DWIDTH-1 downto 0);
461
 
462
                        clk : in std_logic;
463
                        rst : in std_logic
464
                );
465
        END COMPONENT;
466
 
467
        COMPONENT mux4to1
468
                generic (
469
                        DWIDTH : integer;
470
                        REG_OUTPUT : integer
471
                );
472
                port (
473
                        din0 : in std_logic_vector( DWIDTH-1 downto 0);
474
                        din1 : in std_logic_vector( DWIDTH-1 downto 0);
475
                        din2 : in std_logic_vector( DWIDTH-1 downto 0);
476
                        din3 : in std_logic_vector( DWIDTH-1 downto 0);
477
                        sel  : in std_logic_vector( 3 downto 0);
478
                        dout : out std_logic_vector( DWIDTH-1 downto 0);
479
                        clk : in std_logic;
480
                        rst : in std_logic
481
                );
482
        END COMPONENT;
483
 
484
 
485
        COMPONENT xto1_arbiter
486
        Generic (
487
                NUM_REQS   : integer;
488
                REG_OUTPUT : integer
489
         );
490
    Port (
491
           arb_req : in std_logic_vector(NUM_REQS-1 downto 0);
492
                arb_grant : out std_logic_vector(NUM_REQS-1 downto 0);
493
           clk : in std_logic;
494
                rst : in std_logic);
495
        END COMPONENT;
496
 
497
        COMPONENT vc_controller
498
    Port (
499
                vc_my_id : in std_logic_vector(NOCEM_VC_ID_WIDTH-1 downto 0); -- should be tied to constant
500
                node_my_id : in std_logic_vector(NOCEM_AW-1 downto 0);
501
                pkt_cntrl_rd : in pkt_cntrl_word;
502
                pkt_cntrl_wr : in pkt_cntrl_word;
503
                pkt_re : in std_logic;
504
                pkt_we : in std_logic;
505
                vc_fifo_empty : in std_logic;
506
                vc_eop_rd_status : out std_logic;                 -- 0: no eop with rden, 1: eop and rden
507
                vc_eop_wr_status  : out std_logic;                -- 0: no eop with wren, 1: eop and wren
508
                vc_allocation_req : out std_logic;
509
                vc_req_id : out std_logic_vector(NOCEM_VC_ID_WIDTH-1 downto 0);
510
                vc_allocate_from_node : in std_logic_vector(NOCEM_VC_ID_WIDTH-1 downto 0);
511
                vc_requester_from_node : in std_logic_vector(NOCEM_VC_ID_WIDTH-1 downto 0);
512
                channel_dest : out arb_decision;
513
                vc_dest : out std_logic_vector(NOCEM_VC_ID_WIDTH-1 downto 0);
514
                vc_switch_req : out std_logic;
515
                rst : in std_logic;
516
                clk : in std_logic
517
         );
518
        END COMPONENT;
519
 
520
 
521
        COMPONENT vc_channel
522
                Generic (
523
                          IS_AN_ACCESS_POINT_CHANNEL : boolean
524
                );
525
                port (
526
 
527
                          node_dest_id  : in node_addr_word;
528
                          vc_mux_wr : in std_logic_vector(NOCEM_NUM_VC-1 downto 0);
529
                          vc_mux_rd : in std_logic_vector(NOCEM_NUM_VC-1 downto 0);
530
           wr_pkt_cntrl : in std_logic_vector(NOCEM_PKT_CNTRL_WIDTH-1 downto 0);
531
           wr_pkt_data  : in std_logic_vector(NOCEM_DW-1 downto 0);
532
           rd_pkt_cntrl : out std_logic_vector(NOCEM_PKT_CNTRL_WIDTH-1 downto 0);
533
           rd_pkt_data  : out std_logic_vector(NOCEM_DW-1 downto 0);
534
                          rd_pkt_chdest : out std_logic_vector(NOCEM_ARB_IX_SIZE-1 downto 0);
535
                          rd_pkt_vcdest : out vc_addr_word;
536
                          rd_pkt_vcsrc  : out vc_addr_word;
537
                          vc_allocate_from_node     : in vc_addr_word;
538
                vc_requester_from_node   : in vc_addr_word;
539
                          vc_eop_rd_status      : out std_logic_vector(NOCEM_NUM_VC-1 downto 0);
540
                          vc_eop_wr_status      : out std_logic_vector(NOCEM_NUM_VC-1 downto 0);
541
                          vc_allocate_destch_to_node        : out std_logic_vector(NOCEM_ARB_IX_SIZE-1 downto 0);
542
                vc_requester_to_node              : out vc_addr_word;
543
                          vc_empty              : out std_logic_vector(NOCEM_NUM_VC-1 downto 0);
544
                          vc_full               : out std_logic_vector(NOCEM_NUM_VC-1 downto 0);
545
                          RE : in std_logic;
546
                          WE : in std_logic;
547
                          clk : in std_logic;
548
                          rst : in std_logic
549
                );
550
        END COMPONENT;
551
 
552
 
553
        COMPONENT vc_channel_destap
554
                port (
555
                          node_dest_id  : in node_addr_word;
556
                          vc_mux_wr : in std_logic_vector(NOCEM_NUM_VC-1 downto 0);
557
                          vc_mux_rd : IN std_logic_vector(NOCEM_NUM_VC-1 downto 0);
558
           wr_pkt_cntrl : in std_logic_vector(NOCEM_PKT_CNTRL_WIDTH-1 downto 0);
559
           wr_pkt_data  : in std_logic_vector(NOCEM_DW-1 downto 0);
560
           rd_pkt_cntrl : out std_logic_vector(NOCEM_PKT_CNTRL_WIDTH-1 downto 0);
561
           rd_pkt_data  : out std_logic_vector(NOCEM_DW-1 downto 0);
562
                          rd_pkt_chdest : out std_logic_vector(NOCEM_ARB_IX_SIZE-1 downto 0);
563
                          rd_pkt_vcdest : out vc_addr_word;
564
                          rd_pkt_vcsrc  : out vc_addr_word;
565
                          vc_allocate_from_node     : in vc_addr_word;
566
                vc_requester_from_node   : in vc_addr_word;
567
                          vc_eop_rd_status      : out std_logic_vector(NOCEM_NUM_VC-1 downto 0);
568
                          vc_eop_wr_status      : out std_logic_vector(NOCEM_NUM_VC-1 downto 0);
569
                          vc_allocate_destch_to_node        : out std_logic_vector(NOCEM_ARB_IX_SIZE-1 downto 0);
570
                vc_requester_to_node              : out vc_addr_word;
571
                          vc_empty              : out std_logic_vector(NOCEM_NUM_VC-1 downto 0);
572
                          vc_full               : out std_logic_vector(NOCEM_NUM_VC-1 downto 0);
573
                          RE : in std_logic;
574
                          WE : in std_logic;
575
                          clk : in std_logic;
576
                          rst : in std_logic
577
                );
578
        END COMPONENT;
579
 
580
 
581
 
582
        COMPONENT vc_node
583
    Port (
584
                local_arb_addr : std_logic_vector(NOCEM_AW-1 downto 0);
585
           n_datain : in data_word;
586
           n_pkt_cntrl_in : in pkt_cntrl_word;
587
           n_dataout : out data_word;
588
           n_pkt_cntrl_out : out pkt_cntrl_word;
589
           n_channel_cntrl_in  : in channel_cntrl_word;
590
           n_channel_cntrl_out : out channel_cntrl_word;
591
           s_datain : in data_word;
592
           s_pkt_cntrl_in : in pkt_cntrl_word;
593
           s_dataout : out data_word;
594
           s_pkt_cntrl_out : out pkt_cntrl_word;
595
           s_channel_cntrl_in  : in channel_cntrl_word;
596
           s_channel_cntrl_out : out channel_cntrl_word;
597
           e_datain : in data_word;
598
           e_pkt_cntrl_in : in pkt_cntrl_word;
599
           e_dataout : out data_word;
600
           e_pkt_cntrl_out : out pkt_cntrl_word;
601
           e_channel_cntrl_in  : in channel_cntrl_word;
602
           e_channel_cntrl_out : out channel_cntrl_word;
603
           w_datain : in data_word;
604
           w_pkt_cntrl_in : in pkt_cntrl_word;
605
           w_dataout : out data_word;
606
           w_pkt_cntrl_out : out pkt_cntrl_word;
607
           w_channel_cntrl_in  : in channel_cntrl_word;
608
           w_channel_cntrl_out : out channel_cntrl_word;
609
           ap_datain : in data_word;
610
           ap_pkt_cntrl_in : in pkt_cntrl_word;
611
           ap_dataout : out data_word;
612
           ap_pkt_cntrl_out : out pkt_cntrl_word;
613
           ap_channel_cntrl_in  : in channel_cntrl_word;
614
           ap_channel_cntrl_out : out channel_cntrl_word;
615
           clk : in std_logic;
616
      rst : in std_logic
617
                );
618
        END COMPONENT;
619
 
620
--      COMPONENT noc2proc_bridge
621
--  generic
622
--  (
623
--
624
--    NOC_ADDR_WIDTH                                               : integer                    := 4;
625
--       NOC_ARB_CNTRL_WIDTH                                            : integer                       := 4;
626
--       NOC_DATA_WIDTH                                            : integer                    := 16;
627
--       NOC_PKT_CNTRL_WIDTH                                            : integer                       := 4;
628
--
629
--    C_AWIDTH                       : integer              := 32;
630
--    C_DWIDTH                       : integer              := 64;
631
--    C_NUM_CS                       : integer              := 1;
632
--    C_NUM_CE                       : integer              := 2;
633
--    C_IP_INTR_NUM                  : integer              := 1
634
--
635
--  );
636
--  port
637
--  (
638
--              noc_arb_req         : out  std_logic;
639
--              noc_arb_cntrl_req   : out  std_logic_vector(NOC_ARB_CNTRL_WIDTH-1 downto 0);
640
--
641
--              noc_arb_grant         : in std_logic;
642
--              noc_arb_cntrl_grant   : in  std_logic_vector(NOC_ARB_CNTRL_WIDTH-1 downto 0);
643
--              
644
--              noc_datain        : in   std_logic_vector(NOC_DATA_WIDTH-1 downto 0);
645
--              noc_datain_valid  : in   std_logic;
646
--              noc_datain_recvd  : out  std_logic;
647
--
648
--              noc_dataout       : out std_logic_vector(NOC_DATA_WIDTH-1 downto 0);
649
--              noc_dataout_valid : out std_logic;
650
--              noc_dataout_recvd : in  std_logic;
651
--
652
--              noc_pkt_cntrl_in        : in   std_logic_vector(NOC_PKT_CNTRL_WIDTH-1 downto 0);
653
--              noc_pkt_cntrl_in_valid  : in   std_logic;
654
--              noc_pkt_cntrl_in_recvd  : out  std_logic;      
655
--             
656
--              noc_pkt_cntrl_out       : out std_logic_vector(NOC_PKT_CNTRL_WIDTH-1 downto 0);
657
--              noc_pkt_cntrl_out_valid : out std_logic;
658
--              noc_pkt_cntrl_out_recvd : in  std_logic;
659
--
660
--
661
--    Bus2IP_Clk                     : in  std_logic;
662
--    Bus2IP_Reset                   : in  std_logic;
663
--    IP2Bus_IntrEvent               : out std_logic_vector(0 to C_IP_INTR_NUM-1);
664
--    Bus2IP_Addr                    : in  std_logic_vector(0 to C_AWIDTH-1);
665
--    Bus2IP_Data                    : in  std_logic_vector(0 to C_DWIDTH-1);
666
--    Bus2IP_BE                      : in  std_logic_vector(0 to C_DWIDTH/8-1);
667
--    Bus2IP_Burst                   : in  std_logic;
668
--    Bus2IP_CS                      : in  std_logic_vector(0 to C_NUM_CS-1);
669
--    Bus2IP_CE                      : in  std_logic_vector(0 to C_NUM_CE-1);
670
--    Bus2IP_RdCE                    : in  std_logic_vector(0 to C_NUM_CE-1);
671
--    Bus2IP_WrCE                    : in  std_logic_vector(0 to C_NUM_CE-1);
672
--    Bus2IP_RdReq                   : in  std_logic;
673
--    Bus2IP_WrReq                   : in  std_logic;
674
--    IP2Bus_Data                    : out std_logic_vector(0 to C_DWIDTH-1);
675
--    IP2Bus_Retry                   : out std_logic;
676
--    IP2Bus_Error                   : out std_logic;
677
--    IP2Bus_ToutSup                 : out std_logic;
678
--    IP2Bus_RdAck                   : out std_logic;
679
--    IP2Bus_WrAck                   : out std_logic;
680
--    Bus2IP_MstError                : in  std_logic;
681
--    Bus2IP_MstLastAck              : in  std_logic;
682
--    Bus2IP_MstRdAck                : in  std_logic;
683
--    Bus2IP_MstWrAck                : in  std_logic;
684
--    Bus2IP_MstRetry                : in  std_logic;
685
--    Bus2IP_MstTimeOut              : in  std_logic;
686
--    IP2Bus_Addr                    : out std_logic_vector(0 to C_AWIDTH-1);
687
--    IP2Bus_MstBE                   : out std_logic_vector(0 to C_DWIDTH/8-1);
688
--    IP2Bus_MstBurst                : out std_logic;
689
--    IP2Bus_MstBusLock              : out std_logic;
690
--    IP2Bus_MstNum                  : out std_logic_vector(0 to 4);
691
--    IP2Bus_MstRdReq                : out std_logic;
692
--    IP2Bus_MstWrReq                : out std_logic;
693
--    IP2IP_Addr                     : out std_logic_vector(0 to C_AWIDTH-1)
694
--  );
695
--      END COMPONENT;
696
--
697
 
698
 
699
 
700
 
701
--      COMPONENT packet_buffer
702
--   generic(
703
--       DATAIN_WIDTH : integer := 64;
704
--       DATAOUT_WIDTH : integer := 32
705
--      );      
706
--      port (
707
--              din: IN std_logic_VECTOR(DATAIN_WIDTH-1 downto 0);
708
--              clk: IN std_logic;
709
--              rd_en: IN std_logic;
710
--              rst: IN std_logic;
711
--              wr_en : IN std_logic;
712
--              dout: OUT std_logic_VECTOR(DATAOUT_WIDTH-1 downto 0);
713
--              empty: OUT std_logic;
714
--              full: OUT std_logic;
715
--              wr_ack : out std_logic;
716
--              pkt_len : in std_logic_vector(7 downto 0);
717
--              pkt_metadata_din                : in std_logic_vector(255 downto 0);            
718
--              pkt_metadata_re         : IN std_logic;                         
719
--              pkt_metadata_we         : IN std_logic;
720
--              pkt_metadata_dout       : out std_logic_vector(255 downto 0);
721
--              pkt_metadata_empty      : out std_logic;
722
--              pkt_metadata_full               : out std_logic
723
--      
724
--      );
725
--      END COMPONENT;
726
 
727
 
728
--
729
--      COMPONENT nocem_net_layer
730
--    Port ( 
731
--              noc_arb_req         : out  std_logic;
732
--              noc_arb_cntrl_req   : out  arb_cntrl_word;
733
--              noc_arb_grant         : in std_logic;
734
--              noc_arb_cntrl_grant   : in  arb_cntrl_word;             
735
--              noc_datain        : in   data_word;
736
--              noc_datain_valid  : in   std_logic;
737
--              noc_datain_recvd  : out  std_logic;
738
--              noc_dataout       : out data_word;
739
--              noc_dataout_valid : out std_logic;
740
--              noc_dataout_recvd : in  std_logic;
741
--              noc_pkt_cntrl_in        : in   pkt_cntrl_word;
742
--              noc_pkt_cntrl_in_valid  : in   std_logic;
743
--              noc_pkt_cntrl_in_recvd  : out  std_logic;                   
744
--              noc_pkt_cntrl_out       : out pkt_cntrl_word;
745
--              noc_pkt_cntrl_out_valid : out std_logic;
746
--              noc_pkt_cntrl_out_recvd : in  std_logic;
747
--              ip2noc_addr                     : in std_logic_vector(NOCEM_AW-1 downto 0);
748
--              ip2noc_packet_len       : in std_logic_vector(7 downto 0);
749
--              ip2noc_pkt_cntrl_we     : in std_logic;
750
--              ip2noc_packet                   : in std_logic_vector(63 downto 0);
751
--              ip2noc_packet_we                : in std_logic;
752
--              ip2noc_pb_rdy           : out std_logic;
753
--              noc2ip_addr                     : out std_logic_vector(NOCEM_AW-1 downto 0);
754
--              noc2ip_packet_len       : out std_logic_vector(7 downto 0);
755
--              noc2ip_pkt_cntrl_re     : in std_logic;
756
--              noc2ip_packet                   : out std_logic_vector(63 downto 0);
757
--              noc2ip_packet_re                : in std_logic;
758
--              noc2ip_pb_rdy           : out std_logic;
759
--              clk : in std_logic;
760
--      rst : in std_logic                              
761
--              );
762
--      END COMPONENT;
763
 
764
 
765
 
766
 
767
 
768
        COMPONENT nocem
769
   Port(
770
                arb_req         : in  std_logic_vector(NOCEM_NUM_AP-1 downto 0);
771
                arb_cntrl_in   : in  arb_cntrl_array(NOCEM_NUM_AP-1 downto 0);
772
                arb_grant         : out std_logic_vector(NOCEM_NUM_AP-1 downto 0);
773
                arb_cntrl_out   : out  arb_cntrl_array(NOCEM_NUM_AP-1 downto 0);
774
                datain        : in   data_array(NOCEM_NUM_AP-1 downto 0);
775
                datain_valid  : in   std_logic_vector(NOCEM_NUM_AP-1 downto 0);
776
                datain_recvd  : out  std_logic_vector(NOCEM_NUM_AP-1 downto 0);
777
                dataout       : out data_array(NOCEM_NUM_AP-1 downto 0);
778
                dataout_valid : out std_logic_vector(NOCEM_NUM_AP-1 downto 0);
779
                dataout_recvd : in  std_logic_vector(NOCEM_NUM_AP-1 downto 0);
780
                pkt_cntrl_in        : in   pkt_cntrl_array(NOCEM_NUM_AP-1 downto 0);
781
                pkt_cntrl_in_valid  : in   std_logic_vector(NOCEM_NUM_AP-1 downto 0);
782
                pkt_cntrl_in_recvd  : out  std_logic_vector(NOCEM_NUM_AP-1 downto 0);
783
                pkt_cntrl_out       : out pkt_cntrl_array(NOCEM_NUM_AP-1 downto 0);
784
                pkt_cntrl_out_valid : out std_logic_vector(NOCEM_NUM_AP-1 downto 0);
785
                pkt_cntrl_out_recvd : in  std_logic_vector(NOCEM_NUM_AP-1 downto 0);
786
                clk : in std_logic;
787
      rst : in std_logic
788
        );
789
        END COMPONENT;
790
 
791
 
792
constant EXERCISER_MODE_SIM        : integer := 0;
793
constant EXERCISER_MODE_IMPLEMENT1 : integer := 0;
794
 
795
 
796
        COMPONENT ap_exerciser_vc
797
        Generic(
798
 
799
                DELAY_START_COUNTER_WIDTH               : integer := 32;
800
                DELAY_START_CYCLES                              : integer := 500;
801
                PKT_LENGTH                                                      : integer := 5;
802
                INTERVAL_COUNTER_WIDTH                  : integer := 8;
803
                DATA_OUT_INTERVAL                               : integer := 16;
804
           INIT_DEST_ADDR                                       : integer := 2;
805
                MY_ADDR                                                                 : integer := 0;
806
                EXERCISER_MODE                                          : integer := EXERCISER_MODE_SIM
807
                 )      ;
808
    Port (
809
                arb_req         : out  std_logic;
810
                arb_cntrl_out   : out  arb_cntrl_word;
811
                arb_grant         : in std_logic;
812
                arb_cntrl_in      : in  arb_cntrl_word;
813
                datain        : in   data_word;
814
                datain_valid  : in   std_logic;
815
                datain_recvd  : out  std_logic;
816
                dataout       : out data_word;
817
                dataout_valid : out std_logic;
818
                dataout_recvd : in  std_logic;
819
                pkt_cntrl_in        : in   pkt_cntrl_word;
820
                pkt_cntrl_in_valid  : in   std_logic;
821
                pkt_cntrl_in_recvd  : out  std_logic;
822
                pkt_cntrl_out       : out pkt_cntrl_word;
823
                pkt_cntrl_out_valid : out std_logic;
824
                pkt_cntrl_out_recvd : in  std_logic;
825
                clk : in std_logic;
826
      rst : in std_logic
827
 
828
                );
829
        END COMPONENT;
830
 
831
 
832
        COMPONENT access_point_exerciser
833
        Generic(
834
                DELAY_START_COUNTER_WIDTH: integer;
835
                DELAY_START_CYCLES: integer;
836
                BURST_LENGTH: integer;
837
                INIT_DATA_OUT : data_word;
838
                INTERVAL_COUNTER_WIDTH: integer;
839
                DATA_OUT_INTERVAL : integer;
840
           INIT_DEST_ADDR : integer
841
                 )      ;
842
    Port (
843
 
844
                -- arbitration lines (usage depends on underlying network)
845
                arb_req         : out  std_logic;
846
                arb_cntrl_out   : out  arb_cntrl_word;
847
                arb_grant         : in std_logic;
848
                arb_cntrl_in   : in  arb_cntrl_word;
849
                datain        : in   data_word;
850
                datain_valid  : in   std_logic;
851
                datain_recvd  : out  std_logic;
852
                dataout       : out data_word;
853
                dataout_valid : out std_logic;
854
                dataout_recvd : in  std_logic;
855
                pkt_cntrl_in        : in   pkt_cntrl_word;
856
                pkt_cntrl_in_valid  : in   std_logic;
857
                pkt_cntrl_in_recvd  : out  std_logic;
858
                pkt_cntrl_out       : out pkt_cntrl_word;
859
                pkt_cntrl_out_valid : out std_logic;
860
                pkt_cntrl_out_recvd : in  std_logic;
861
                clk : in std_logic;
862
      rst : in std_logic
863
 
864
                );
865
        END COMPONENT;
866
 
867
 
868
 
869
 
870
 
871
        COMPONENT channel_fifo
872
                generic (
873
                  P0_NODE_ADDR : integer;
874
                  P1_NODE_ADDR : integer;
875
                  IS_AN_ACCESS_POINT_CHANNEL : boolean
876
                );
877
                port (
878
                   p0_datain : in data_word;
879
                   p0_pkt_cntrl_in : in pkt_cntrl_word;
880
                   p0_dataout : out data_word;
881
                   p0_pkt_cntrl_out : out pkt_cntrl_word;
882
                   p0_channel_cntrl_in  : in channel_cntrl_word;
883
                   p0_channel_cntrl_out : out channel_cntrl_word;
884
                   p1_datain : in data_word;
885
                   p1_pkt_cntrl_in : in pkt_cntrl_word;
886
                   p1_dataout : out data_word;
887
                   p1_pkt_cntrl_out : out pkt_cntrl_word;
888
                   p1_channel_cntrl_in  : in channel_cntrl_word;
889
                   p1_channel_cntrl_out : out channel_cntrl_word;
890
                        clk: IN std_logic;
891
                        rst: IN std_logic
892
           );
893
        END COMPONENT;
894
 
895
        COMPONENT channel_fifo_reg
896
        PORT(
897
                clk : IN std_logic;
898
                din : IN std_logic_vector(255 downto 0);
899
                rd_en : IN std_logic;
900
                rst : IN std_logic;
901
                wr_en : IN std_logic;
902
                dout : OUT std_logic_vector(255 downto 0);
903
                empty : OUT std_logic;
904
                full : OUT std_logic
905
                );
906
        END COMPONENT;
907
 
908
 
909
COMPONENT fifo_allvhdl
910
        GENERIC(
911
                WIDTH : integer;
912
                ADDR_WIDTH : integer
913
        );
914
        PORT(
915
                        din : in std_logic_vector(WIDTH-1 downto 0);  -- Input data
916
                        dout : out std_logic_vector(WIDTH-1 downto 0);  -- Output data
917
                        clk : in std_logic;             -- System Clock
918
                        rst : in std_logic;     -- System global Reset
919
                        rd_en : in std_logic;           -- Read Enable
920
                        wr_en : in std_logic;           -- Write Enable
921
                        full : out std_logic;   -- Full Flag
922
                        empty : out std_logic   -- Empty Flag
923
                );
924
END COMPONENT;
925
 
926
 
927
 
928
        COMPONENT fifo_gfs
929
        generic (
930
                WIDTH : integer;        -- FIFO word width
931
                ADD_WIDTH : integer     -- Address Width
932
                );
933
 
934
        PORT(
935
                Data_in : IN std_logic_vector(WIDTH-1 downto 0);
936
                clk : IN std_logic;
937
                Reset : IN std_logic;
938
                RE : IN std_logic;
939
                WE : IN std_logic;
940
                Data_out : OUT std_logic_vector(WIDTH-1 downto 0);
941
                Full : OUT std_logic;
942
                Half_full : OUT std_logic;
943
                empty : OUT std_logic
944
                );
945
        END COMPONENT;
946
 
947
 
948
COMPONENT ic_bus_nocem
949
        Port (
950
 
951
                arb_grant : in std_logic_vector(NOCEM_NUM_AP-1 downto 0);
952
 
953
                --data and addr incoming/outgoing line (usage depends on underlying network)
954
                datain        : in   data_array(NOCEM_NUM_AP-1 downto 0);
955
                dataout       : out data_array(NOCEM_NUM_AP-1 downto 0);
956
 
957
                dataout_valid : out std_logic_vector(NOCEM_NUM_AP-1 downto 0);
958
 
959
                addrin  : in   pkt_cntrl_array(NOCEM_NUM_AP-1 downto 0);
960
                addrout : out  pkt_cntrl_array(NOCEM_NUM_AP-1 downto 0);
961
 
962
                addrout_valid : out std_logic_vector(NOCEM_NUM_AP-1 downto 0);
963
 
964
                clk : in std_logic;
965
        rst : in std_logic
966
 
967
 
968
 
969
        );
970
END COMPONENT;
971
 
972
 
973
COMPONENT simple_pkt_node
974
        port (
975
        local_arb_addr : std_logic_vector(NOCEM_AW-1 downto 0);
976
   n_datain : in data_word;
977
   n_pkt_cntrl_in : in pkt_cntrl_word;
978
   n_dataout : out data_word;
979
   n_pkt_cntrl_out : out pkt_cntrl_word;
980
   n_channel_cntrl_in  : in channel_cntrl_word;
981
   n_channel_cntrl_out : out channel_cntrl_word;
982
   s_datain : in data_word;
983
   s_pkt_cntrl_in : in pkt_cntrl_word;
984
   s_dataout : out data_word;
985
   s_pkt_cntrl_out : out pkt_cntrl_word;
986
   s_channel_cntrl_in  : in channel_cntrl_word;
987
   s_channel_cntrl_out : out channel_cntrl_word;
988
   e_datain : in data_word;
989
   e_pkt_cntrl_in : in pkt_cntrl_word;
990
   e_dataout : out data_word;
991
   e_pkt_cntrl_out : out pkt_cntrl_word;
992
   e_channel_cntrl_in  : in channel_cntrl_word;
993
   e_channel_cntrl_out : out channel_cntrl_word;
994
   w_datain : in data_word;
995
   w_pkt_cntrl_in : in pkt_cntrl_word;
996
   w_dataout : out data_word;
997
   w_pkt_cntrl_out : out pkt_cntrl_word;
998
   w_channel_cntrl_in  : in channel_cntrl_word;
999
   w_channel_cntrl_out : out channel_cntrl_word;
1000
   ap_datain : in data_word;
1001
   ap_pkt_cntrl_in : in pkt_cntrl_word;
1002
   ap_dataout : out data_word;
1003
   ap_pkt_cntrl_out : out pkt_cntrl_word;
1004
   ap_channel_cntrl_in  : in channel_cntrl_word;
1005
   ap_channel_cntrl_out : out channel_cntrl_word;
1006
   clk : in std_logic;
1007
   rst : in std_logic
1008
        );
1009
END COMPONENT;
1010
 
1011
 
1012
 
1013
 
1014
 
1015
 
1016
 
1017
 
1018
 
1019
 
1020
 
1021
COMPONENT arb_bus_nocem
1022
        Port(
1023
                arb_req   : in  std_logic_vector(NOCEM_NUM_AP-1 downto 0);
1024
                arb_grant : out std_logic_vector(NOCEM_NUM_AP-1 downto 0);
1025
                clk : in std_logic;
1026
      rst : in std_logic
1027
        );
1028
END COMPONENT;
1029
 
1030
 
1031
 
1032
        COMPONENT simple_pkt_local_arb
1033
    Port (
1034
 
1035
                -- local arb info (should be held constant on incoming signal)
1036
                local_arb_addr : std_logic_vector(NOCEM_AW-1 downto 0);
1037
 
1038
                -- needed to mux outputs for the accompanying switch
1039
                arb_grant_output : out arb_decision_array(4 downto 0);
1040
 
1041
           n_pkt_cntrl_in : in pkt_cntrl_word;
1042
           n_pkt_cntrl_out : out pkt_cntrl_word;
1043
           n_channel_cntrl_in  : in channel_cntrl_word;
1044
           n_channel_cntrl_out : out channel_cntrl_word;
1045
 
1046
           s_pkt_cntrl_in : in pkt_cntrl_word;
1047
           s_pkt_cntrl_out : out pkt_cntrl_word;
1048
           s_channel_cntrl_in  : in channel_cntrl_word;
1049
           s_channel_cntrl_out : out channel_cntrl_word;
1050
 
1051
           e_pkt_cntrl_in : in pkt_cntrl_word;
1052
           e_pkt_cntrl_out : out pkt_cntrl_word;
1053
           e_channel_cntrl_in  : in channel_cntrl_word;
1054
           e_channel_cntrl_out : out channel_cntrl_word;
1055
 
1056
           w_pkt_cntrl_in : in pkt_cntrl_word;
1057
           w_pkt_cntrl_out : out pkt_cntrl_word;
1058
           w_channel_cntrl_in  : in channel_cntrl_word;
1059
           w_channel_cntrl_out : out channel_cntrl_word;
1060
 
1061
 
1062
           ap_pkt_cntrl_in : in pkt_cntrl_word;
1063
           ap_pkt_cntrl_out : out pkt_cntrl_word;
1064
           ap_channel_cntrl_in  : in channel_cntrl_word;
1065
           ap_channel_cntrl_out : out channel_cntrl_word;
1066
 
1067
                clk : in std_logic;
1068
      rst : in std_logic
1069
                );
1070
                END COMPONENT;
1071
 
1072
 
1073
        COMPONENT simple_pkt_local_switch
1074
    Port (
1075
                arb_grant_output : in arb_decision_array(4 downto 0);
1076
                ap_datain                                       : in  data_word;
1077
                ap_dataout                                      : out data_word;
1078
                n_datain                   : in  data_word;
1079
                n_dataout                       : out data_word;
1080
                s_datain                        : in  data_word;
1081
                s_dataout                       : out data_word;
1082
                e_datain                        : in  data_word;
1083
                e_dataout                       : out data_word;
1084
                w_datain                        : in  data_word;
1085
                w_dataout                       : out data_word;
1086
 
1087
                n_pkt_cntrl_in  : in pkt_cntrl_word;
1088
                n_pkt_cntrl_out : out pkt_cntrl_word;
1089
 
1090
                s_pkt_cntrl_in  : in pkt_cntrl_word;
1091
                s_pkt_cntrl_out : out pkt_cntrl_word;
1092
 
1093
                e_pkt_cntrl_in  : in pkt_cntrl_word;
1094
                e_pkt_cntrl_out : out pkt_cntrl_word;
1095
 
1096
                w_pkt_cntrl_in  : in pkt_cntrl_word;
1097
                w_pkt_cntrl_out : out pkt_cntrl_word;
1098
 
1099
                ap_pkt_cntrl_in  : in pkt_cntrl_word;
1100
                ap_pkt_cntrl_out : out pkt_cntrl_word;
1101
 
1102
                clk : in std_logic;
1103
      rst : in std_logic
1104
 
1105
        );
1106
        END COMPONENT;
1107
 
1108
 
1109
        COMPONENT ic_pkt_nocem
1110
    Port (
1111
                arb_req         : in  std_logic_vector(NOCEM_NUM_AP-1 downto 0);
1112
                arb_cntrl_in   : in  arb_cntrl_array(NOCEM_NUM_AP-1 downto 0);
1113
                arb_grant         : out std_logic_vector(NOCEM_NUM_AP-1 downto 0);
1114
                arb_cntrl_out   : out  arb_cntrl_array(NOCEM_NUM_AP-1 downto 0);
1115
                datain        : in   data_array(NOCEM_NUM_AP-1 downto 0);
1116
                datain_valid  : in   std_logic_vector(NOCEM_NUM_AP-1 downto 0);
1117
                datain_recvd  : out  std_logic_vector(NOCEM_NUM_AP-1 downto 0);
1118
                dataout       : out data_array(NOCEM_NUM_AP-1 downto 0);
1119
                dataout_valid : out std_logic_vector(NOCEM_NUM_AP-1 downto 0);
1120
                dataout_recvd : in  std_logic_vector(NOCEM_NUM_AP-1 downto 0);
1121
                pkt_cntrl_in        : in   pkt_cntrl_array(NOCEM_NUM_AP-1 downto 0);
1122
                pkt_cntrl_in_valid  : in   std_logic_vector(NOCEM_NUM_AP-1 downto 0);
1123
                pkt_cntrl_in_recvd  : out  std_logic_vector(NOCEM_NUM_AP-1 downto 0);
1124
                pkt_cntrl_out       : out pkt_cntrl_array(NOCEM_NUM_AP-1 downto 0);
1125
                pkt_cntrl_out_valid : out std_logic_vector(NOCEM_NUM_AP-1 downto 0);
1126
                pkt_cntrl_out_recvd : in  std_logic_vector(NOCEM_NUM_AP-1 downto 0);
1127
                clk : in std_logic;
1128
      rst : in std_logic
1129
                );
1130
        END COMPONENT;
1131
 
1132
 
1133
 
1134
 
1135
 
1136
 
1137
 
1138
 
1139
  function addr_gen  (I,num_rows,num_cols,addr_width : integer) return std_logic_vector;
1140
        function Log2 (input : integer) return integer;
1141
 
1142
end pkg_nocem;
1143
 
1144
 
1145
package body pkg_nocem is
1146
 
1147
-- Example 1
1148
  function addr_gen  (I,num_rows,num_cols,addr_width : integer) return std_logic_vector is
1149
    variable final_addr : std_logic_vector(addr_width-1 downto 0);
1150
         variable x_coord, y_coord : integer;
1151
  begin
1152
    x_coord := I mod num_cols;
1153
         y_coord := I / num_cols;
1154
 
1155
         final_addr(addr_width-1 downto addr_width/2) := CONV_STD_LOGIC_VECTOR(x_coord,addr_width/2);
1156
         final_addr(addr_width/2-1 downto 0)          := CONV_STD_LOGIC_VECTOR(y_coord,addr_width/2);
1157
    return final_addr;
1158
  end addr_gen;
1159
 
1160
 
1161
        -- it'll do for now
1162
        function Log2 (input : integer) return integer is
1163
        begin
1164
 
1165
                case input is
1166
                        when 1 => return 0;
1167
                        when 2 => return 1;
1168
                        when 4 => return 2;
1169
                        when 8 => return 3;
1170
                        when 16 => return 4;
1171
                        when 32 => return 5;
1172
                        when 64 => return 6;
1173
                        when others => return -1;
1174
                end case;
1175
 
1176
 
1177
        end Log2;
1178
 
1179
 
1180
 
1181
end pkg_nocem;

powered by: WebSVN 2.1.0

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