1 |
24 |
robfinch |
// ============================================================================
|
2 |
|
|
// (C) 2012 Robert Finch
|
3 |
|
|
//
|
4 |
|
|
// WXGASyncGen1366x768_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: 85.86 MHz (50 MHz * 12/7) (85.7142)
|
25 |
|
|
// Horizontal freq: 47.7 kHz (generated) (47.619KHz)
|
26 |
|
|
// Vertical freq: 60.00 Hz (generated) (59.89 Hz)
|
27 |
|
|
//
|
28 |
|
|
// This module generates the basic sync timing signals required for a
|
29 |
|
|
// WXGA display.
|
30 |
|
|
//
|
31 |
|
|
// ============================================================================
|
32 |
|
|
|
33 |
|
|
module WXGASyncGen1366x768_60Hz(rst, clk, hSync, vSync, blank, border);
|
34 |
|
|
parameter phSyncOn = 72; // 72 front porch
|
35 |
|
|
parameter phSyncOff = 216; // 144 sync
|
36 |
|
|
parameter phBlankOff = 434; // 212 back porch
|
37 |
|
|
parameter phBorderOff = 434; // 0 border
|
38 |
|
|
parameter phBorderOn = 1800; // 1366 display
|
39 |
|
|
parameter phBlankOn = 1800; // 0 border
|
40 |
|
|
parameter phTotal = 1800; // 1800 total clocks
|
41 |
|
|
// 47.7 = 60 * 795 kHz
|
42 |
|
|
parameter pvSyncOn = 2; // 1 front porch
|
43 |
|
|
parameter pvSyncOff = 5; // 3 vertical sync
|
44 |
|
|
parameter pvBlankOff = 27; // 23 back porch
|
45 |
|
|
parameter pvBorderOff = 27; // 2 border 0
|
46 |
|
|
parameter pvBorderOn = 795; // 768 display
|
47 |
|
|
parameter pvBlankOn = 795; // 1 border 0
|
48 |
|
|
parameter pvTotal = 795; // 795 total scan lines
|
49 |
|
|
// 60 Hz
|
50 |
|
|
// 1366x768
|
51 |
|
|
input rst; // reset
|
52 |
|
|
input clk; // video clock
|
53 |
|
|
output reg hSync, vSync; // sync outputs
|
54 |
|
|
output blank; // blanking output
|
55 |
|
|
output border;
|
56 |
|
|
|
57 |
|
|
//---------------------------------------------------------------------
|
58 |
|
|
//---------------------------------------------------------------------
|
59 |
|
|
|
60 |
|
|
wire [11:0] hCtr; // count from 1 to 1800
|
61 |
|
|
wire [11:0] vCtr; // count from 1 to 795
|
62 |
|
|
|
63 |
|
|
wire vBlank, hBlank;
|
64 |
|
|
wire hSync1,vSync1;
|
65 |
|
|
reg blank;
|
66 |
|
|
reg border;
|
67 |
|
|
|
68 |
|
|
wire eol = hCtr==phTotal;
|
69 |
|
|
wire eof = vCtr==pvTotal && eol;
|
70 |
|
|
|
71 |
|
|
assign vSync1 = vCtr >= pvSyncOn && vCtr < pvSyncOff;
|
72 |
|
|
assign hSync1 = !(hCtr >= phSyncOn && hCtr < phSyncOff);
|
73 |
|
|
assign vBlank = vCtr >= pvBlankOn || vCtr < pvBlankOff;
|
74 |
|
|
assign hBlank = hCtr >= phBlankOn || hCtr < phBlankOff;
|
75 |
|
|
assign vBorder = vCtr >= pvBorderOn || vCtr < pvBorderOff;
|
76 |
|
|
assign hBorder = hCtr >= phBorderOn || hCtr < phBorderOff;
|
77 |
|
|
|
78 |
|
|
counter #(12) u1 (.rst(rst), .clk(clk), .ce(1'b1), .ld(eol), .d(12'd1), .q(hCtr) );
|
79 |
|
|
counter #(12) u2 (.rst(rst), .clk(clk), .ce(eol), .ld(eof), .d(12'd1), .q(vCtr) );
|
80 |
|
|
|
81 |
|
|
always @(posedge clk)
|
82 |
|
|
blank <= #1 hBlank|vBlank;
|
83 |
|
|
always @(posedge clk)
|
84 |
|
|
border <= #1 hBorder|vBorder;
|
85 |
|
|
always @(posedge clk)
|
86 |
|
|
hSync <= #1 hSync1;
|
87 |
|
|
always @(posedge clk)
|
88 |
|
|
vSync <= #1 vSync1;
|
89 |
|
|
|
90 |
|
|
endmodule
|
91 |
|
|
|