OpenCores
URL https://opencores.org/ocsvn/fpga-cf/fpga-cf/trunk

Subversion Repositories fpga-cf

[/] [fpga-cf/] [trunk/] [hdl/] [topv5_prototest.v] - Blame information for rev 10

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 8 peteralieb
// Top Module
2
 
3
module top
4
(
5
   // SGMII Interface - EMAC0
6
   TXP_0,
7
   TXN_0,
8
   RXP_0,
9
   RXN_0,
10
 
11
   // SGMII MGT Clock buffer inputs 
12
   MGTCLK_N,
13
   MGTCLK_P,
14
 
15
   // reset for ethernet phy
16
   PHY_RESET_0,
17
 
18
   // GTP link status
19
   GTP_READY,
20
 
21
   // Asynchronous Reset
22
   RESET,
23
 
24
        // LED Status
25
        LEDS,
26
 
27
        // DIP Switch
28
        DIP,
29
 
30
        // CPU RESET
31
        RESET_CPU
32
);
33
 
34
//-----------------------------------------------------------------------------
35
// Port Declarations 
36
//-----------------------------------------------------------------------------
37
 
38
   // SGMII Interface - EMAC0
39
   output          TXP_0;
40
   output          TXN_0;
41
   input           RXP_0;
42
   input           RXN_0;
43
 
44
   // SGMII MGT Clock buffer inputs 
45
   input           MGTCLK_N;
46
   input           MGTCLK_P;
47
 
48
   // reset for ethernet phy
49
   output          PHY_RESET_0;
50
 
51
   // GTP link status
52
   output          GTP_READY;
53
 
54
   // Asynchronous Reset
55
   input           RESET;
56
 
57
        // LED Status
58
        output  [7:0]            LEDS;
59
 
60
        // DIP Switches
61
        input   [7:0]            DIP;
62
 
63
        // CPU RESET
64
        input                           RESET_CPU;
65
 
66
//-----------------------------------------------------------------------------
67
 
68
 
69
//-------------------------------------------------------------------------------------
70
//-------------------------------------------------------------------------------------
71
//                                                       User Signals
72
//-------------------------------------------------------------------------------------
73
//-------------------------------------------------------------------------------------
74
 
75
reg [7:0] DIP_r;
76
wire reset_cpu_p;
77
wire reset_cpu_i;
78
reg [7:0] LEDr;
79
 
80
IBUF cpu_reset_ibuf (.I(RESET_CPU), .O(reset_cpu_i));
81
 
82
assign reset_cpu_p = ~reset_cpu_i;
83
 
84
 
85
//-----------------------------------------------------------------------------
86
// Ethernet Platform Instance
87
//-----------------------------------------------------------------------------
88
 
89
wire in_src_rdy_usr;
90
wire out_dst_rdy_usr;
91
wire [7:0] in_data_usr;
92
wire in_sof_usr;
93
wire in_eof_usr;
94
wire in_dst_rdy_usr;
95
wire out_src_rdy_usr;
96
wire [7:0] out_data_usr;
97
wire out_sof_usr;
98
wire out_eof_usr;
99
wire [3:0] outport_usr;
100
wire [3:0] inport_usr;
101
wire clk_local;
102
wire rst_local;
103
 
104
 
105
enetplatform enet_inst
106
(
107
   .TXP_0(TXP_0),
108
   .TXN_0(TXN_0),
109
   .RXP_0(RXP_0),
110
   .RXN_0(RXN_0),
111
   .MGTCLK_N(MGTCLK_N),
112
   .MGTCLK_P(MGTCLK_P),
113
   .PHY_RESET_0(PHY_RESET_0),
114
   .GTP_READY(GTP_READY),
115
   .RESET(RESET),
116
        .RESET_CPU(reset_cpu_p),
117
        .in_src_rdy_usr(in_src_rdy_usr),
118
        .out_dst_rdy_usr(out_dst_rdy_usr),
119
        .in_data_usr(in_data_usr),
120
        .in_sof_usr(in_sof_usr),
121
        .in_eof_usr(in_eof_usr),
122
        .in_dst_rdy_usr(in_dst_rdy_usr),
123
        .out_src_rdy_usr(out_src_rdy_usr),
124
        .out_data_usr(out_data_usr),
125
        .out_sof_usr(out_sof_usr),
126
        .out_eof_usr(out_eof_usr),
127
        .outport_usr(outport_usr),
128
        .inport_usr(inport_usr),
129
        .clk_local(clk_local),
130
        .rst_local(rst_local)
131
);
132
 
