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

Subversion Repositories pci

[/] [pci/] [tags/] [rel_8/] [apps/] [crt/] [rtl/] [verilog/] [top.v] - Blame information for rev 77

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 mihad
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  File name "top.v"                                           ////
4
////                                                              ////
5
////  This file is part of the PCI bridge sample aplication       ////
6
////  project (CRT controller).                                   ////
7
////  http://www.opencores.org/cores/pci/                         ////
8
////                                                              ////
9
////  Author(s):                                                  ////
10
////      - Miha Dolenc (mihad@opencores.org)                     ////
11
////                                                              ////
12
////  All additional information is avaliable in the README       ////
13
////  file.                                                       ////
14
////                                                              ////
15
////                                                              ////
16
//////////////////////////////////////////////////////////////////////
17
////                                                              ////
18
//// Copyright (C) 2001 Miha Dolenc, mihad@opencores.org          ////
19
////                                                              ////
20
//// This source file may be used and distributed without         ////
21
//// restriction provided that this copyright statement is not    ////
22
//// removed from the file and that any derivative work contains  ////
23
//// the original copyright notice and the associated disclaimer. ////
24
////                                                              ////
25
//// This source file is free software; you can redistribute it   ////
26
//// and/or modify it under the terms of the GNU Lesser General   ////
27
//// Public License as published by the Free Software Foundation; ////
28
//// either version 2.1 of the License, or (at your option) any   ////
29
//// later version.                                               ////
30
////                                                              ////
31
//// This source is distributed in the hope that it will be       ////
32
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
33
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
34
//// PURPOSE.  See the GNU Lesser General Public License for more ////
35
//// details.                                                     ////
36
////                                                              ////
37
//// You should have received a copy of the GNU Lesser General    ////
38
//// Public License along with this source; if not, download it   ////
39
//// from http://www.opencores.org/lgpl.shtml                     ////
40
////                                                              ////
41
//////////////////////////////////////////////////////////////////////
42
//
43
// CVS Revision History
44
//
45
// $Log: not supported by cvs2svn $
46 77 mihad
// Revision 1.3  2002/09/30 16:03:06  mihad
47
// Added meta flop module for easier meta stable FF identification during synthesis
48
//
49 59 mihad
// Revision 1.2  2002/02/01 15:24:46  mihad
50
// Repaired a few bugs, updated specification, added test bench files and design document
51
//
52 21 mihad
// Revision 1.1.1.1  2001/10/02 15:33:33  mihad
53
// New project directory structure
54 2 mihad
//
55 21 mihad
//
56 2 mihad
 
57
// This top module is used for simulation and synthesys of CRT controller
58
// sample aplication.
59
 
60
module TOP
61
(
62
    CLK,
63 21 mihad
    RST,
64 2 mihad
    INTA,
65
    REQ,
66
    GNT,
67
    FRAME,
68
    IRDY,
69
    IDSEL,
70
    DEVSEL,
71
    TRDY,
72
    STOP,
73
    PAR,
74
    PERR,
75
    SERR,
76 59 mihad
    AD0,
77
    AD1,
78
    AD2,
79
    AD3,
80
    AD4,
81
    AD5,
82
    AD6,
83
    AD7,
84
    AD8,
85
    AD9,
86
    AD10,
87
    AD11,
88
    AD12,
89
    AD13,
90
    AD14,
91
    AD15,
92
    AD16,
93
    AD17,
94
    AD18,
95
    AD19,
96
    AD20,
97
    AD21,
98
    AD22,
99
    AD23,
100
    AD24,
101
    AD25,
102
    AD26,
103
    AD27,
104
    AD28,
105
    AD29,
106
    AD30,
107
    AD31,
108
    CBE0,
109
    CBE1,
110
    CBE2,
111
    CBE3,
112 21 mihad
 
113 2 mihad
/*    CLK_I,
114
    RST_I,
115
    RST_O,
116
    INT_I,
117
    INT_O,
118
 
119
    // WISHBONE slave interface
120
    ADR_I,
121
    SDAT_I,
122
    SDAT_O,
123
    SEL_I,
124
    CYC_I,
125
    STB_I,
126
    WE_I,
127
    CAB_I,
128
    ACK_O,
129
    RTY_O,
130
    ERR_O,
131
 
132
    // WISHBONE master interface
133
    ADR_O,
134
    MDAT_I,
135
    MDAT_O,
136
    SEL_O,
137
    CYC_O,
138
    STB_O,
139
    WE_O,
140
    CAB_O,
141
    ACK_I,
142
    RTY_I,
143
    ERR_I    */
144
 
145
    CRT_CLK,
146
    HSYNC,
147
    VSYNC,
148 59 mihad
 
149
    RGB4,
150
    RGB5,
151
    RGB6,
152
    RGB7,
153
    RGB8,
154
    RGB9,
155
    RGB10,
156
    RGB11,
157
    RGB12,
158
    RGB13,
159
    RGB14,
160
    RGB15,
161
 
162 2 mihad
    LED
163
);
164
 
