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

Subversion Repositories vga_lcd

[/] [vga_lcd/] [trunk/] [rtl/] [verilog/] [vga_pgen.v] - Blame information for rev 62

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 23 rherveille
/////////////////////////////////////////////////////////////////////
2
////                                                             ////
3
////  WISHBONE rev.B2 compliant VGA/LCD Core; Pixel Generator    ////
4
////                                                             ////
5
////                                                             ////
6
////  Author: Richard Herveille                                  ////
7
////          richard@asics.ws                                   ////
8
////          www.asics.ws                                       ////
9
////                                                             ////
10
////  Downloaded from: http://www.opencores.org/projects/vga_lcd ////
11
////                                                             ////
12
/////////////////////////////////////////////////////////////////////
13
////                                                             ////
14
//// Copyright (C) 2001 Richard Herveille                        ////
15
////                    richard@asics.ws                         ////
16
////                                                             ////
17
//// This source file may be used and distributed without        ////
18
//// restriction provided that this copyright statement is not   ////
19
//// removed from the file and that any derivative work contains ////
20
//// the original copyright notice and the associated disclaimer.////
21
////                                                             ////
22
////     THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY     ////
23
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED   ////
24
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS   ////
25
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR      ////
26
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,         ////
27
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    ////
28
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE   ////
29
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR        ////
30
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF  ////
31
//// LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT  ////
32
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT  ////
33
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE         ////
34
//// POSSIBILITY OF SUCH DAMAGE.                                 ////
35
////                                                             ////
36
/////////////////////////////////////////////////////////////////////
37
 
38
//  CVS Log
39 17 rherveille
//
40 57 rherveille
//  $Id: vga_pgen.v,v 1.7 2003-08-01 11:46:38 rherveille Exp $
41 17 rherveille
//
42 57 rherveille
//  $Date: 2003-08-01 11:46:38 $
43
//  $Revision: 1.7 $
44 23 rherveille
//  $Author: rherveille $
45
//  $Locker:  $
46
//  $State: Exp $
47 17 rherveille
//
48 23 rherveille
// Change History:
49
//               $Log: not supported by cvs2svn $
50 57 rherveille
//               Revision 1.6  2003/05/07 09:48:54  rherveille
51
//               Fixed some Wishbone RevB.3 related bugs.
52
//               Changed layout of the core. Blocks are located more logically now.
53
//               Started work on a dual clocked/double edge 12bit output. Commonly used by external devices like DVI transmitters.
54
//
55 53 rherveille
//               Revision 1.5  2002/04/05 06:24:35  rherveille
56
//               Fixed a potential reset bug in the hint & vint generation.
57
//
58 37 rherveille
//               Revision 1.4  2002/01/28 03:47:16  rherveille
59
//               Changed counter-library.
60
//               Changed vga-core.
61
//               Added 32bpp mode.
62
//
63 17 rherveille
 
64 53 rherveille
//synopsys translate_off
65 17 rherveille
`include "timescale.v"
66 53 rherveille
//synopsys translate_on
67 17 rherveille
 
68 53 rherveille
`include "vga_defines.v"
69 17 rherveille
 
70 53 rherveille
module vga_pgen (
71
        clk_i, ctrl_ven, ctrl_HSyncL, Thsync, Thgdel, Thgate, Thlen,
72
        ctrl_VSyncL, Tvsync, Tvgdel, Tvgate, Tvlen, ctrl_CSyncL, ctrl_BlankL,
73
        eoh, eov,
74
        ctrl_dvi_odf, ctrl_cd, ctrl_pc,
75
        fb_data_fifo_rreq, fb_data_fifo_empty, fb_data_fifo_q, ImDoneFifoQ,
76
        stat_acmp, clut_req, clut_adr, clut_q, clut_ack, ctrl_cbsw, clut_switch,
77
        cursor_adr,
78
        cursor0_en, cursor0_res, cursor0_xy, cc0_adr_o, cc0_dat_i,
79
        cursor1_en, cursor1_res, cursor1_xy, cc1_adr_o, cc1_dat_i,
80
        line_fifo_wreq, line_fifo_full, line_fifo_d, line_fifo_rreq, line_fifo_q,
81
        pclk_i,
82
`ifdef VGA_12BIT_DVI
83
        dvi_pclk_p_o, dvi_pclk_m_o, dvi_hsync_o, dvi_vsync_o, dvi_de_o, dvi_d_o,
84
`endif
85
        pclk_o, hsync_o, vsync_o, csync_o, blank_o, r_o, g_o, b_o
86
);
87
 
