1 |
23 |
rherveille |
/////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// WISHBONE rev.B2 compliant VGA/LCD Core; Timing Generator ////
|
4 |
|
|
//// Horizontal and Vertical Timing Generator ////
|
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 |
28 |
rherveille |
// $Id: vga_tgen.v,v 1.4 2002-01-28 03:47:16 rherveille Exp $
|
41 |
17 |
rherveille |
//
|
42 |
28 |
rherveille |
// $Date: 2002-01-28 03:47:16 $
|
43 |
|
|
// $Revision: 1.4 $
|
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 |
17 |
rherveille |
|
51 |
|
|
`include "timescale.v"
|
52 |
|
|
|
53 |
|
|
module vga_tgen(clk, rst, HSyncL, Thsync, Thgdel, Thgate, Thlen, VSyncL, Tvsync, Tvgdel, Tvgate, Tvlen, CSyncL, BlankL,
|
54 |
|
|
eol, eof, gate, Hsync, Vsync, Csync, Blank);
|
55 |
|
|
// inputs & outputs
|
56 |
|
|
input clk;
|
57 |
|
|
input rst;
|
58 |
|
|
// horizontal timing settings inputs
|
59 |
|
|
input HSyncL; // horizontal sync pulse polarization level (pos/neg)
|
60 |
|
|
input [ 7:0] Thsync; // horizontal sync pule width (in pixels)
|
61 |
|
|
input [ 7:0] Thgdel; // horizontal gate delay
|
62 |
|
|
input [15:0] Thgate; // horizontal gate (number of visible pixels per line)
|
63 |
|
|
input [15:0] Thlen; // horizontal length (number of pixels per line)
|
64 |
|
|
// vertical timing settings inputs
|
65 |
|
|
input VSyncL; // vertical sync pulse polarization level (pos/neg)
|
66 |
|
|
input [ 7:0] Tvsync; // vertical sync pule width (in pixels)
|
67 |
|
|
input [ 7:0] Tvgdel; // vertical gate delay
|
68 |
|
|
input [15:0] Tvgate; // vertical gate (number of visible pixels per line)
|
69 |
|
|
input [15:0] Tvlen; // vertical length (number of pixels per line)
|
70 |
|
|
|
71 |
|
|
input CSyncL; // composite sync level (pos/neg)
|
72 |
|
|
input BlankL; // blanking level
|
73 |
|
|
|
74 |
|
|
// outputs
|
75 |
|
|
output eol; // end of line
|
76 |
|
|
output eof; // end of frame
|
77 |
|
|
output gate; // vertical AND horizontal gate (logical AND function)
|
78 |
|
|
|
79 |
|
|
output Hsync; // horizontal sync pulse
|
80 |
|
|
output Vsync; // vertical sync pulse
|
81 |
|
|
output Csync; // composite sync
|
82 |
|
|
output Blank; // blank signal
|
83 |
|
|
|
84 |
|
|
//
|
85 |
|
|
// variable declarations
|
86 |
|
|
//
|
87 |
|
|
wire Hgate, Vgate;
|
88 |
|
|
wire Hdone;
|
89 |
|
|
wire iHsync, iVsync;
|
90 |
|
|
|
91 |
|
|
//
|
92 |
|
|
// module body
|
93 |
|
|
//
|
94 |
|
|
|
95 |
|
|
// hookup horizontal timing generator
|
96 |
|
|
vga_vtim hor_gen(
|
97 |
|
|
.clk(clk),
|
98 |
|
|
.ena(1'b1),
|
99 |
|
|
.rst(rst),
|
100 |
|
|
.Tsync(Thsync),
|
101 |
|
|
.Tgdel(Thgdel),
|
102 |
|
|
.Tgate(Thgate),
|
103 |
|
|
.Tlen(Thlen),
|
104 |
|
|
.Sync(iHsync),
|
105 |
|
|
.Gate(Hgate),
|
106 |
|
|
.Done(Hdone));
|
107 |
|
|
|
108 |
|
|
|
109 |
|
|
// hookup vertical timing generator
|
110 |
|
|
vga_vtim ver_gen(
|
111 |
|
|
.clk(clk),
|
112 |
|
|
.ena(Hdone),
|
113 |
|
|
.rst(rst),
|
114 |
|
|
.Tsync(Tvsync),
|
115 |
|
|
.Tgdel(Tvgdel),
|
116 |
|
|
.Tgate(Tvgate),
|
117 |
|
|
.Tlen(Tvlen),
|
118 |
|
|
.Sync(iVsync),
|
119 |
|
|
.Gate(Vgate),
|
120 |
|
|
.Done(eof));
|
121 |
|
|
|
122 |
|
|
// assign outputs
|
123 |
|
|
assign eol = Hdone;
|
124 |
|
|
assign gate = Hgate & Vgate;
|
125 |
|
|
|
126 |
|
|
assign Hsync = iHsync ^ HSyncL;
|
127 |
|
|
assign Vsync = iVsync ^ VSyncL;
|
128 |
|
|
assign Csync = (iHsync | iVsync) ^ CSyncL;
|
129 |
|
|
assign Blank = !(gate ^ BlankL);
|
130 |
|
|
endmodule
|