165
input           CLK ;
166 59 mihad
inout           AD0,
167
                AD1,
168
                AD2,
169
                AD3,
170
                AD4,
171
                AD5,
172
                AD6,
173
                AD7,
174
                AD8,
175
                AD9,
176
                AD10,
177
                AD11,
178
                AD12,
179
                AD13,
180
                AD14,
181
                AD15,
182
                AD16,
183
                AD17,
184
                AD18,
185
                AD19,
186
                AD20,
187
                AD21,
188
                AD22,
189
                AD23,
190
                AD24,
191
                AD25,
192
                AD26,
193
                AD27,
194
                AD28,
195
                AD29,
196
                AD30,
197
                AD31 ;
198
 
199
inout           CBE0,
200
                CBE1,
201
                CBE2,
202
                CBE3 ;
203
 
204 2 mihad
inout           RST ;
205
inout           INTA ;
206
output          REQ ;
207
input           GNT ;
208
inout           FRAME ;
209
inout           IRDY ;
210
input           IDSEL ;
211
inout           DEVSEL ;
212
inout           TRDY ;
213
inout           STOP ;
214
inout           PAR ;
215
inout           PERR ;
216
output          SERR ;
217
 
218
input           CRT_CLK ;
219
// CRT outputs
220
output          HSYNC ;
221
output          VSYNC ;
222 59 mihad
output          RGB4,
223
                RGB5,
224
                RGB6,
225
                RGB7,
226
                RGB8,
227
                RGB9,
228
                RGB10,
229
                RGB11,
230
                RGB12,
231
                RGB13,
232
                RGB14,
233
                RGB15 ;
234 2 mihad
output                  LED ;
235
 
236
// WISHBONE system signals
237
wire    RST_I = 1'b0 ;
238
wire    RST_O ;
239
wire    INT_I = 1'b0 ;
240
wire    INT_O ;
241
 
242
wire [15:0] rgb_int ;
243
// WISHBONE slave interface
244
wire    [31:0]  ADR_I ;
245
wire    [31:0]  SDAT_I ;
246
wire    [31:0]  SDAT_O ;
247
wire    [3:0]   SEL_I ;
248
wire            CYC_I ;
249
wire            STB_I ;
250
wire            WE_I  ;
251
wire            CAB_I ;
252
wire            ACK_O ;
253
wire            RTY_O ;
254
wire            ERR_O ;
255
 
256
// WISHBONE master interface
257
wire    [31:0]  ADR_O ;
258
wire    [31:0]  MDAT_I ;
259
wire    [31:0]  MDAT_O ;
260
wire    [3:0]   SEL_O ;
261
wire            CYC_O ;
262
wire            STB_O ;
263
wire            WE_O  ;
264
wire            CAB_O ;
265
wire            ACK_I ;
266
wire            RTY_I ;
267
wire            ERR_I ;
268
 
269
wire    [31:0]  AD_out ;
270
wire    [31:0]  AD_en ;
271
 
272
 
273 59 mihad
wire    [31:0]  AD_in =
274
{
275
    AD31,
276
    AD30,
277
    AD29,
278
    AD28,
279
    AD27,
280
    AD26,
281
    AD25,
282
    AD24,
283
    AD23,
284
    AD22,
285
    AD21,
286
    AD20,
287
    AD19,
288
    AD18,
289
    AD17,
290
    AD16,
291
    AD15,
292
    AD14,
293
    AD13,
294
    AD12,
295
    AD11,
296
    AD10,
297
    AD9,
298
    AD8,
299
    AD7,
300
    AD6,
301
    AD5,
302
    AD4,
303
    AD3,
304
    AD2,
305
    AD1,
306
    AD0
307
} ;
308 2 mihad
 
309 59 mihad
wire    [3:0]   CBE_in =
310
{
311
    CBE3,
312
    CBE2,
313
    CBE1,
314
    CBE0
315
} ;
316
 