88 17 rherveille
        // inputs & outputs
89
 
90 53 rherveille
        input clk_i; // master clock
91 17 rherveille
 
92
        input ctrl_ven;           // Video enable signal
93
 
94
        // horiontal timing settings
95
        input        ctrl_HSyncL; // horizontal sync pulse polarization level (pos/neg)
96
        input [ 7:0] Thsync;      // horizontal sync pulse width (in pixels)
97
        input [ 7:0] Thgdel;      // horizontal gate delay (in pixels)
98
        input [15:0] Thgate;      // horizontal gate length (number of visible pixels per line)
99
        input [15:0] Thlen;       // horizontal length (number of pixels per line)
100
 
101
        // vertical timing settings
102
        input        ctrl_VSyncL; // vertical sync pulse polarization level (pos/neg)
103
        input [ 7:0] Tvsync;      // vertical sync pulse width (in lines)
104
        input [ 7:0] Tvgdel;      // vertical gate delay (in lines)
105
        input [15:0] Tvgate;      // vertical gate length (number of visible lines in frame)
106
        input [15:0] Tvlen;       // vertical length (number of lines in frame)
107 53 rherveille
 
108 17 rherveille
        // composite signals
109 53 rherveille
        input ctrl_CSyncL;        // composite sync pulse polarization level
110
        input ctrl_BlankL;        // blank signal polarization level
111 17 rherveille
 
112
        // status outputs
113 53 rherveille
        output eoh;               // end of horizontal
114 17 rherveille
        reg eoh;
115 53 rherveille
        output eov;               // end of vertical;
116 17 rherveille
        reg eov;
117
 
118
 
119 53 rherveille
        // Pixel signals
120
        input  [ 1: 0] ctrl_dvi_odf;
121
        input  [ 1: 0] ctrl_cd;
122
        input          ctrl_pc;
123 17 rherveille
 
124 53 rherveille
        input  [31: 0] fb_data_fifo_q;
125
        input          fb_data_fifo_empty;
126
        output         fb_data_fifo_rreq;
127
        input          ImDoneFifoQ;
128
 
129
        output         stat_acmp;   // active CLUT memory page
130
        reg stat_acmp;
131
        output         clut_req;
132
        output [ 8: 0] clut_adr;
133
        input  [23: 0] clut_q;
134
        input          clut_ack;
135
        input          ctrl_cbsw;   // enable clut bank switching
136
        output         clut_switch; // clut memory bank-switch request: clut page switched (when enabled)
137
 
138
        input  [ 8: 0] cursor_adr;  // cursor data address (from wbm)
139
        input          cursor0_en;  // enable hardware cursor0
140
        input          cursor0_res; // cursor0 resolution
141
        input  [31: 0] cursor0_xy;  // (x,y) address hardware cursor0
142
        output [ 3: 0] cc0_adr_o;   // cursor0 color registers address output
143
        input  [15: 0] cc0_dat_i;   // cursor0 color registers data input
144
        input          cursor1_en;  // enable hardware cursor1
145
        input          cursor1_res; // cursor1 resolution
146
        input  [31: 0] cursor1_xy;  // (x,y) address hardware cursor1
147
        output [ 3: 0] cc1_adr_o;   // cursor1 color registers address output
148
        input  [15: 0] cc1_dat_i;   // cursor1 color registers data input
149
 
150
        input          line_fifo_full;
151
        output         line_fifo_wreq;
152
        output [23: 0] line_fifo_d;
153
        output         line_fifo_rreq;
154
        input  [23: 0] line_fifo_q;
155
 
156
 
157
        // pixel clock related outputs
158
        input  pclk_i;            // pixel clock in
159
        output pclk_o;            // pixel clock out
160
 
161
        output hsync_o;           // horizontal sync pulse
162
        output vsync_o;           // vertical sync pulse
163
        output csync_o;           // composite sync: Hsync OR Vsync (logical OR function)
164
        output blank_o;           // blanking signal
165
        output [ 7:0] r_o, g_o, b_o;
166
 
167
        reg       hsync_o, vsync_o, csync_o, blank_o;
168
        reg [7:0] r_o, g_o, b_o;
169
 
