--- Quote Start ---
hello, could someone explain me this following code? i have found it in a demo application but with no Comments. thank you
module sigdetect(
oTD_Stable,
iTD_VS,
iTD_HS,
iRST_N );
input iTD_VS;
input iTD_HS;
input iRST_N;
output oTD_Stable;
reg TD_Stable;
reg Pre_VS;
reg [7:0] Stable_Cont;
assign oTD_Stable = TD_Stable;
always@(posedge iTD_HS or negedge iRST_N)
begin
if(!iRST_N)
begin
TD_Stable <= 1'b0;
Stable_Cont <= 4'h0;
Pre_VS <= 1'b0;
end
else
begin
Pre_VS <= iTD_VS;
if(!iTD_VS)
Stable_Cont <= Stable_Cont+1'b1;
else
Stable_Cont <= 0;
if({Pre_VS,iTD_VS}==2'b01)
begin
if(Stable_Cont==9)
TD_Stable <= 1'b1;
else
TD_Stable <= 1'b0;
end
end
end
--- Quote End ---
module sigdetect (oTD_Stable, iTD_VS, iTD_HS, iRST_N);
input iTD_VS;
input iTD_HS;
input iRST_N;
output oTD_Stable;
reg TD_Stable;
reg Pre_VS;
reg Stable_Cont;
assign oTD_Stable = TD_Stable;
always @ (posedge iTD_HS or negedge iRST_N)
begin if (!iRST_N)
begin //all reset
TD_Stable <= 1 'b0;
Stable_Cont <= 4' h0;
Pre_VS <= 1 'b0;
end
else
begin //this is for each horisontal syno impulse
Pre_VS <= iTD_VS;
if(!iTD_VS)Stable_Cont <= Stable_Cont+1' b1; // blank time. Old frame is finish. But new frame is not begun. count HS singal pulses during blank time.
else Stable_Cont <= 0;// draw frame. do nothing
if ({Pre_VS, iTD_VS} == 2 'b01)// new frame is begin.
begin
if(Stable_Cont==9) TD_Stable <= 1' b1; // if during blank time been 9 pulses HS the signal is stable.
else TD_Stable <= 1 'b0; // signal not stable.
end
end
end
blank time os "back moving beam". I don't know how to in english.