317 2 mihad
wire    [3:0]   CBE_out ;
318
wire    [3:0]   CBE_en ;
319
 
320
 
321
 
322
wire            RST_in = RST ;
323
wire            RST_out ;
324
wire            RST_en ;
325
 
326
wire            INTA_in = INTA ;
327
wire            INTA_en ;
328
wire            INTA_out ;
329
 
330
wire            REQ_en ;
331
wire            REQ_out ;
332
 
333
wire            FRAME_in = FRAME ;
334
wire            FRAME_out ;
335
wire            FRAME_en ;
336
 
337
wire            IRDY_in = IRDY ;
338
wire            IRDY_out ;
339
wire            IRDY_en ;
340
 
341
wire            DEVSEL_in = DEVSEL ;
342
wire            DEVSEL_out ;
343
wire            DEVSEL_en ;
344
 
345
wire            TRDY_in = TRDY ;
346
wire            TRDY_out ;
347
wire            TRDY_en ;
348
 
349
wire            STOP_in = STOP ;
350
wire            STOP_out ;
351
wire            STOP_en ;
352
 
353
wire            PAR_in = PAR ;
354
wire            PAR_out ;
355
wire            PAR_en ;
356
 
357
wire            PERR_in = PERR ;
358
wire            PERR_out ;
359
wire            PERR_en ;
360
 
361
wire            SERR_out ;
362
wire            SERR_en ;
363
 
364 77 mihad
pci_bridge32 bridge
365 2 mihad
(
366
    // WISHBONE system signals
367 77 mihad
    .wb_clk_i(CRT_CLK),
368
    .wb_rst_i(RST_I),
369
    .wb_rst_o(RST_O),
370
    .wb_int_i(INT_I),
371
    .wb_int_o(INT_O),
372 21 mihad
 
373 2 mihad
    // WISHBONE slave interface
374 77 mihad
    .wbs_adr_i(ADR_I),
375
    .wbs_dat_i(SDAT_I),
376
    .wbs_dat_o(SDAT_O),
377
    .wbs_sel_i(SEL_I),
378
    .wbs_cyc_i(CYC_I),
379
    .wbs_stb_i(STB_I),
380
    .wbs_we_i (WE_I),
381
    .wbs_cab_i(CAB_I),
382
    .wbs_ack_o(ACK_O),
383
    .wbs_rty_o(RTY_O),
384
    .wbs_err_o(ERR_O),
385 21 mihad
 
386 2 mihad
    // WISHBONE master interface
387 77 mihad
    .wbm_adr_o(ADR_O),
388
    .wbm_dat_i(MDAT_I),
389
    .wbm_dat_o(MDAT_O),
390
    .wbm_sel_o(SEL_O),
391
    .wbm_cyc_o(CYC_O),
392
    .wbm_stb_o(STB_O),
393
    .wbm_we_o (WE_O),
394
    .wbm_cab_o(CAB_O),
395
    .wbm_ack_i(ACK_I),
396
    .wbm_rty_i(RTY_I),
397
    .wbm_err_i(ERR_I),
398 21 mihad
 
399 2 mihad
    // pci interface - system pins
400 77 mihad
    .pci_clk_i    ( CLK ),
401
    .pci_rst_i    ( RST_in ),
402
    .pci_rst_o    ( RST_out ),
403
    .pci_inta_i   ( INTA_in ),
404
    .pci_inta_o   ( INTA_out),
405
    .pci_rst_oe_o ( RST_en),
406
    .pci_inta_oe_o( INTA_en ),
407 21 mihad
 
408 2 mihad
    // arbitration pins
409 77 mihad
    .pci_req_o   ( REQ_out ),
410
    .pci_req_oe_o( REQ_en ),
411
 
412
    .pci_gnt_i   ( GNT ),
413 21 mihad
 
414 2 mihad
    // protocol pins
415 77 mihad
    .pci_frame_i     ( FRAME_in),
416
    .pci_frame_o     ( FRAME_out ),
417
 
418
    .pci_frame_oe_o  ( FRAME_en ),
419
    .pci_irdy_oe_o   ( IRDY_en ),
420
    .pci_devsel_oe_o ( DEVSEL_en ),
421
    .pci_trdy_oe_o   ( TRDY_en ),
422
    .pci_stop_oe_o   ( STOP_en ),
423
    .pci_ad_oe_o     ( AD_en ),
424
    .pci_cbe_oe_o    ( CBE_en) ,
425
 
426
    .pci_irdy_i      ( IRDY_in ),
427
    .pci_irdy_o      ( IRDY_out ),
428
 
429
    .pci_idsel_i     ( IDSEL ),
430
 
431
    .pci_devsel_i    ( DEVSEL_in ),
432
    .pci_devsel_o    ( DEVSEL_out ),
433
 
434
    .pci_trdy_i      ( TRDY_in ),
435
    .pci_trdy_o      ( TRDY_out ),
436
 
437
    .pci_stop_i      ( STOP_in ),
438
    .pci_stop_o      ( STOP_out ),
439 2 mihad
 
440 21 mihad
    // data transfer pins
441 77 mihad
    .pci_ad_i (AD_in),
442
    .pci_ad_o (AD_out),
443
 
444
    .pci_cbe_i( CBE_in ),
445
    .pci_cbe_o( CBE_out ),
446 21 mihad
 
447 2 mihad
    // parity generation and checking pins
448 77 mihad
    .pci_par_i    ( PAR_in ),
449
    .pci_par_o    ( PAR_out ),
450
    .pci_par_oe_o ( PAR_en ),
451
 
452
    .pci_perr_i   ( PERR_in ),
453
    .pci_perr_o   ( PERR_out ),
454
    .pci_perr_oe_o( PERR_en ),
455 21 mihad
 
456 2 mihad
    // system error pin
457 77 mihad
    .pci_serr_o   ( SERR_out ),
458
    .pci_serr_oe_o( SERR_en )
459 2 mihad
);
460
 