133
//-------------------------------------------------------------------------------------
134
//-------------------------------------------------------------------------------------
135
 
136
 
137
//-------------------------------------------------------------------------------------
138
//-------------------------------------------------------------------------------------
139
//                                                       ICAP Logic
140
//-------------------------------------------------------------------------------------
141
//-------------------------------------------------------------------------------------
142
 
143
wire icap_en_wr;
144
wire icap_en_rd;
145
wire icap_out_src_rdy;
146
wire icap_out_dst_rdy;
147
wire icap_in_src_rdy;
148
wire icap_in_dst_rdy;
149
wire icap_out_sof;
150
wire icap_out_eof;
151
wire icap_in_sof;
152
wire icap_in_eof;
153
wire [7:0] icap_dataout;
154
wire [7:0] icap_datain;
155
 
156
port_icap_buf the_picap
157
(
158
        .clk(clk_local),
159
        .rst(rst_local),
160
        .en_wr(icap_en_wr),
161
        .en_rd(icap_en_rd),
162
        .in_data(icap_datain),
163
        .in_sof(icap_in_sof),
164
        .in_eof(icap_in_eof),
165
        .in_src_rdy(icap_in_src_rdy),
166
        .out_dst_rdy(icap_out_dst_rdy),
167
        .out_data(icap_dataout),
168
        .out_sof(icap_out_sof),
169
        .out_eof(icap_out_eof),
170
        .out_src_rdy(icap_out_src_rdy),
171
        .in_dst_rdy(icap_in_dst_rdy)
172
);
173
 
174
assign icap_en_wr = ((outport_usr == 3 && out_src_rdy_usr == 1) || (inport_usr == 3 && in_dst_rdy_usr == 1)) ? 1 : 0;
175
assign icap_en_rd = ((outport_usr == 4 && out_src_rdy_usr == 1) || (inport_usr == 4 && in_dst_rdy_usr == 1)) ? 1 : 0;
176
 
177
 
178
//-------------------------------------------------------------------------------------
179
//-------------------------------------------------------------------------------------
180
//                                                       Channel Routing
181
//-------------------------------------------------------------------------------------
182
//-------------------------------------------------------------------------------------
183
 
184
wire ch1_in_sof;
185
wire ch1_in_eof;
186
wire ch1_in_src_rdy;
187
wire ch1_in_dst_rdy;
188
wire [7:0] ch1_in_data;
189
wire ch1_out_sof;
190
wire ch1_out_eof;
191
wire ch1_out_src_rdy;
192
wire ch1_out_dst_rdy;
193
wire [7:0] ch1_out_data;
194
wire ch1_wen;
195
wire ch1_ren;
196
 
197
wire ch2_in_sof;
198
wire ch2_in_eof;
199
wire ch2_in_src_rdy;
200
wire ch2_in_dst_rdy;
201
wire [7:0] ch2_in_data;
202
wire ch2_out_sof;
203
wire ch2_out_eof;
204
wire ch2_out_src_rdy;
205
wire ch2_out_dst_rdy;
206
wire [7:0] ch2_out_data;
207
wire ch2_wen;
208
wire ch2_ren;
209
 
210
wire ch3_in_sof;
211
wire ch3_in_eof;
212
wire ch3_in_src_rdy;
213
wire ch3_in_dst_rdy;
214
wire [7:0] ch3_in_data;
215
wire ch3_out_sof;
216
wire ch3_out_eof;
217
wire ch3_out_src_rdy;
218
wire ch3_out_dst_rdy;
219
wire [7:0] ch3_out_data;
220
wire ch3_wen;
221
wire ch3_ren;
222
 
223
wire ch4_in_sof;
224
wire ch4_in_eof;
225
wire ch4_in_src_rdy;
226
wire ch4_in_dst_rdy;
227
wire [7:0] ch4_in_data;
228
wire ch4_out_sof;
229
wire ch4_out_eof;
230
wire ch4_out_src_rdy;
231
wire ch4_out_dst_rdy;
232
wire [7:0] ch4_out_data;
233
wire ch4_wen;
234
wire ch4_ren;
235
 
236
wire ch5_in_sof;
237
wire ch5_in_eof;
238
wire ch5_in_src_rdy;
239
wire ch5_in_dst_rdy;
240
wire [7:0] ch5_in_data;
241
wire ch5_out_sof;
242
wire ch5_out_eof;
243
wire ch5_out_src_rdy;
244
wire ch5_out_dst_rdy;
245
wire [7:0] ch5_out_data;
246
wire ch5_wen;
247
wire ch5_ren;
248
 
