之前用FPGA做过视频时序方面的设计,现将视频时序的设计方法分享给大家,希望对大家有所帮助。

时序部分可以参考CEA-861D,VESA时序标准。

1080P一帧视频中,一行有2200个像素,其中280个像素为消影区像素,1920个像素为有效像素。 一场有1125行,其中45行为消影区,1080个有效行。

1080P@60的时钟计算方法: 2200x1125x60=148500000, 即148.5MHz。

1080P的时序图请参考如下图所示:

通过以上两幅图,我们可以很好地理解视频时序,在每一行的开始前和结束后,都是Blank。

我们可以通过设计计数器的方法来实现 代码如下:

`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer: Ricky
//
// Create Date: 16:38:46 04/17/2019
// Design Name: Video timming generator
// Module Name: Video_timming
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module Video_timming(
input wire clk,
input wire reset_n,
output reg hsync_out,
output reg hblank_out,
output reg vsync_out,
output reg vblank_out,
output reg DE_out ); ////////////////////hsblnk means the biggest active pixels from 0~1919, and it's the begining of hblank.
////////////////////hssync means the active pixels + Front Proch, and it's the begining of hsync signal.
////////////////////hesync means the active pixels + Front Proch + hsync, it's the end of hsync signal.
////////////////////heblnk means the biggest line pixels from 0~2199,it's the end of a line. ////////////////////vsblnk means the biggest active lines from 0~1079, and it's the begining of vblank.
////////////////////vssync means the active lines + V Front Proch, and it's the begining of vsync signal.
////////////////////vesync means the active lines + V Front Proch + vsync, it's the end of vsync signal.
////////////////////veblnk means the biggest lines from 0~1124, it's the end of a frame. parameter [:] tc_hsblnk = 'b0111_0111_1111; //hsblnk_1080P = 1920-1 = 1919
parameter [:] tc_hssync = 'b0111_1101_0111; //hssync_1080P = 1919 + 88 = 2007
parameter [:] tc_hesync = 'b1000_0000_0011; //hesync_1080P = 1919 + 88 + 44 = 2051
parameter [:] tc_heblnk = 'b1000_1001_0111; //heblnk_1080P = 1919 + 88 + 44 + 148 = 2199
parameter [:] tc_vsblnk = 'b0100_0011_0111; //vsblnk_1080P = 1080 -1 =1079
parameter [:] tc_vssync = 'b0100_0011_1011; //vssync_1080P = 1079 + 4 = 1083
parameter [:] tc_vesync = 'b0100_0100_0000; //vesync_1080P = 1079 + 4 + 5 = 1088
parameter [:] tc_veblnk = 'b0100_0110_0100; //veblnk_1080P = 1079 + 4 + 5 + 36 = 1124 reg reg0;
reg reg1;
wire rst_n;
reg hsync,vsync,hblank,vblank;
reg [:] pixel_cnt,h_cnt,h_cntb; always @ (posedge clk or negedge reset_n) //这里使用同步复位异步释放的方法设计复位
begin
if ( reset_n == 'b0)begin
reg0 <= ;
reg1 <= ;
end
else begin
reg0 <= ;
reg1 <= reg0;
end
end assign rst_n = reg1; always @ (posedge clk or negedge rst_n) begin // Pixel clock count
if(!rst_n)
pixel_cnt <= 'd0;
else
if(pixel_cnt >= tc_heblnk) //
pixel_cnt <= 'd0;
else
pixel_cnt <= pixel_cnt + ;
end always @ (posedge clk or negedge rst_n) begin// generate hsync
if(!rst_n)
hsync <= 'b0;
else
if((pixel_cnt >= tc_hssync) && (pixel_cnt < tc_hesync))//2007 //
hsync <= 'b1;
else
hsync <= 'b0;
end always @ (posedge clk or negedge rst_n) begin // generate hblank
if(!rst_n)
hblank <= 'b1;
else
if((pixel_cnt >= tc_hsblnk) && (pixel_cnt < tc_heblnk)) //1919 //
hblank <= 'b1;
else
hblank <= 'b0;
end always @ (posedge clk or negedge rst_n) begin //Line count
if(!rst_n)
h_cnt <= 'd0;
else
if(h_cnt > tc_veblnk) //
h_cnt <= 'd0;
else
if(pixel_cnt == tc_hssync-) //
h_cnt <= h_cnt + ;
else
h_cnt <= h_cnt;
end always @ (posedge clk or negedge rst_n) begin // Generate vsync
if(!rst_n)
vsync <= 'b0;
else
if ((h_cnt > tc_vssync) && (h_cnt <= tc_vesync)) //1083 //
vsync <= 'b1;
else
vsync <= 'b0;
end always @ (posedge clk or negedge rst_n) begin //Line Countb
if(!rst_n)
h_cntb <= 'd0;
else
if(h_cntb > tc_veblnk) //
h_cntb <= 'd0;
else
if(pixel_cnt == tc_hsblnk - ) //
h_cntb <= h_cntb + ;
else
h_cntb <= h_cntb;
end always @ (posedge clk or negedge rst_n) begin // Generate vblank
if(!rst_n)
vblank <= 'b1;
else
if((h_cntb > tc_vsblnk) && (h_cntb <= tc_veblnk)) //1079 //
vblank <= 'b1;
else
vblank <= 'b0;
end always @ (posedge clk or negedge rst_n) begin // Generate output singles
if(!rst_n) begin
hsync_out <= 'b0;
vsync_out <= 'b0;
hblank_out <= 'b0;
vblank_out <= 'b0;
DE_out <= 'b0;
end
else
begin
hsync_out <= hsync;
vsync_out <= vsync;
hblank_out <= hblank;
vblank_out <= vblank;
DE_out <= (~ hblank) & (~ vblank);
end
end endmodule

TB如下:

`timescale 1ns/1ns