170
        `ifdef VGA_12BIT_DVI
171
            output        dvi_pclk_p_o;  // dvi pclk+
172
            output        dvi_pclk_m_o;  // dvi pclk-
173
            output        dvi_hsync_o;   // dvi hsync
174
            output        dvi_vsync_o;   // dvi vsync
175
            output        dvi_de_o;      // dvi data enable
176
            output [11:0] dvi_d_o;       // dvi 12bit output
177
        `endif
178
 
179
 
180
 
181 17 rherveille
        //
182
        // variable declarations
183
        //
184
        reg nVen; // video enable signal (active low)
185
        wire eol, eof;
186 53 rherveille
        wire ihsync, ivsync, icsync, iblank;
187
        wire pclk_ena;
188 17 rherveille
 
189 53 rherveille
        //////////////////////////////////
190 17 rherveille
        //
191
        // module body
192
        //
193
 
194
        // synchronize timing/control settings (from master-clock-domain to pixel-clock-domain)
195 53 rherveille
        always @(posedge pclk_i)
196
          nVen <= #1 ~ctrl_ven;
197 17 rherveille
 
198 53 rherveille
 
199
        //////////////////////////////////
200
        //
201
        // Pixel Clock generator
202
        //
203
 
204
        vga_clkgen clk_gen(
205
          .pclk_i       ( pclk_i       ),
206
          .rst_i        ( nVen         ),
207
          .pclk_o       ( pclk_o       ),
208
          .dvi_pclk_p_o ( dvi_pclk_p_o ),
209
          .dvi_pclk_m_o ( dvi_pclk_m_o ),
210
          .pclk_ena_o   ( pclk_ena     )
211
        );
212
 
213
 
214
        //////////////////////////////////
215
        //
216
        // Timing generator
217
        //
218
 
219 17 rherveille
        // hookup video timing generator
220 53 rherveille
        vga_tgen vtgen(
221
                .clk(pclk_i),
222
                .clk_ena ( pclk_ena    ),
223
                .rst     ( nVen        ),
224
                .Thsync  ( Thsync      ),
225
                .Thgdel  ( Thgdel      ),
226
                .Thgate  ( Thgate      ),
227
                .Thlen   ( Thlen       ),
228
                .Tvsync  ( Tvsync      ),
229
                .Tvgdel  ( Tvgdel      ),
230
                .Tvgate  ( Tvgate      ),
231
                .Tvlen   ( Tvlen       ),
232
                .eol     ( eol         ),
233
                .eof     ( eof         ),
234
                .gate    ( gate        ),
235
                .hsync   ( ihsync      ),
236
                .vsync   ( ivsync      ),
237
                .csync   ( icsync      ),
238
                .blank   ( iblank      )
239
        );
240 17 rherveille
 
241
        //
242
        // from pixel-clock-domain to master-clock-domain
243
        //
244
        reg seol, seof;   // synchronized end-of-line, end-of-frame
245
        reg dseol, dseof; // delayed seol, seof
246
 
247 53 rherveille
        always @(posedge clk_i)
248
          if (~ctrl_ven)
249
            begin
250
                seol  <= #1 1'b0;
251
                dseol <= #1 1'b0;
252 17 rherveille
 
253 53 rherveille
                seof  <= #1 1'b0;
254
                dseof <= #1 1'b0;
255 17 rherveille
 
256 53 rherveille
                eoh   <= #1 1'b0;
257
                eov   <= #1 1'b0;
258
            end
259
          else
260
            begin
261
                seol  <= #1 eol;
262
                dseol <= #1 seol;
263 17 rherveille
 
264 53 rherveille
                seof  <= #1 eof;
265
                dseof <= #1 seof;
266 37 rherveille
 
267 53 rherveille
                eoh   <= #1 seol & !dseol;
268
                eov   <= #1 seof & !dseof;
269
            end
270 37 rherveille
 
271 57 rherveille
 
272
`ifdef VGA_12BIT_DVI
273 53 rherveille
        always @(posedge pclk_i)
274
          if (pclk_ena)
275
            begin
276
                hsync_o <= #1 ihsync ^ ctrl_HSyncL;
277
                vsync_o <= #1 ivsync ^ ctrl_VSyncL;
278
                csync_o <= #1 icsync ^ ctrl_CSyncL;
279
                blank_o <= #1 iblank ^ ctrl_BlankL;
280
            end
281 57 rherveille
`else
282
        reg hsync, vsync, csync, blank;
283
        always @(posedge pclk_i)
284
            begin
