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

Subversion Repositories vga_lcd

[/] [vga_lcd/] [tags/] [rel_1/] [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 37 rherveille
//  $Id: vga_pgen.v,v 1.5 2002-04-05 06:24:35 rherveille Exp $
41 17 rherveille
//
42 37 rherveille
//  $Date: 2002-04-05 06:24:35 $
43
//  $Revision: 1.5 $
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 37 rherveille
//               Revision 1.4  2002/01/28 03:47:16  rherveille
51
//               Changed counter-library.
52
//               Changed vga-core.
53
//               Added 32bpp mode.
54
//
55 17 rherveille
 
56
`include "timescale.v"
57
 
58
module vga_pgen (mclk, pclk, ctrl_ven, ctrl_HSyncL, Thsync, Thgdel, Thgate, Thlen,
59
                ctrl_VSyncL, Tvsync, Tvgdel, Tvgate, Tvlen, ctrl_CSyncL, ctrl_BlankL,
60
                eoh, eov, gate, Hsync, Vsync, Csync, Blank);
61
 
62
        // inputs & outputs
63
 
64
        input mclk; // master clock
65
        input pclk; // pixel clock
66
 
67
        input ctrl_ven;           // Video enable signal
68
 
69
        // horiontal timing settings
70
        input        ctrl_HSyncL; // horizontal sync pulse polarization level (pos/neg)
71
        input [ 7:0] Thsync;      // horizontal sync pulse width (in pixels)
72
        input [ 7:0] Thgdel;      // horizontal gate delay (in pixels)
73
        input [15:0] Thgate;      // horizontal gate length (number of visible pixels per line)
74
        input [15:0] Thlen;       // horizontal length (number of pixels per line)
75
 
76
        // vertical timing settings
77
        input        ctrl_VSyncL; // vertical sync pulse polarization level (pos/neg)
78
        input [ 7:0] Tvsync;      // vertical sync pulse width (in lines)
79
        input [ 7:0] Tvgdel;      // vertical gate delay (in lines)
80
        input [15:0] Tvgate;      // vertical gate length (number of visible lines in frame)
81
        input [15:0] Tvlen;       // vertical length (number of lines in frame)
82
 
83
        // composite signals
84
        input ctrl_CSyncL; // composite sync pulse polarization level
85
        input ctrl_BlankL; // blank signal polarization level
86
 
87
        // status outputs
88
        output eoh;        // end of horizontal
89
        reg eoh;
90
        output eov;        // end of vertical;
91
        reg eov;
92
        output gate;       // vertical AND horizontal gate (logical AND function)
93
 
94
        // pixel control outputs
95
        output Hsync;      // horizontal sync pulse
96
        output Vsync;      // vertical sync pulse
97
        output Csync;      // composite sync: Hsync OR Vsync (logical OR function)
98
        output Blank;      // blanking signal
99
 
100
 
101
        //
102
        // variable declarations
103
        //
104
        reg nVen; // video enable signal (active low)
105
        wire eol, eof;
106
 
107
        //
108
        // module body
109
        //
110
 
111
        // synchronize timing/control settings (from master-clock-domain to pixel-clock-domain)
112
        always@(posedge pclk)
113
                nVen    <= #1 !ctrl_ven;
114
 
115
        // hookup video timing generator
116
        vga_tgen vtgen(.clk(pclk), .rst(nVen), .HSyncL(ctrl_HSyncL), .Thsync(Thsync), .Thgdel(Thgdel), .Thgate(Thgate), .Thlen(Thlen),
117
                .VSyncL(ctrl_VSyncL), .Tvsync(Tvsync), .Tvgdel(Tvgdel), .Tvgate(Tvgate), .Tvlen(Tvlen), .CSyncL(ctrl_CSyncL), .BlankL(ctrl_BlankL),
118
                .eol(eol), .eof(eof), .gate(gate), .Hsync(Hsync), .Vsync(Vsync), .Csync(Csync), .Blank(Blank));
119
 
120
        //
121
        // from pixel-clock-domain to master-clock-domain
122
        //
123
        reg seol, seof;   // synchronized end-of-line, end-of-frame
124
        reg dseol, dseof; // delayed seol, seof
125
 
126
        always@(posedge mclk)
127 37 rherveille
                if (!ctrl_ven)
128
                        begin
129
                                seol  <= #1 1'b0;
130
                                dseol <= #1 1'b0;
131 17 rherveille
 
132 37 rherveille
                                seof  <= #1 1'b0;
133
                                dseof <= #1 1'b0;
134 17 rherveille
 
135 37 rherveille
                                eoh   <= #1 1'b0;
136
                                eov   <= #1 1'b0;
137
                        end
138
                else
139
                        begin
140
                                seol  <= #1 eol;
141
                                dseol <= #1 seol;
142 17 rherveille
 
143 37 rherveille
                                seof  <= #1 eof;
144
                                dseof <= #1 seof;
145
 
146
                                eoh   <= #1 seol & !dseol;
147
                                eov   <= #1 seof & !dseof;
148
                        end
149
 
150 17 rherveille
endmodule
151 37 rherveille
 

powered by: WebSVN 2.1.0

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