用verilog 如何写vga 显示时钟
2个回答
展开全部
给你我写过的
reg[10:0] x;
reg[10:0] y;
reg vsync,hsync,de;
always@(posedge lcd_pclk or negedge lcd_reset_n)
if(!lcd_reset_n)
x <= 0;
else
x <= (x>=horizontal_width)? 11'd1:x+11'd1;
always@(posedge lcd_pclk or negedge lcd_reset_n)
if(!lcd_reset_n)
hsync <= 0;
else
hsync <= (x>horizontal_sync);
assign lcd_hsync = hsync;
always@(posedge lcd_pclk or negedge lcd_reset_n)
if(!lcd_reset_n)
y <= 0;
else if(x==horizontal_width)
y <= (y>=vertical_width)? 11'd1:y+11'd1;
always@(posedge lcd_pclk or negedge lcd_reset_n)
if(!lcd_reset_n)
vsync <= 0;
else
vsync <= (y>vertical_sync);
assign lcd_vsync = vsync;
always@(posedge lcd_pclk or negedge lcd_reset_n)
if(!lcd_reset_n)
de <= 0;
else
de <= (y>vertical_sync+vertical_back_porch) & (y<=vertical_sync+vertical_back_porch+vertical_active) &
(x>horizontal_sync+horizontal_back_porch) & (x<=horizontal_sync+horizontal_back_porch+horizontal_active);
assign lcd_de = de;
reg[10:0] x;
reg[10:0] y;
reg vsync,hsync,de;
always@(posedge lcd_pclk or negedge lcd_reset_n)
if(!lcd_reset_n)
x <= 0;
else
x <= (x>=horizontal_width)? 11'd1:x+11'd1;
always@(posedge lcd_pclk or negedge lcd_reset_n)
if(!lcd_reset_n)
hsync <= 0;
else
hsync <= (x>horizontal_sync);
assign lcd_hsync = hsync;
always@(posedge lcd_pclk or negedge lcd_reset_n)
if(!lcd_reset_n)
y <= 0;
else if(x==horizontal_width)
y <= (y>=vertical_width)? 11'd1:y+11'd1;
always@(posedge lcd_pclk or negedge lcd_reset_n)
if(!lcd_reset_n)
vsync <= 0;
else
vsync <= (y>vertical_sync);
assign lcd_vsync = vsync;
always@(posedge lcd_pclk or negedge lcd_reset_n)
if(!lcd_reset_n)
de <= 0;
else
de <= (y>vertical_sync+vertical_back_porch) & (y<=vertical_sync+vertical_back_porch+vertical_active) &
(x>horizontal_sync+horizontal_back_porch) & (x<=horizontal_sync+horizontal_back_porch+horizontal_active);
assign lcd_de = de;
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询