1 |
11 |
robfinch |
// ============================================================================
|
2 |
|
|
// 2011 Robert Finch
|
3 |
|
|
//
|
4 |
|
|
// WXGASyncGen1680x1050_60Hz.v
|
5 |
|
|
// WXGA sync generator
|
6 |
|
|
//
|
7 |
|
|
// This source file is free software: you can redistribute it and/or modify
|
8 |
|
|
// it under the terms of the GNU Lesser General Public License as published
|
9 |
|
|
// by the Free Software Foundation, either version 3 of the License, or
|
10 |
|
|
// (at your option) any later version.
|
11 |
|
|
//
|
12 |
|
|
// This source file is distributed in the hope that it will be useful,
|
13 |
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
|
|
// GNU General Public License for more details.
|
16 |
|
|
//
|
17 |
|
|
// You should have received a copy of the GNU General Public License
|
18 |
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19 |
|
|
//
|
20 |
|
|
//
|
21 |
|
|
//
|
22 |
|
|
// WXGA video sync generator.
|
23 |
|
|
//
|
24 |
|
|
// Input clock: 73.529 MHz (50 MHz * 25/17)
|
25 |
|
|
// Horizontal freq: 65.186 kHz (generated)
|
26 |
|
|
// Vertical freq: 59.968 Hz (generated)
|
27 |
|
|
//
|
28 |
|
|
// This module generates the basic sync timing signals required for a
|
29 |
|
|
// WXGA display.
|
30 |
|
|
//
|
31 |
|
|
// Note to self
|
32 |
|
|
// Webpack 13.1i xc3s1200e-4fg320
|
33 |
|
|
// 26 FF's / 53 slices / 97 LUTs / 152.532 MHz (speed Spartan3e-4)
|
34 |
|
|
// ============================================================================
|
35 |
|
|
|
36 |
|
|
module WXGASyncGen1680x1050_60Hz(rst, clk, hSync, vSync, blank, border, eol, eof);
|
37 |
|
|
// 147.136320 MHz
|
38 |
|
|
// 73.56816 Mhz
|
39 |
|
|
// 73.529412 MHz actual 50 * 25/17
|
40 |
|
|
parameter phSyncOn = 48; // 48 front porch
|
41 |
|
|
parameter phSyncOff = 136; // 92 sync
|
42 |
|
|
parameter phBlankOff = 280; // 144 back porch
|
43 |
|
|
parameter phBorderOff = 284; // 4 border
|
44 |
|
|
parameter phBorderOn = 1124; // 840 display
|
45 |
|
|
parameter phBlankOn = 1128; // 4 border
|
46 |
|
|
parameter phTotal = 1128; // 1128 total clocks
|
47 |
|
|
// 65220 = 60 * 1088 kHz
|
48 |
|
|
parameter pvSyncOn = 1; // 1 front porch
|
49 |
|
|
parameter pvSyncOff = 4; // 3 vertical sync
|
50 |
|
|
parameter pvBlankOff = 34; // 30 back porch
|
51 |
|
|
parameter pvBorderOff = 36; // 2 border
|
52 |
|
|
parameter pvBorderOn = 1086; // 1050 display
|
53 |
|
|
parameter pvBlankOn = 1087; // 1 border
|
54 |
|
|
parameter pvTotal = 1087; // 1087 total scan lines
|
55 |
|
|
// 60 Hz
|
56 |
|
|
// 840x1050
|
57 |
|
|
input rst; // reset
|
58 |
|
|
input clk; // video clock
|
59 |
|
|
output hSync, vSync; // sync outputs
|
60 |
|
|
output blank; // blanking output
|
61 |
|
|
output border;
|
62 |
|
|
output eol; // end of line
|
63 |
|
|
output eof; // end of frame
|
64 |
|
|
|
65 |
|
|
//---------------------------------------------------------------------
|
66 |
|
|
//---------------------------------------------------------------------
|
67 |
|
|
|
68 |
|
|
wire [11:0] hCtr; // count from 1 to 2256
|
69 |
|
|
wire [11:0] vCtr; // count from 1 to 1087
|
70 |
|
|
|
71 |
|
|
wire vBlank, hBlank;
|
72 |
|
|
reg blank;
|
73 |
|
|
reg border;
|
74 |
|
|
|
75 |
|
|
assign eol = hCtr == phTotal;
|
76 |
|
|
assign eof = vCtr == pvTotal && eol;
|
77 |
|
|
|
78 |
|
|
assign vSync = vCtr >= pvSyncOn && vCtr < pvSyncOff;
|
79 |
|
|
assign hSync = !(hCtr >= phSyncOn && hCtr < phSyncOff);
|
80 |
|
|
assign vBlank = vCtr >= pvBlankOn || vCtr < pvBlankOff;
|
81 |
|
|
assign hBlank = hCtr >= phBlankOn || hCtr < phBlankOff;
|
82 |
|
|
assign vBorder = vCtr >= pvBorderOn || vCtr < pvBorderOff;
|
83 |
|
|
assign hBorder = hCtr >= phBorderOn || hCtr < phBorderOff;
|
84 |
|
|
|
85 |
|
|
counter #(12) u1 (.rst(rst), .clk(clk), .ce(1'b1), .ld(eol), .d(12'd1), .q(hCtr) );
|
86 |
|
|
counter #(12) u2 (.rst(rst), .clk(clk), .ce(eol), .ld(eof), .d(12'd1), .q(vCtr) );
|
87 |
|
|
|
88 |
|
|
always @(posedge clk)
|
89 |
|
|
blank <= hBlank|vBlank;
|
90 |
|
|
always @(posedge clk)
|
91 |
|
|
border <= hBorder|vBorder;
|
92 |
|
|
|
93 |
|
|
endmodule
|
94 |
|
|
|