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

Subversion Repositories bu_pacman

[/] [bu_pacman/] [tags/] [arelease/] [vga_controller.v] - Blame information for rev 3

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 soloist_hu
`timescale 1ns / 1ps
2
//////////////////////////////////////////////////////////////////////////////////
3
// Company: 
4
// Engineer: 
5
// 
6
// Create Date:    17:06:27 11/19/2008 
7
// Design Name: 
8
// Module Name:    vga_controller 
9
// Project Name: 
10
// Target Devices: 
11
// Tool versions: 
12
// Description: 
13
//
14
// Dependencies: 
15
//
16
// Revision: 
17
// Revision 0.01 - File Created
18
// Additional Comments: 
19
//
20
//////////////////////////////////////////////////////////////////////////////////
21
module vga_controller(rst,pixel_clk,HS,VS,hcounter,vcounter,blank);
22
 
23
input rst,pixel_clk;
24
output HS,VS,blank;
25
output [10:0] hcounter,vcounter;
26
 
27
 
28
parameter HMAX = 800; // maxium value for the horizontal pixel counter
29
parameter VMAX = 525; // maxium value for the vertical pixel counter
30
parameter HLINES = 640; // total number of visible columns
31
parameter HFP = 648; // value for the horizontal counter where front porch ends
32
parameter HSP = 744; // value for the horizontal counter where the synch pulse ends
33
parameter VLINES = 480; // total number of visible lines
34
parameter VFP = 482; // value for the vertical counter where the frone proch ends
35
parameter VSP = 484; // value for the vertical counter where the synch pulse ends
36
parameter SPP = 0;
37
 
38
 
39
wire video_enable;
40
reg HS,VS,blank;
41
reg [10:0] hcounter,vcounter;
42
 
43
always@(posedge pixel_clk)begin
44
blank <= ~video_enable; end
45
 
46
always@(posedge pixel_clk)begin
47
    if(rst == 1) hcounter <= 0;
48
    else if (hcounter == HMAX) hcounter <= 0;
49
             else hcounter <= hcounter + 1;
50
end
51
 
52
always@(posedge pixel_clk)begin
53
    if(rst == 1) vcounter <=0;
54
    else if(hcounter == HMAX) begin
55
         if(vcounter == VMAX) vcounter <= 0;
56
         else vcounter <= vcounter + 1; end
57
end
58
 
59
always@(posedge pixel_clk)begin
60
if(hcounter >=HFP && hcounter < HSP) HS <= SPP;
61
else HS <= ~SPP; end
62
 
63
always@(posedge pixel_clk)begin
64
if(vcounter >=VFP && vcounter <VSP) VS <= SPP;
65
else VS <= ~SPP; end
66
 
67
assign video_enable = (hcounter < HLINES && vcounter < VLINES)?1:0;
68
 
69
endmodule

powered by: WebSVN 2.1.0

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