module TB_Timing_gen;

reg clk, reset_n;
wire hsync,vsync,de,hblank,vblank; initial begin
clk = ;
reset_n = ;
#
reset_n = ;
end always # clk = ~clk; Video_timming timing_inst(
.clk (clk),
.reset_n (reset_n),
.hsync_out (hsync),
.hblank_out (hblank),
.vsync_out (vsync),
.vblank_out (vblank),
.DE_out (de) ); endmodule

波形如下:

 每行有1920个像素。

 hsync, DE,hblank的关系。

Vblan, Vsync和DE的关系,和hsync的关系。

原创代码,转载请注明出处,该部分已经申请发明专利,只是这里是用verilog写的,之前专利是用VHDL写的。

基于FPGA的视频时序生成的更多相关文章

  1. 基于FPGA视频时序生成中的库文件

    上一篇分享了一个视频时序生成代码,下面我根据之前项目中用到的时序,对各个参数做了库文件,方便调用. -- -- Package File Template -- -- Purpose: This pa ...

  2. 基于FPGA的DDR3多端口读写存储管理系统设计

    基于FPGA的DDR3多端口读写存储管理系统设计 文章出处:电子技术设计 发布时间: 2015/03/12 | 1747 次阅读 每天新产品 时刻新体验专业薄膜开关打样工厂,12小时加急出货   机载 ...

  3. 基于FPGA的图像去噪

    目录 结构图 其中FPGA 控制模块为核心,通过它实现视频图像数据的获取.缓存.处理和控制各模块间通讯[1].由CCD 相机对目标成像,高速图像数据由camera link 实时传输[2],经信号转换 ...

  4. 基于Xilinx FPGA的视频图像采集系统

    本篇要分享的是基于Xilinx FPGA的视频图像采集系统,使用摄像头采集图像数据,并没有用到SDRAM/DDR.这个工程使用的是OV7670 30w像素摄像头,用双口RAM做存储,显示窗口为320x ...

  5. 基于FPGA的LCD+CMOS视频采集显示使用小结

    基于FPGA的LCD+CMOS视频采集显示 液晶显示器采用扫描模式,RGB888 电源采用:+5V供电 usb供电有时候会出现供电不足的问题 显示器接口有两种选择:16bit或24bit  分别对应 ...

  6. 优化基于FPGA的深度卷积神经网络的加速器设计

    英文论文链接:http://cadlab.cs.ucla.edu/~cong/slides/fpga2015_chen.pdf 翻译:卜居 转载请注明出处:http://blog.csdn.net/k ...

  7. 基于FPGA的VGA可移植模块终极设计【转】

    本文转载自:http://www.cnblogs.com/lueguo/p/3373643.html 略过天涯   基于FPGA的VGA可移植模块终极设计 一.VGA的诱惑 首先,VGA的驱动,这事, ...

  8. FPGA经典:Verilog传奇与基于FPGA的数字图像处理原理及应用

    一 简述 最近恶补基础知识,借了<<Verilog传奇>>,<基于FPGA的嵌入式图像处理系统设计>和<<基千FPGA的数字图像处理原理及应用>& ...

  9. 基于FPGA的线阵CCD图像测量系统研究——笔记

    本文是对基于FPGA的线阵CCD图像测量系统研究(作者:高尚)的阅读笔记 第一章绪论 1. 读读看 读了前面的摘要依然没有看懂作者要做什么.接着往下读....终于看到了一个字眼“基于机器视觉的图像测量 ...