461
// PCI IO buffers instantiation
462 59 mihad
bufif0 AD_buf0   ( AD0,  AD_out[0], AD_en[0]) ;
463
bufif0 AD_buf1   ( AD1,  AD_out[1], AD_en[1]) ;
464
bufif0 AD_buf2   ( AD2,  AD_out[2], AD_en[2]) ;
465
bufif0 AD_buf3   ( AD3,  AD_out[3], AD_en[3]) ;
466
bufif0 AD_buf4   ( AD4,  AD_out[4], AD_en[4]) ;
467
bufif0 AD_buf5   ( AD5,  AD_out[5], AD_en[5]) ;
468
bufif0 AD_buf6   ( AD6,  AD_out[6], AD_en[6]) ;
469
bufif0 AD_buf7   ( AD7,  AD_out[7], AD_en[7]) ;
470
bufif0 AD_buf8   ( AD8,  AD_out[8], AD_en[8]) ;
471
bufif0 AD_buf9   ( AD9,  AD_out[9], AD_en[9]) ;
472
bufif0 AD_buf10  ( AD10, AD_out[10],AD_en[10] ) ;
473
bufif0 AD_buf11  ( AD11, AD_out[11],AD_en[11] ) ;
474
bufif0 AD_buf12  ( AD12, AD_out[12],AD_en[12] ) ;
475
bufif0 AD_buf13  ( AD13, AD_out[13],AD_en[13] ) ;
476
bufif0 AD_buf14  ( AD14, AD_out[14],AD_en[14] ) ;
477
bufif0 AD_buf15  ( AD15, AD_out[15],AD_en[15] ) ;
478
bufif0 AD_buf16  ( AD16, AD_out[16],AD_en[16] ) ;
479
bufif0 AD_buf17  ( AD17, AD_out[17],AD_en[17] ) ;
480
bufif0 AD_buf18  ( AD18, AD_out[18],AD_en[18] ) ;
481
bufif0 AD_buf19  ( AD19, AD_out[19],AD_en[19] ) ;
482
bufif0 AD_buf20  ( AD20, AD_out[20],AD_en[20] ) ;
483
bufif0 AD_buf21  ( AD21, AD_out[21],AD_en[21] ) ;
484
bufif0 AD_buf22  ( AD22, AD_out[22],AD_en[22] ) ;
485
bufif0 AD_buf23  ( AD23, AD_out[23],AD_en[23] ) ;
486
bufif0 AD_buf24  ( AD24, AD_out[24],AD_en[24] ) ;
487
bufif0 AD_buf25  ( AD25, AD_out[25],AD_en[25] ) ;
488
bufif0 AD_buf26  ( AD26, AD_out[26],AD_en[26] ) ;
489
bufif0 AD_buf27  ( AD27, AD_out[27],AD_en[27] ) ;
490
bufif0 AD_buf28  ( AD28, AD_out[28],AD_en[28] ) ;
491
bufif0 AD_buf29  ( AD29, AD_out[29],AD_en[29] ) ;
492
bufif0 AD_buf30  ( AD30, AD_out[30],AD_en[30] ) ;
493
bufif0 AD_buf31  ( AD31, AD_out[31],AD_en[31] ) ;
494 2 mihad
 