249 10 peteralieb
wire ch5_in_sof_l;
250
wire ch5_in_eof_l;
251
wire ch5_in_src_rdy_l;
252
wire ch5_in_dst_rdy_l;
253
wire [7:0] ch5_in_data_l;
254
wire ch5_out_sof_l;
255
wire ch5_out_eof_l;
256
wire ch5_out_src_rdy_l;
257
wire ch5_out_dst_rdy_l;
258
wire [7:0] ch5_out_data_l;
259
wire ch5_wen_l;
260
wire ch5_ren_l;
261
 
262 8 peteralieb
wire ch6_in_sof;
263
wire ch6_in_eof;
264
wire ch6_in_src_rdy;
265
wire ch6_in_dst_rdy;
266
wire [7:0] ch6_in_data;
267
wire ch6_out_sof;
268
wire ch6_out_eof;
269
wire ch6_out_src_rdy;
270
wire ch6_out_dst_rdy;
271
wire [7:0] ch6_out_data;
272
wire ch6_wen;
273
wire ch6_ren;
274
 
275
channelif6 channelif_inst
276
(
277
        .in_sof(out_sof_usr),
278
        .in_eof(out_eof_usr),
279
        .in_src_rdy(out_src_rdy_usr),
280
        .in_dst_rdy(out_dst_rdy_usr),
281
        .in_data(out_data_usr),
282
        .inport_addr(outport_usr),
283
        .out_sof(in_sof_usr),
284
        .out_eof(in_eof_usr),
285
        .out_src_rdy(in_src_rdy_usr),
286
        .out_dst_rdy(in_dst_rdy_usr),
287
        .out_data(in_data_usr),
288
        .outport_addr(inport_usr),
289
        .wenables(),
290
        .renables(),
291
 
292
        .ch1_in_sof(ch1_in_sof),
293
        .ch1_in_eof(ch1_in_eof),
294
        .ch1_in_src_rdy(ch1_in_src_rdy),
295
        .ch1_in_dst_rdy(ch1_in_dst_rdy),
296
        .ch1_in_data(ch1_in_data),
297
        .ch1_out_sof(ch1_out_sof),
298
        .ch1_out_eof(ch1_out_eof),
299
        .ch1_out_src_rdy(ch1_out_src_rdy),
300
        .ch1_out_dst_rdy(ch1_out_dst_rdy),
301
        .ch1_out_data(ch1_out_data),
302
        .ch1_wen(ch1_wen),
303
        .ch1_ren(ch1_ren),
304
 
305
        .ch2_in_sof(ch2_in_sof),
306
        .ch2_in_eof(ch2_in_eof),
307
        .ch2_in_src_rdy(ch2_in_src_rdy),
308
        .ch2_in_dst_rdy(ch2_in_dst_rdy),
309
        .ch2_in_data(ch2_in_data),
310
        .ch2_out_sof(ch2_out_sof),
311
        .ch2_out_eof(ch2_out_eof),
312
        .ch2_out_src_rdy(ch2_out_src_rdy),
313
        .ch2_out_dst_rdy(ch2_out_dst_rdy),
314
        .ch2_out_data(ch2_out_data),
315
        .ch2_wen(ch2_wen),
316
        .ch2_ren(ch2_ren),
317
 
318
        .ch3_in_sof(ch3_in_sof),
319
        .ch3_in_eof(ch3_in_eof),
320
        .ch3_in_src_rdy(ch3_in_src_rdy),
321
        .ch3_in_dst_rdy(ch3_in_dst_rdy),
322
        .ch3_in_data(ch3_in_data),
323
        .ch3_out_sof(ch3_out_sof),
324
        .ch3_out_eof(ch3_out_eof),
325
        .ch3_out_src_rdy(ch3_out_src_rdy),
326
        .ch3_out_dst_rdy(ch3_out_dst_rdy),
327
        .ch3_out_data(ch3_out_data),
328
        .ch3_wen(ch3_wen),
329
        .ch3_ren(ch3_ren),
330
 
331
        .ch4_in_sof(ch4_in_sof),
332
        .ch4_in_eof(ch4_in_eof),
333
        .ch4_in_src_rdy(ch4_in_src_rdy),
334
        .ch4_in_dst_rdy(ch4_in_dst_rdy),
335
        .ch4_in_data(ch4_in_data),
336
        .ch4_out_sof(ch4_out_sof),
337
        .ch4_out_eof(ch4_out_eof),
338
        .ch4_out_src_rdy(ch4_out_src_rdy),
339
        .ch4_out_dst_rdy(ch4_out_dst_rdy),
340
        .ch4_out_data(ch4_out_data),
341
        .ch4_wen(ch4_wen),
342
        .ch4_ren(ch4_ren),
343
 
344
        .ch5_in_sof(ch5_in_sof),
345
        .ch5_in_eof(ch5_in_eof),
346
        .ch5_in_src_rdy(ch5_in_src_rdy),
347
        .ch5_in_dst_rdy(ch5_in_dst_rdy),
348
        .ch5_in_data(ch5_in_data),
349
        .ch5_out_sof(ch5_out_sof),
350
        .ch5_out_eof(ch5_out_eof),
351
        .ch5_out_src_rdy(ch5_out_src_rdy),
352
        .ch5_out_dst_rdy(ch5_out_dst_rdy),
353
        .ch5_out_data(ch5_out_data),
354
        .ch5_wen(ch5_wen),
355
        .ch5_ren(ch5_ren),
356
 
357
        .ch6_in_sof(ch6_in_sof),
358
        .ch6_in_eof(ch6_in_eof),
359
        .ch6_in_src_rdy(ch6_in_src_rdy),
360
        .ch6_in_dst_rdy(ch6_in_dst_rdy),
361
        .ch6_in_data(ch6_in_data),
362
        .ch6_out_sof(ch6_out_sof),
363
        .ch6_out_eof(ch6_out_eof),
364
        .ch6_out_src_rdy(ch6_out_src_rdy),
365
        .ch6_out_dst_rdy(ch6_out_dst_rdy),
366
        .ch6_out_data(ch6_out_data),
367
        .ch6_wen(ch6_wen),
368
        .ch6_ren(ch6_ren)
369
);
370
 