随机推荐

  1. Matlab将多项式的系数设为0

    符号运算时有些多项式的系数值接近于0,像这样 fun = 3.5753839759325595498222646101085e-49*x + 1.836709923159824231201150839 ...

  2. OpenCV绘制图像中RGB三个通道的直方图

    一开始是看<OpenCV计算机视觉编程攻略(第2版)>这本书学做直方图,但是书本里说直方图的部分只详细说了黑白图像(单通道)的直方图绘制方法,RGB图像的直方图只说了如何计算,没有说计算完 ...

  3. Python Basic 01.Basic

    01.variable ''' 변수(variable) - 자료(data)를 임시(휘발성) 저장하는 역할 - 실제 자료가 아닌 자료의 주소를 저장한다.(참조변수) ''' # 1. 변수 ...

  4. POJ 1208 The Blocks Problem --vector

    http://poj.org/problem?id=1208 晚点仔细看 https://blog.csdn.net/yxz8102/article/details/53098575 #include ...

  5. 安装Visual C++ 6.0后报错:应用程序无法正常启动(0xc0000142)

    最近在安装Visual C++ 6.0时,本来想用个中文版的,结果刚安装好就报了这个错误 百度后发现是由于汉化后的Visual C++ 6.0与win10不兼容造成的 解决办法就是替换程序,把中文版的 ...

  6. Huginn定时时间不准确或延后问题

    碰巧遇到的:Huginn定时为每天晚上九点执行的任务,却在午后1点执行了, 查了下,午后一点,正好是太平洋时间前一天的晚上9点,一开始没考虑到,午后调试程序,它莫名其妙执行了一次,才发现问题, 那就换 ...

  7. Django 启动源码

    handler = self.get_handler(*args, **options) run(self.addr, int(self.port), handler,ipv6=self.use_ip ...

  8. nodejs+koa在header里面添加header信息

    参考:https://koa.bootcss.com/ ctx.append('resultCode', '0000'); ctx.append('resultMessage', 'success') ...

  9. phpstorm设置篇

    1.设置全局字体编码: File->settings->Editor->File Encodings 进入这个页面后,有个Global Encoding , 默认是 UTF8 ,如果 ...

  10. JS对象2

    1.Date对象 创建对象 //方法1:不指定参数 var nowd1=new Date(); alert(nowd1.toLocaleString( )); //方法2:参数为日期字符串 var n ...