285
                hsync <= #1 ihsync ^ ctrl_HSyncL;
286
                vsync <= #1 ivsync ^ ctrl_VSyncL;
287
                csync <= #1 icsync ^ ctrl_CSyncL;
288
                blank <= #1 iblank ^ ctrl_BlankL;
289 53 rherveille
 
290 57 rherveille
                hsync_o <= #1 hsync;
291
                vsync_o <= #1 vsync;
292
                csync_o <= #1 csync;
293
                blank_o <= #1 blank;
294
            end
295
`endif
296 53 rherveille
 
297
 
298 57 rherveille
 
299 53 rherveille
        //////////////////////////////////
300
        //
301
        // Pixel generator section
302
        //
303
 
304
        wire [23:0] color_proc_q;           // data from color processor
305
        wire        color_proc_wreq;
306
        wire [ 7:0] clut_offs;               // color lookup table offset
307
 
308
        wire ImDoneFifoQ;
309
        reg  dImDoneFifoQ, ddImDoneFifoQ;
310
 
311
        wire [23:0] cur1_q;
312
        wire        cur1_wreq;
313
 
314
        wire [23:0] rgb_fifo_d;
315
        wire        rgb_fifo_empty, rgb_fifo_full, rgb_fifo_rreq, rgb_fifo_wreq;
316
 
317
        wire sclr = ~ctrl_ven;
318
 
319
        //
320
        // hookup color processor
321
        vga_colproc color_proc (
322
                .clk               ( clk_i               ),
323
                .srst              ( sclr                ),
324
                .vdat_buffer_di    ( fb_data_fifo_q      ), //data_fifo_q),
325
                .ColorDepth        ( ctrl_cd             ),
326
                .PseudoColor       ( ctrl_pc             ),
327
                .vdat_buffer_empty ( fb_data_fifo_empty  ), //data_fifo_empty),
328
                .vdat_buffer_rreq  ( fb_data_fifo_rreq   ), //data_fifo_rreq),
329
                .rgb_fifo_full     ( rgb_fifo_full       ),
330
                .rgb_fifo_wreq     ( color_proc_wreq     ),
331
                .r                 ( color_proc_q[23:16] ),
332
                .g                 ( color_proc_q[15: 8] ),
333
                .b                 ( color_proc_q[ 7: 0] ),
334
                .clut_req          ( clut_req            ),
335
                .clut_ack          ( clut_ack            ),
336
                .clut_offs         ( clut_offs           ),
337
                .clut_q            ( clut_q              )
338
        );
339
 
340
        //
341
        // clut bank switch / cursor data delay2: Account for ColorProcessor DataBuffer delay
342
        always @(posedge clk_i)
343
          if (sclr)
344
            dImDoneFifoQ <= #1 1'b0;
345
          else if (fb_data_fifo_rreq)
346
            dImDoneFifoQ <= #1 ImDoneFifoQ;
347
 
348
        always @(posedge clk_i)
349
          if (sclr)
350
            ddImDoneFifoQ <= #1 1'b0;
351
          else
352
            ddImDoneFifoQ <= #1 dImDoneFifoQ;
353
 
354
        assign clut_switch = ddImDoneFifoQ & !dImDoneFifoQ;
355
 
356
        always @(posedge clk_i)
357
          if (sclr)
358
            stat_acmp <= #1 1'b0;
359
          else if (ctrl_cbsw)
360
            stat_acmp <= #1 stat_acmp ^ clut_switch;  // select next clut when finished reading clut for current video bank (and bank switch enabled)
361
 
362
        // generate clut-address
363
        assign clut_adr = {stat_acmp, clut_offs};
364
 
365
 
366
        //
367
        // hookup data-source-selector && hardware cursor module
368
`ifdef VGA_HWC1 // generate Hardware Cursor1 (if enabled)
369
        wire cursor1_ld_strb;
370
        reg scursor1_en;
371
        reg scursor1_res;
372
        reg [31:0] scursor1_xy;
373
 
374
        assign cursor1_ld_strb = ddImDoneFifoQ & !dImDoneFifoQ;
375
 
376
        always @(posedge clk_i)
377
          if (sclr)
378
            scursor1_en <= #1 1'b0;
379
          else if (cursor1_ld_strb)
380
            scursor1_en <= #1 cursor1_en;
381
 
382
        always @(posedge clk_i)
383
          if (cursor1_ld_strb)
384
            scursor1_xy <= #1 cursor1_xy;