371
 
372
//-------------------------------------------------------------------------------------
373
//-------------------------------------------------------------------------------------
374
//                                                       User Logic
375
//-------------------------------------------------------------------------------------
376
//-------------------------------------------------------------------------------------
377
 
378
wire [7:0] LEDnext;
379
 
380
assign LEDS = LEDr;
381
 
382
wire clk_controlled;
383
wire usr_rst;
384
 
385
always @(posedge clk_local)
386
begin
387
        DIP_r <= DIP;
388
end
389
 
390
always @(posedge clk_local)
391
begin
392
        if (rst_local)
393
                LEDr <= 0;
394
        else if (ch1_wen & ch1_out_src_rdy)
395
                LEDr <= LEDnext;
396
end
397
 
398
port_clkcntl clkcontrol (
399
        .clk(clk_local),
400
        .rst(rst_local),
401
        .en(ch2_wen),
402
        .in_data(ch2_out_data),
403
        .in_sof(ch2_out_sof),
404
        .in_eof(ch2_out_eof),
405
        .in_src_rdy(ch2_out_src_rdy),
406
        .out_dst_rdy(ch2_in_dst_rdy),
407
        .usr_clk_in(clk_local),
408
        .out_data(),
409
        .out_sof(),
410
        .out_eof(),
411
        .out_src_rdy(),
412
        .in_dst_rdy(ch2_out_dst_rdy),
413
        .usr_clk_out(clk_controlled),
414
        .usr_rst_out(usr_rst)
415
);
416
 
417
 
418
//-------------------------------------------------------------------------------------
419
//-------------------------------------------------------------------------------------
420
//                                                       Sand Box Areas
421
//-------------------------------------------------------------------------------------
422
//-------------------------------------------------------------------------------------
423
 
424 10 peteralieb
port_md5 md5_channel_5 (
425 8 peteralieb
        .clk(clk_controlled),
426 10 peteralieb
        .rst(usr_rst),
427 8 peteralieb
        .wen ( 1 ),
428
        .ren ( 1 ),
429
        .in_data ( ch5_out_data_l ),    // Inport
430
        .in_sof ( ch5_out_sof_l ),      // Inport
431
        .in_eof ( ch5_out_eof_l ),      // Inport
432
        .in_src_rdy ( ch5_out_src_rdy_l ),      // Inport
433
        .out_dst_rdy ( ch5_in_dst_rdy_l ),      // Outport
434
 
435
        // Outputs:
436
        .out_data ( ch5_in_data_l ),    // Outport
437
        .out_sof ( ch5_in_sof_l ),      // Outport
438
        .out_eof ( ch5_in_eof_l ),      // Outport
439
        .out_src_rdy ( ch5_in_src_rdy_l ),      // Outport
440
        .in_dst_rdy ( ch5_out_dst_rdy_l )       // Inport
441
);
442
 
