- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
`timescale 1ns / 1ps
///////////////////////////////////////////////////////////////////
///////////////
// Company:
// Engineer:
//
// Create Date: 2016/03/28 22:19:17
// Design Name:
// Module Name: vga
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
///////////////////////////////////////////////////////////////////
///////////////
module vga(
input clk,
input rst,
output reg hs,
output reg vs,
output [3:0] r,
output [3:0] g,
output [3:0] b
);
//maximum value for the horizontal pixel counter
parameter HMAX=10b1100100000; // 800
//maximum value for the vertical pixel counter
parameter VMAX=10b1000001101; // 525
//total number of visible columns
parameter HS_WIDTH=10b0001100000; //96
//HS pluse width
parameter HP=10b0000101000; //40
//H Back Porch
parameter HLB=10b0000001000; //8
//H Left Board
parameter LEFT_NO_DISPLAY_ZONE=HS_WIDTH+HP+HLB;
// horizontal and vertical counters
reg [9:0] hcounter=10b0000000000;
reg [9:0] vcounter=10b0000000000;
reg [11:0] color=12b000000000000;
// active when inside visible screen area.
wire video_enable ;
reg vidon;
assign r=color[11:8];
assign g=color[7:4];
assign b=color[3:0];
// increment horizontal counter at pixel_clk rate
// until HMAX is reached, then reset and keep counting
always @(posedge clk or posedge rst)
begin
if(rst)
begin
hcounter=10b0000000000;
hs=1;
end
else
begin
if(hcounter HMAX-1)
hcounter=10b0000000000;
else
hcounter = hcounter+1;
if(hcounter96)
hs=0;
else
hs=1;
end
end
//increment vertical counter when one line is finished
//(horizontal counter reached HMAX)
//until VMAX is reached, then reset and keep counting
always @(posedge clk or posedge rst)
begin
if(rst)
begin
vcount
文档评论(0)