CVO实现过程
module vid_cvo #(
parameter H_SYNC = ,
parameter H_FRONT_PORCH = ,
parameter H_BACK_PORCH = ,
parameter V_SYNC = ,
parameter V_FRONT_PORCH = ,
parameter V_BACK_PORCH = )(
input clk,
input rst_p,
input [:] idata,
input ivalid,
input vid_sop,
input vid_eop, // input [5:0] h_sync_pixcels,
// input [5:0] h_front_porch_pixcels,
// input [5:0] h_back_porch_pixcels,
// input [5:0] v_sync_lines,
// input [5:0] v_front_porch_lines,
// input [5:0] v_back_porch_lines, output reg din_ready, input [:] col,
input [:] row, output reg[:] odata,
output reg v_sync,
output reg h_sync,
output reg de ); parameter S_H_SYNC = 'b00;
parameter S_H_BACK_PORCH = 'b01;
parameter S_H_ACTIVE = 'b10;
parameter S_H_FRONT_PORCH = 'b11;
parameter S_V_SYNC = 'b00;
parameter S_V_BACK_PORCH = 'b01;
parameter S_V_ACTIVE = 'b10;
parameter S_V_FRONT_PORCH = 'b11; reg [:] h_pre_state = S_H_SYNC;
reg [:] h_nx_state = S_H_SYNC;
reg [:] v_pre_state = S_V_SYNC;
reg [:] v_nx_state = S_V_SYNC; reg [:] h_cnt = ;
reg [:] v_cnt = ;
reg [:] sync_code = ;
reg de_r = 'b0;
// reg [15:0] data_r1 = 16'd0;
// reg [15:0] data_r2 = 16'd0;
// reg [15:0] data_r3 = 16'd0;
// reg [15:0] data_r4 = 16'd0;
wire fifo_wr_en ;
wire [:] fifo_wr_data;
wire fifo_almost_full;
wire fifo_almost_empty;
wire [:] fifo_rd_data;
reg fifo_rd_en = 'b0;
reg vid_sop_r = 'b0;
wire pos_vid_sop;
reg fifo_rst_p = 'b1;
reg fifo_rd_valid = 'b0;
reg [:] fifo_rd_data_r = 'd0;
reg [:] sync_code_r = 'd0;
reg [:] sync_code_r1 = 'd0;
reg de_r1 = 'b0;
reg de_r2 = 'b0;
reg h_sync_r = 'b0;
reg h_sync_r1 = 'b0;
reg h_sync_r2 = 'b0;
reg v_sync_r = 'b0;
reg v_sync_r1 = 'b0;
reg v_sync_r2 = 'b0; always @( posedge clk )
begin
vid_sop_r <= vid_sop;
end assign pos_vid_sop = {vid_sop_r,vid_sop} == 'b01; assign fifo_wr_en = (vid_sop | vid_eop ) ?'b0: ivalid ?1'b1 :'b0;
assign fifo_wr_data = idata; always @( posedge clk )
begin
if( fifo_almost_empty )
din_ready<= 'b1;
else if( fifo_almost_full )
din_ready <= 'b0;
else
din_ready <= 'b0;
end always @( posedge clk )
begin
if( rst_p )
fifo_rst_p <= 'b1;
else if( pos_vid_sop )
fifo_rst_p <= 'b0;
else
fifo_rst_p <= fifo_rst_p;
end fifo_w18d512 fifo_w18d512_inst (
.clock ( clk ),
.data ( fifo_wr_data ),
.rdreq ( fifo_rd_en ),
.sclr ( fifo_rst_p ),
.wrreq ( fifo_wr_en ),
.almost_full ( fifo_almost_full ),
.almost_empty( fifo_almost_empty),
.empty ( ),
.full ( ),
.q ( fifo_rd_data ),
.usedw ( )
);
always @( posedge clk )
begin
if( h_nx_state == S_H_ACTIVE && v_nx_state == S_V_ACTIVE )
fifo_rd_en <= 'b1;
else
fifo_rd_en <= 'b0;
end always @( posedge clk )
begin
fifo_rd_valid <= fifo_rd_en;
end always @( posedge clk )
begin
if( fifo_rd_valid )
fifo_rd_data_r <= fifo_rd_data;
else
fifo_rd_data_r <= 'd0;
end /*********************************************************************** ***********************************************************************/ always @( posedge clk )//or posedge rst_p
begin
if( fifo_rst_p ) begin
h_pre_state <= S_H_SYNC;
v_pre_state <= S_V_SYNC; end else begin
h_pre_state <= h_nx_state;
v_pre_state <= v_nx_state;
end
end always @( * )
begin
case( h_pre_state )
S_H_SYNC :
if( h_cnt == H_SYNC - )
h_nx_state <= S_H_BACK_PORCH;
else
h_nx_state <= S_H_SYNC; S_H_BACK_PORCH :
begin
if( h_cnt == H_BACK_PORCH - )
h_nx_state <= S_H_ACTIVE;
else
h_nx_state <= S_H_BACK_PORCH;
end
S_H_ACTIVE :
begin
if( h_cnt == col - )
h_nx_state <= S_H_FRONT_PORCH;
else
h_nx_state <= S_H_ACTIVE; end
S_H_FRONT_PORCH :
begin
if( h_cnt == H_FRONT_PORCH - )
h_nx_state <= S_H_SYNC;
else
h_nx_state <= S_H_FRONT_PORCH; end
default:;
endcase end always @( * )
begin
case( v_pre_state )
S_V_SYNC :
begin
if( h_nx_state == S_H_SYNC && h_pre_state == S_H_FRONT_PORCH ) begin
if( v_cnt == V_SYNC - )
v_nx_state = S_V_BACK_PORCH;
else
v_nx_state = S_V_SYNC;
end else begin
v_nx_state = S_V_SYNC;
end
end
S_V_BACK_PORCH :
begin
if( h_nx_state == S_H_SYNC && h_pre_state == S_H_FRONT_PORCH ) begin
if( v_cnt == V_BACK_PORCH - )
v_nx_state = S_V_ACTIVE;
else
v_nx_state = S_V_BACK_PORCH;
end else begin
v_nx_state = S_V_BACK_PORCH;
end
end
S_V_ACTIVE :
begin
if( h_nx_state == S_H_SYNC && h_pre_state == S_H_FRONT_PORCH ) begin
if( v_cnt == row - )
v_nx_state = S_V_FRONT_PORCH;
else
v_nx_state = S_V_ACTIVE;
end else begin
v_nx_state = S_V_ACTIVE;
end end
S_V_FRONT_PORCH :
begin
if( h_nx_state == S_H_SYNC && h_pre_state == S_H_FRONT_PORCH ) begin
if( v_cnt == V_FRONT_PORCH -'b1 )
v_nx_state = S_V_SYNC;
else
v_nx_state = S_V_FRONT_PORCH;
end else begin
v_nx_state = S_V_FRONT_PORCH;
end
end
default:;
endcase
// end else begin
// v_nx_state = v_nx_state;
// end
//
end
/***********************************************************************
cnt
***********************************************************************/
always @( posedge clk )
begin
if( fifo_rst_p ) begin
h_cnt <= ;
end else begin
case( h_nx_state )
S_H_SYNC :
begin
if( h_pre_state == S_H_FRONT_PORCH ) //&& h_cnt == H_FRONT_PORCH -1
h_cnt <= ;
else
h_cnt <= h_cnt + 'b1;
end
S_H_BACK_PORCH :
begin
if( h_pre_state == S_H_SYNC )//&& h_cnt == H_SYNC -1)
h_cnt <= ;
else
h_cnt <= h_cnt + 'b1;
end
S_H_ACTIVE :
begin
if( h_pre_state == S_H_BACK_PORCH)// && h_cnt == H_BACK_PORCH -1)
h_cnt <= ;
else
h_cnt <= h_cnt + 'b1;
end
S_H_FRONT_PORCH :
begin
if( h_pre_state == S_H_ACTIVE )//&& h_cnt == col -1)
h_cnt <= ;
else
h_cnt <= h_cnt + 'b1;
end
default:;
endcase
end
end always @( posedge clk or posedge fifo_rst_p )
begin
if( fifo_rst_p)
v_cnt <= ;
else begin
if( h_nx_state == S_H_SYNC && h_pre_state == S_H_FRONT_PORCH )
begin
case( v_nx_state )
S_V_SYNC :
begin
if( v_pre_state == S_V_FRONT_PORCH )
v_cnt <= ;
else
v_cnt <= v_cnt + 'b1;
end S_V_BACK_PORCH :
begin
if( v_pre_state == S_V_SYNC )
v_cnt <= ;
else
v_cnt <= v_cnt + 'b1;
end
S_V_ACTIVE :
begin
if( v_pre_state == S_V_BACK_PORCH )
v_cnt <= ;
else
v_cnt <= v_cnt + 'b1; end
S_V_FRONT_PORCH :
begin
if( v_pre_state == S_V_ACTIVE )
v_cnt <= ;
else
v_cnt <= v_cnt + 'b1; end
default:;
endcase
end
end
end /***********************************************************************
h_sync v_sync de
***********************************************************************/
always @( posedge clk )
begin
if( h_nx_state == S_H_SYNC )
h_sync_r <= 'b1;
else
h_sync_r <= 'b0;
end always @( posedge clk )
begin
if( v_nx_state == S_V_SYNC )
v_sync_r <= 'b1;
else
v_sync_r <= 'b0;
end always @( posedge clk )
begin
if( h_nx_state == S_H_ACTIVE && v_nx_state == S_V_ACTIVE )
de_r <= 'b1;
else
de_r <= 'b0;
end
/*********************************************************************** ***********************************************************************/ always @( posedge clk )
begin
if(( h_nx_state == S_H_BACK_PORCH) && ( v_nx_state == S_V_SYNC || v_nx_state == S_V_BACK_PORCH || v_nx_state == S_V_FRONT_PORCH))
case( h_cnt )
H_BACK_PORCH - : sync_code <= 'habab;
H_BACK_PORCH - : sync_code <= 'h0000;
H_BACK_PORCH - : sync_code <= 'h0000;
H_BACK_PORCH - : sync_code <= 'hffff;
default:sync_code <= 'd0;
endcase
else if(( h_nx_state == S_H_FRONT_PORCH) && ( v_nx_state == S_V_SYNC || v_nx_state == S_V_BACK_PORCH || v_nx_state == S_V_FRONT_PORCH))
if( h_pre_state == S_H_ACTIVE)
sync_code <= 'hffff;
else begin
case(h_cnt )
: sync_code <= 'h0000;
: sync_code <= 'h0000;
: sync_code <= 'hb6b6;
default:sync_code <= 'd0;
endcase
end
else if(( h_nx_state == S_H_BACK_PORCH) && ( v_nx_state == S_V_ACTIVE)) begin
case(h_cnt )
H_BACK_PORCH - : sync_code <= 'h8080;
H_BACK_PORCH - : sync_code <= 'h0000;
H_BACK_PORCH - : sync_code <= 'h0000;
H_BACK_PORCH - : sync_code <= 'hffff;
default:sync_code <= 'd0;
endcase
end
else if(( h_nx_state == S_H_FRONT_PORCH) && ( v_nx_state == S_V_ACTIVE)) begin
if( h_pre_state == S_H_ACTIVE)
sync_code <= 'hffff;
else begin
case(h_cnt )
: sync_code <= 'h0000;
: sync_code <= 'h0000;
: sync_code <= 'h9d9d;
default:sync_code <= 'd0;
endcase
end
end
else begin
sync_code <= 'd0;
end
end
/***********************************************************************
sync
***********************************************************************/ always @( posedge clk )
begin
sync_code_r <= sync_code;
sync_code_r1<= sync_code_r;
de_r1 <= de_r;
de_r2 <= de_r1;
h_sync_r1 <= h_sync_r;
h_sync_r2 <= h_sync_r1;
v_sync_r1 <= v_sync_r;
v_sync_r2 <= v_sync_r1; end
always @( posedge clk )
begin
odata <= sync_code_r1 + fifo_rd_data_r;
h_sync <= h_sync_r2;
v_sync <= v_sync_r2;
de <= de_r2;
end endmodule
CVO实现过程的更多相关文章
- c++ primer plus 第6版 部分二 5- 8章
---恢复内容开始--- c++ primer plus 第6版 部分二 5- 章 第五章 计算机除了存储外 还可以对数据进行分析.合并.重组.抽取.修改.推断.合成.以及其他操作 1.for ...
- 从CIO、CEO、CFO、COO...到CVO 这22个你了解几个? (史上最完整版)
1.CEO:是Chief Executive Officer的缩写,即首席执行官. 由于市场风云变幻,决策的速度和执行的力度比以往任何时候都更加重要.传统的“董事会决策.经理层执行”的公司体制已经难以 ...
- VIP之CVI CVO
3. VIP CVI CVO 在开始时,对于CVI和CVO是不知道应该怎样去调试的,就是不知道应该从哪里去确认是对还是错. 关于这一点从再次看到关于数据包的格式才明朗的.去分析CVI和输出 ...
- 从源码看Azkaban作业流下发过程
上一篇零散地罗列了看源码时记录的一些类的信息,这篇完整介绍一个作业流在Azkaban中的执行过程,希望可以帮助刚刚接手Azkaban相关工作的开发.测试. 一.Azkaban简介 Azkaban作为开 ...
- DBImport V3.7版本发布及软件稳定性(自动退出问题)解决过程分享
DBImport V3.7介绍: 1:先上图,再介绍亮点功能: 主要的升级功能为: 1:增加(Truncate Table)清表再插入功能: 清掉再插,可以保证两个库的数据一致,自己很喜欢这个功能. ...
- HTML渲染过程详解
无意中看到寒冬关于前端的九个问题,细细想来我也只是对第一.二.九问有所了解,正好也趁着这个机会梳理一下自己的知识体系.由于本人对http协议以及dns对url的解析问题并不了解,所以这里之探讨url请 ...
- iOS可视化动态绘制八种排序过程
前面几篇博客都是关于排序的,在之前陆陆续续发布的博客中,我们先后介绍了冒泡排序.选择排序.插入排序.希尔排序.堆排序.归并排序以及快速排序.俗话说的好,做事儿要善始善终,本篇博客就算是对之前那几篇博客 ...
- lua执行字节码的过程介绍
前面一篇文章中介绍了lua给下面代码生成最终的字节码的整个过程,这次我们来看看lua vm执行这些字节码的过程. foo = "bar" local a, b = "a& ...
- centos7+mono4+jexus5.6.2安装过程中的遇到的问题
过程参考: http://www.linuxdot.net/ http://www.jexus.org/ http://www.mono-project.com/docs/getting-starte ...
随机推荐
- [leetcode]449. Serialize and Deserialize BST序列化反序列化二叉搜索树(尽量紧凑)
Serialization is the process of converting a data structure or object into a sequence of bits so tha ...
- shelve
shelve是对pickle的封装 json & pickle是把所有的数据全部封装,一次性写入文件,而shelve可以把数据分类,以键值对的形式分别写入文件 shelve模块是一个简单的k, ...
- day 20 类与类之间的关系,继承2
类与类之间的关系: 依赖关系 关联关系 聚合关系 组合关系 依赖关系: 大象与冰箱的例子 # 依赖关系,冰箱依赖大象打开 class Elephant: def __init__(self,name) ...
- WEB框架之Django实现分页功能
一 Paginator分页器 1 首先在数据库中生成大量数据 def index(request) book_list = [] for i in rang(1000) book = Book(tit ...
- mvc中webapi添加后没法访问 解决办法
原因:原先项目中没有webapi,后来添加的. 然后就没法正常访问,百度了下发现是 App_Start/WebApiConfig.cs中路由配置多了个api 而且没有加{action}, 然后修改成: ...
- vue项目优化之路由懒加载
const login = () =>import('@/views/login'); export default new Router({ routes:[ { path:'/login', ...
- 函数的有用信息,装饰器 day12
一 函数的有用信息 本函数的功能:绘图功能,实时接收数据并绘图.:return: 绘图需要的数据,返回给前端某标签 def f1(): ''' 本函数的功能:绘图功能,实时接收数据并绘图. :retu ...
- python pyMysql 自定义异常 函数重载
# encoding='utf8'# auth:yanxiatingyu#2018.7.24 import pymysql __all__ = ['Mymysql'] class MyExcept(E ...
- Java的OOP三大特征之一——多态
OOP(面对对象)三大特征之一——多态 What:多态性是指允许不同类的对象对同一消息作出响应,多态性包括参数化多态性和包含多态性,多态性语言具有灵活.抽象.行为共享.代码共享的优势,很好的解决了应用 ...
- sscanf 解析字符串
test.txt中内容如下所示: eth0||192.168.0.2-192.168.0.150 eth2||192.168.0.2-192.168.0.150 想要将其中的ip地址等解析出来: #i ...