UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor mustafa60
Visitor
129 Views
Registered: ‎07-17-2019

SMTPE296M

Hi all,

I need to decode the information taken from a HD 720p camera which uses SMTPE296M embedded sync and progressive.  I write a code in verilog but it seems there is some problems at decoding EAV and SAV part. Can anyone show me where ı am wrong?

`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 07.08.2019 14:49:29
// Design Name:
// Module Name: bt1120torgb
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////

 

module bt1120torgb(
EndOfLine,
StartOfFrame,
iReady,
txout0_seven,
txout1_seven,
txout2_seven,
txout3_seven,
txclk_in,
oYCbCr,
data_valid,
reset
);

input iReady;
input [6:0] txout0_seven;
input [6:0] txout1_seven;
input [6:0] txout2_seven;
input [6:0] txout3_seven;
input txclk_in;
input reset;
output [23:0] oYCbCr;
output data_valid;
output StartOfFrame;
output EndOfLine;

reg[7:0] Y_eight;
reg[7:0] C_eight;

wire[7:0] Y;
wire[7:0] C;
reg[7:0] oY;
reg[7:0] oCb;
reg[7:0] oCr;

reg [23:0] oYCbCr;
reg [10:0] Hcount=11'd0;
reg [9:0] Vcount=10'd0;
reg Hsync,Vsync;
reg data_valid;
wire StartOfFrame;
reg EndOfLine;

 

assign StartOfFrame = (Hcount==11'd0 && Vcount==10'd26) ? 1:0;
always@(negedge txclk_in or negedge reset) begin // Y_eight and C_eight can be a assign block
if(!reset) begin
Y_eight<=0;
C_eight<=0;
end
else begin
Y_eight<= {{txout1_seven[0]},{txout0_seven}};
C_eight<= {{txout3_seven[0]},{txout2_seven}};
end
end

assign Y= Y_eight;
assign C= C_eight;

always@(negedge txclk_in) begin // horizontal synchronization pulse

if(Y==8'hB6)
Hsync <= 1;
else if (Y==8'h80)
Hsync<=0;
else if ( Y==8'h9D)
Hsync<=1;
else if (Y==8'hAB)
Hsync<=0;

end
//****************************************************************************
always@(negedge txclk_in) // HORİZONTAL AND VERTİCAL COUNTERS
begin

if(~Hsync) begin
Hcount<= Hcount + 11'd1;
if (Hcount==11'd1280) begin
EndOfLine<=1'b1;
Hcount<=1'b0;
Vcount<= Vcount+ 10'd1;
if (Vcount>=10'd26 && Vcount <=10'd745)
data_valid<=1'b1;
else
data_valid <=1'b0;

if(Vcount>10'd749)
begin
Vcount<=10'd0;
end
end
else
EndOfLine<=1'b0;
end
else
Hcount<=0;

end


// assign oYCbCr=iReady ? {oCr,oCb,oY}:24'd0;


always@(negedge txclk_in) begin

if(iReady)

oYCbCr <={oCr,oCb,oY};
else
oYCbCr <=24'd0;


end

//**************************************************** YC to YCbCr 4:2:2 converter

always@(negedge txclk_in or negedge reset) begin
if(!reset) begin
oY<=0;
oCb<=0;
oCr<=0;
end

else if (data_valid) begin

if(~Hcount[0]) begin
oY<=Y;
oCb<=C;
end

else begin
oY<=Y;
oCr<=C;
end
end
end

endmodule

 

Tags (3)
0 Kudos
2 Replies
Contributor
Contributor
85 Views
Registered: ‎07-29-2013

Re: SMTPE296M

I think it's need your detailed description to locate the problem.
Visitor mustafa60
Visitor
54 Views
Registered: ‎07-17-2019

Re: SMTPE296M

Firstly sorry i couldnt give a response for a while. The problem is that although i got the general idea about embedded sync.,  decoding the information is a little bit complicated for me in HDL. Information comes in such a way that txout0+-, txout1+-, txout2+-, txout3+- and txoutclk+- differential pairs form the camera as 7 bits.

I first need to decode this 7 bit to 8 bit. ([6:0]txout0+- is a first 7 bit Y and [6:6]txout1+- msb of Y info etc.) and extract the EAV and SAV information from the coming datas of the frame. In my code i first concenate datas as 8 bit in two different channel Y and C. Then i changed Hsyns pulse according to EAV and SAV infos according to specification sheet. I guess first problem is the way i did it in my code. Is it right?.

 

Also, data_valid flag informs me when the video data comes and i activate the output when the data_valid flag is asserted as 1. Does this way create me an empty space in between frames. Or should i take all information from the channel?.

 

Lastly, my EndOfLine and StartOfFrame flags are arramge like in the code. Is the logic behind it true?

 

 

I appreciate all answers and thank you a lot.

 

0 Kudos