赞
踩
1,简洁
bt1120是一种视频数据流格式,面阵为1920*1080。可以利用HD_SDI协议进行高速传输,具有传输距离远,造价便宜,传输稳定等特点,常用于直播,以及一些高端电子设备上。
2,格式:行方向:sav(4T) + 1920 + 消隐(272) + eav(4T)。
列方向 :1-41 行消隐 42-1121 有效行。1121-1125消隐行
代码
module time_1920x1080
(
input i_clk ,
input i_rst ,
input [3:0] i_src_sel , //选择输出数据的格式
output o_field ,
output o_line , //行有效
output [12:0] o_col , //列
output [12:0] o_row , //行
output reg [15:0] o_data //数据
);
//===============================================================================
//SIGNED DEFINE
//===============================================================================
reg [12:0] pix_cnt;
reg [12:0] line_cnt;
wire [31:0] eav;
wire [31:0] sav;
//===============================================================================
//SIGNED DEFINE
//===============================================================================
assign eav[31:0] = o_field ? ( {8'hff,16'd0,8'h9d} ) : ( {8'hff,16'd0,8'hb6} );
assign sav[31:0] = o_field ? ( {8'hff,16'd0,8'h80} ) : ( {8'hff,16'd0,8'hab} );
assign o_field = ( line_cnt[12:0] >= 13'd42 ) & ( line_cnt[12:0] <= 13'd1121 );
assign o_line = ((pix_cnt[12:0] >= 13'd3) & (pix_cnt[12:0] < 13'd1923) & (line_cnt[12:0] >= 13'd42) & (line_cnt[12:0] <= 13'd1121) ) ? 1'b1:1'b0;
assign o_col[12:0] = pix_cnt[12:0];
assign o_row[12:0] = line_cnt[12:0];
//===============================================================================
//BLOCK DESCRIPTION
//===============================================================================
always @(posedge i_clk or posedge i_rst)
begin
if(i_rst)
pix_cnt[12:0] <= 13'd1;
else if(pix_cnt[12:0] == 13'd2200)
pix_cnt[12:0] <= 13'd1;
else
pix_cnt[12:0] <= pix_cnt[12:0] + 1'b1;
end
always @(posedge i_clk or posedge i_rst)
begin
if(i_rst)
line_cnt[12:0] <= 13'd1;
else if(line_cnt[12:0] == 13'd1125)
line_cnt[12:0] <= 13'd1;
else if(pix_cnt[12:0] == 13'd2200)
line_cnt[12:0] <= line_cnt[12:0] + 1'b1;
else ;
end
always @(posedge i_clk or posedge i_rst)
begin
if(i_rst)
o_data[15:0] <= 16'd0;
else
begin
case( i_src_sel[3:0] )
4'b0001:
begin
if(pix_cnt[12:0] == 2200)
o_data[15:0] <= sav[31:16];
else if(pix_cnt[12:0] == 1)
o_data[15:0] <= sav[15:0];
else if(pix_cnt[12:0] == 1922)
o_data[15:0] <= eav[31:16];
else if(pix_cnt[12:0] == 1923)
o_data[15:0] <= eav[15:0];
else
o_data[15:0] <= line_cnt[9:0];
end
4'b0010: //垂直灰阶
begin
if(pix_cnt[12:0] == 2200)
o_data[15:0] <= sav[31:16];
else if(pix_cnt[12:0] == 1)
o_data[15:0] <= sav[15:0];
else if(pix_cnt[12:0] == 1922)
o_data[15:0] <= eav[31:16];
else if(pix_cnt[12:0] == 1923)
o_data[15:0] <= eav[15:0];
else
o_data[15:0] <= line_cnt[9:0];
end
4'b0100: //水平灰阶
begin
if(pix_cnt[12:0] == 2200)
o_data[15:0] <= sav[31:16];
else if(pix_cnt[12:0] == 1)
o_data[15:0] <= sav[15:0];
else if(pix_cnt[12:0] == 1922)
o_data[15:0] <= eav[31:16];
else if(pix_cnt[12:0] == 1923)
o_data[15:0] <= eav[15:0];
else
o_data[15:0] <= pix_cnt[9:0];
end
4'b1000: //水平灰阶
begin
if(pix_cnt[12:0] == 2200)
o_data[15:0] <= sav[31:16];
else if(pix_cnt[12:0] == 1)
o_data[15:0] <= sav[15:0];
else if(pix_cnt[12:0] == 1922)
o_data[15:0] <= eav[31:16];
else if(pix_cnt[12:0] == 1923)
o_data[15:0] <= eav[15:0];
else
o_data[15:0] <= pix_cnt[9:0]%255;
end
default:o_data[15:0] <= 16'd0;
endcase
end
end
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。