443
port_fifo pf_channel_5_to_interface (
444
        .rst(rst_local),
445
        .in_clk(clk_controlled),
446
        .out_clk(clk_local),
447
        .in_data ( ch5_in_data_l ),     // Inport
448
        .in_sof ( ch5_in_sof_l ),       // Inport
449
        .in_eof ( ch5_in_eof_l ),       // Inport
450
        .in_src_rdy ( ch5_in_src_rdy_l ),       // Inport
451
        .out_dst_rdy ( ch5_in_dst_rdy ),        // Outport
452
 
453
        // Outputs:
454
        .out_data ( ch5_in_data ),      // Outport
455
        .out_sof ( ch5_in_sof ),        // Outport
456
        .out_eof ( ch5_in_eof ),        // Outport
457
        .out_src_rdy ( ch5_in_src_rdy ),        // Outport
458
        .in_dst_rdy ( ch5_in_dst_rdy_l )        // Inport
459
);
460
 
461
port_fifo pf_channel_5_from_interface (
462
        .rst(rst_local),
463
        .in_clk(clk_local),
464
        .out_clk(clk_controlled),
465
        .in_data ( ch5_out_data ),      // Inport
466
        .in_sof ( ch5_out_sof ),        // Inport
467
        .in_eof ( ch5_out_eof ),        // Inport
468
        .in_src_rdy ( ch5_out_src_rdy ),        // Inport
469
        .out_dst_rdy ( ch5_out_dst_rdy_l ),     // Outport
470
 
471
        // Outputs:
472
        .out_data ( ch5_out_data_l ),   // Outport
473
        .out_sof ( ch5_out_sof_l ),     // Outport
474
        .out_eof ( ch5_out_eof_l ),     // Outport
475
        .out_src_rdy ( ch5_out_src_rdy_l ),     // Outport
476
        .in_dst_rdy ( ch5_out_dst_rdy ) // Inport
477
);
478
 
479
 
480 10 peteralieb
port_sha1 sha1_channel_6 (
481 8 peteralieb
        .clk(clk_local),
482
        .rst(rst_local),
483
        .wen ( ch6_wen ),
484
        .ren ( ch6_ren ),
485
        .in_data ( ch6_out_data ),      // Inport
486
        .in_sof ( ch6_out_sof ),        // Inport
487
        .in_eof ( ch6_out_eof ),        // Inport
488
        .in_src_rdy ( ch6_out_src_rdy ),        // Inport
489
        .out_dst_rdy ( ch6_in_dst_rdy ),        // Outport
490
 
491
        // Outputs:
492
        .out_data ( ch6_in_data ),      // Outport
493
        .out_sof ( ch6_in_sof ),        // Outport
494
        .out_eof ( ch6_in_eof ),        // Outport
495
        .out_src_rdy ( ch6_in_src_rdy ),        // Outport
496
        .in_dst_rdy ( ch6_out_dst_rdy ) // Inport
497
);
498
 
499
//-------------------------------------------------------------------------------------
500
//-------------------------------------------------------------------------------------
501
//                                                       Channel Assignments
502
//-------------------------------------------------------------------------------------
503
//-------------------------------------------------------------------------------------
504
 
505
assign ch3_in_sof = icap_out_sof;
506
assign ch3_in_eof = icap_out_eof;
507
assign ch3_in_src_rdy = icap_out_src_rdy;
508
assign ch3_in_data = icap_dataout;
509
assign ch3_out_dst_rdy = icap_in_dst_rdy;
510
assign icap_datain = ch3_out_data | ch4_out_data;
511
assign icap_out_dst_rdy = ch3_in_dst_rdy | ch4_in_dst_rdy;
512
assign icap_in_src_rdy = ch3_out_src_rdy | ch4_out_src_rdy;
513
assign icap_in_sof = ch3_out_sof | ch4_out_sof;
514
assign icap_in_eof = ch3_out_eof | ch4_out_eof;
515
 
516
assign ch4_in_sof = icap_out_sof;
517
assign ch4_in_eof = icap_out_eof;
518
assign ch4_in_src_rdy = icap_out_src_rdy;
519
assign ch4_in_data = icap_dataout;
520
assign ch4_out_dst_rdy = icap_in_dst_rdy;
521
 
522
assign ch1_in_sof = 1;
523
assign ch1_in_eof = 1;
524
assign ch1_in_src_rdy = 1;
525
assign ch1_out_dst_rdy = 1;
526
assign ch1_in_data = DIP_r;
527
assign LEDnext = ch1_out_data;
528
 
529
 
530
endmodule

powered by: WebSVN 2.1.0

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