385
 
386
        always @(posedge clk_i)
387
          if (cursor1_ld_strb)
388
            scursor1_res <= #1 cursor1_res;
389
 
390
        vga_curproc hw_cursor1 (
391
                .clk           ( clk_i           ),
392
                .rst_i         ( sclr            ),
393
                .Thgate        ( Thgate          ),
394
                .Tvgate        ( Tvgate          ),
395
                .idat          ( color_proc_q    ),
396
                .idat_wreq     ( color_proc_wreq ),
397
                .cursor_xy     ( scursor1_xy     ),
398
                .cursor_res    ( scursor1_res    ),
399
                .cursor_en     ( scursor1_en     ),
400
                .cursor_wadr   ( cursor_adr      ),
401
                .cursor_we     ( cursor1_we      ),
402
                .cursor_wdat   ( dat_i           ),
403
                .cc_adr_o      ( cc1_adr_o       ),
404
                .cc_dat_i      ( cc1_dat_i       ),
405
                .rgb_fifo_wreq ( cur1_wreq       ),
406
                .rgb           ( cur1_q          )
407
        );
408
 
409
`ifdef VGA_HWC0 // generate additional signals for Hardware Cursor0 (if enabled)
410
        reg sddImDoneFifoQ, sdImDoneFifoQ;
411
 
412
        always @(posedge clk_i)
413
          if (cur1_wreq)
414
            begin
415
                sdImDoneFifoQ  <= #1 dImDoneFifoQ;
416
                sddImDoneFifoQ <= #1 sdImDoneFifoQ;
417
            end
418
`endif
419
 
420
`else           // Hardware Cursor1 disabled, generate pass-through signals
421
        assign cur1_wreq = color_proc_wreq;
422
        assign cur1_q    = color_proc_q;
423
 
424
        assign cc1_adr_o  = 4'h0;
425
 
426
`ifdef VGA_HWC0 // generate additional signals for Hardware Cursor0 (if enabled)
427
        wire sddImDoneFifoQ, sdImDoneFifoQ;
428
 
429
        assign sdImDoneFifoQ  = dImDoneFifoQ;
430
        assign sddImDoneFifoQ = ddImDoneFifoQ;
431
`endif
432
 
433
`endif
434
 
435
 
436
`ifdef VGA_HWC0 // generate Hardware Cursor0 (if enabled)
437
        wire cursor0_ld_strb;
438
        reg scursor0_en;
439
        reg scursor0_res;
440
        reg [31:0] scursor0_xy;
441
 
442
        assign cursor0_ld_strb = sddImDoneFifoQ & !sdImDoneFifoQ;
443
 
444
        always @(posedge clk_i)
445
          if (sclr)
446
            scursor0_en <= #1 1'b0;
447
          else if (cursor0_ld_strb)
448
            scursor0_en <= #1 cursor0_en;
449
 
450
        always @(posedge clk_i)
451
          if (cursor0_ld_strb)
452
            scursor0_xy <= #1 cursor0_xy;
453
 
454
        always @(posedge clk_i)
455
          if (cursor0_ld_strb)
456
            scursor0_res <= #1 cursor0_res;
457
 
458
        vga_curproc hw_cursor0 (
459
                .clk           ( clk_i         ),
460
                .rst_i         ( sclr          ),
461
                .Thgate        ( Thgate        ),
462
                .Tvgate        ( Tvgate        ),
463
                .idat          ( ssel1_q       ),
464
                .idat_wreq     ( ssel1_wreq    ),
465
                .cursor_xy     ( scursor0_xy   ),
466
                .cursor_en     ( scursor0_en   ),
467
                .cursor_res    ( scursor0_res  ),
468
                .cursor_wadr   ( cursor_adr    ),
469
                .cursor_we     ( cursor0_we    ),
470
                .cursor_wdat   ( dat_i         ),
471
                .cc_adr_o      ( cc0_adr_o     ),
472
                .cc_dat_i      ( cc0_dat_i     ),
473
                .rgb_fifo_wreq ( rgb_fifo_wreq ),
474
                .rgb           ( rgb_fifo_d    )
475
        );
476
`else   // Hardware Cursor0 disabled, generate pass-through signals
477
        assign rgb_fifo_wreq = cur1_wreq;
478
        assign rgb_fifo_d = cur1_q;
479
 
480
        assign cc0_adr_o  = 4'h0;