495 59 mihad
bufif0 CBE_buf0 ( CBE0, CBE_out[0], CBE_en[0] ) ;
496
bufif0 CBE_buf1 ( CBE1, CBE_out[1], CBE_en[1] ) ;
497
bufif0 CBE_buf2 ( CBE2, CBE_out[2], CBE_en[2] ) ;
498
bufif0 CBE_buf3 ( CBE3, CBE_out[3], CBE_en[3] ) ;
499 21 mihad
 
500 2 mihad
bufif0 FRAME_buf    ( FRAME, FRAME_out, FRAME_en ) ;
501
bufif0 IRDY_buf     ( IRDY, IRDY_out, IRDY_en ) ;
502
bufif0 DEVSEL_buf   ( DEVSEL, DEVSEL_out, DEVSEL_en ) ;
503
bufif0 TRDY_buf     ( TRDY, TRDY_out, TRDY_en ) ;
504
bufif0 STOP_buf     ( STOP, STOP_out, STOP_en ) ;
505 21 mihad
 
506 2 mihad
bufif0 RST_buf      ( RST, RST_out, RST_en ) ;
507
bufif0 INTA_buf     ( INTA, INTA_out, INTA_en) ;
508
bufif0 REQ_buf      ( REQ, REQ_out, REQ_en ) ;
509
bufif0 PAR_buf      ( PAR, PAR_out, PAR_en ) ;
510
bufif0 PERR_buf     ( PERR, PERR_out, PERR_en ) ;
511
bufif0 SERR_buf     ( SERR, SERR_out, SERR_en ) ;
512
 
513
wire crt_hsync ;
514
wire crt_vsync ;
515
 
516
// CRT controler instance
517
ssvga_top CRT
518
(
519
        // Clock and reset
520 21 mihad
        .wb_clk_i(CRT_CLK),
521 2 mihad
    .wb_rst_i(RST_O),
522 21 mihad
 
523 2 mihad
        // WISHBONE Master I/F
524 21 mihad
        .wbm_cyc_o  (CYC_I),
525
    .wbm_stb_o  (STB_I),
526
    .wbm_sel_o  (SEL_I),
527 2 mihad
    .wbm_we_o   (WE_I),
528 21 mihad
        .wbm_adr_o  (ADR_I),
529
    .wbm_dat_o  (SDAT_I),
530 2 mihad
    .wbm_cab_o  (CAB_I),
531 21 mihad
        .wbm_dat_i  (SDAT_O),
532
    .wbm_ack_i  (ACK_O),
533
    .wbm_err_i  (ERR_O),
534 2 mihad
    .wbm_rty_i  (RTY_O),
535
 
536
        // WISHBONE Slave I/F
537 21 mihad
        .wbs_cyc_i  (CYC_O),
538
    .wbs_stb_i  (STB_O),
539
    .wbs_sel_i  (SEL_O),
540 2 mihad
    .wbs_we_i   (WE_O),
541 21 mihad
        .wbs_adr_i  (ADR_O),
542
    .wbs_dat_i  (MDAT_O),
543 2 mihad
    .wbs_cab_i  (CAB_O),
544 21 mihad
        .wbs_dat_o  (MDAT_I),
545
    .wbs_ack_o  (ACK_I),
546
    .wbs_err_o  (ERR_I),
547 2 mihad
    .wbs_rty_o  (RTY_I),
548
 
549
        // Signals to VGA display
550 21 mihad
        .pad_hsync_o    (crt_hsync),
551
    .pad_vsync_o    (crt_vsync),
552 2 mihad
    .pad_rgb_o      (rgb_int),
553
    .led_o                      (LED)
554
);
555
 
556
CRTC_IOB crt_out_reg
557
(
558
    .reset_in(RST_O),
559
    .clk_in(CRT_CLK),
560
    .hsync_in(crt_hsync),
561
    .vsync_in(crt_vsync),
562
    .rgb_in(rgb_int[15:4]),
563
    .hsync_out(HSYNC),
564
    .vsync_out(VSYNC),
565 59 mihad
    .rgb_out({RGB15, RGB14, RGB13, RGB12, RGB11, RGB10, RGB9, RGB8, RGB7, RGB6, RGB5, RGB4})
566 2 mihad
) ;
567
 
568 59 mihad
endmodule

powered by: WebSVN 2.1.0

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