481
`endif
482
 
483
        //
484
        // hookup RGB buffer (temporary station between WISHBONE-clock-domain
485
        // and pixel-clock-domain)
486
        // The cursor_processor pipelines introduce a delay between the color
487
        // processor's rgb_fifo_wreq and the rgb_fifo_full signals. To compensate
488
        // for this we double the rgb_fifo.
489 57 rherveille
        wire [4:0] rgb_fifo_nword;
490 53 rherveille
 
491
        vga_fifo #(4, 24) rgb_fifo (
492
                .clk    ( clk_i          ),
493
                .aclr   ( 1'b1           ),
494
                .sclr   ( sclr           ),
495
                .d      ( rgb_fifo_d     ),
496
                .wreq   ( rgb_fifo_wreq  ),
497
                .q      ( line_fifo_d    ),
498
                .rreq   ( rgb_fifo_rreq  ),
499
                .empty  ( rgb_fifo_empty ),
500
                .nword  ( rgb_fifo_nword ),
501
                .full   ( ),
502
                .aempty ( ),
503
                .afull  ( )
504
        );
505
 
506 57 rherveille
        assign rgb_fifo_full = rgb_fifo_nword[3]; // actually half full
507 53 rherveille
 
508
        assign line_fifo_rreq = gate & pclk_ena;
509
 
510
        assign rgb_fifo_rreq = ~line_fifo_full & ~rgb_fifo_empty;
511
        assign line_fifo_wreq = rgb_fifo_rreq;
512
 
513
        wire [7:0] r = line_fifo_q[23:16];
514
        wire [7:0] g = line_fifo_q[15: 8];
515
        wire [7:0] b = line_fifo_q[ 7: 0];
516
 
517
        always @(posedge pclk_i)
518
          if (pclk_ena) begin
519
            r_o <= #1 r;
520
            g_o <= #1 g;
521
            b_o <= #1 b;
522
          end
523
 
524
 
525
        //
526
        // DVI section
527
        //
528
 
529
`ifdef VGA_12BIT_DVI
530
        reg [11:0] dvi_d_o;
531
        reg        dvi_de_o;
532
        reg        dvi_hsync_o;
533
        reg        dvi_vsync_o;
534
 
535
        reg [11:0] pA, pB;
536
        reg        dgate, ddgate;
537
        reg        dhsync, ddhsync;
538
        reg        dvsync, ddvsync;
539
 
540
        always @(posedge pclk_i)
541
          if (pclk_ena)
542
            case (ctrl_dvi_odf) // synopsys full_case parallel_case
543
              2'b00: pA <= #1 {g[3:0], b[7:0]};
544
              2'b01: pA <= #1 {g[4:2], b[7:3], g[0], b[2:0]};
545
              2'b10: pA <= #1 {g[4:2], b[7:3], 4'h0};
546
              2'b11: pA <= #1 {g[5:3], b[7:3], 4'h0};
547
            endcase
548
 
549
        always @(posedge pclk_i)
550
          if (pclk_ena)
551
            case (ctrl_dvi_odf) // synopsys full_case parallel_case
552
              2'b00: pB <= #1 {r[7:0], g[7:4]};
553
              2'b01: pB <= #1 {r[7:3], g[7:5], r[2:0], g[1]};
554
              2'b10: pB <= #1 {r[7:3], g[7:5], 4'h0};
555
              2'b11: pB <= #1 {1'b0, r[7:3], g[7:6], 4'h0};
556
            endcase
557
 
558
        always @(posedge pclk_i)
559
          if (pclk_ena)
560
            dvi_d_o <= #1 pB;
561
          else
562
            dvi_d_o <= #1 pA;
563
 
564
        always @(posedge pclk_i)
565
          if (pclk_ena) begin
566
            dgate  <= #1 gate;  // delay once: delayed line fifo output
567
 
568
            dhsync  <= #1 ~ihsync;
569
            ddhsync <= #1 dhsync;
570
 
571
            dvsync  <= #1 ~ivsync;
572
            ddvsync <= #1 dvsync;
573
          end
574
 
575
        always @(posedge pclk_i)
576
          begin
577
              dvi_de_o    <= #1 dgate;
578
              dvi_hsync_o <= #1 dhsync;
579
              dvi_vsync_o <= #1 dvsync;
580
          end
581
 
582
`endif
583
 
584 17 rherveille
endmodule
585 37 rherveille
 

powered by: WebSVN 2.1.0

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