?? sync_gen_50m.v
字號:
////////////////////////////////////////////////////////////////////////////////
// *****************************************************************************
// * RICHIC CONFIDENTIAL PROPRIETARY NOTE *
// * *
// * This software contains information confidential and proprietary to *
// * RicHic Inc.It shall not be reproduced in whole or in part or transferred *
// * to other documents, or disclosed to third parties, or used for any *
// * purpose other than that for which it was obtained, without the prior *
// * written consent of RicHic Inc. *
// * (c) 2003, 2004, 2005 RicHic Inc. *
// * All rights reserved *
// *****************************************************************************
//
// (C) 2004 calvin_richic@yahoo.com.cn; calvin_richic@hotmail.com
// http://www.richic.com
//
////////////////////////////////////////////////////////////////////////////////
module sync_gen_50m(
rst_n,// synthesis attribute clock_buffer of rst_n is ibufg;
clk,
hsync,
vsync,
valid,
x_cnt,
y_cnt
);
input rst_n ;
input clk ;
output hsync ;
output vsync ;
output valid ;
output [9:0] x_cnt ;
output [9:0] y_cnt ;
reg hsync ;
reg vsync ;
reg valid ;
reg [9:0] x_cnt ;
reg [9:0] y_cnt ;
always @ ( posedge clk or negedge rst_n )
if ( !rst_n )
x_cnt <= 10'd0;
else if ( x_cnt == 10'd1000 )
x_cnt <= 10'd0;
else
x_cnt <= x_cnt + 1'b1;
always @ ( posedge clk or negedge rst_n )
if ( !rst_n )
y_cnt <= 10'd0;
else if ( y_cnt == 10'd665 )
y_cnt <= 10'd0;
else if ( x_cnt == 10'd1000 )
y_cnt <= y_cnt + 1'b1;
always @ ( posedge clk or negedge rst_n )
if ( !rst_n )
begin
hsync <= 1'b0;
vsync <= 1'b0;
end
else
begin
hsync <= x_cnt <= 10'd50;
vsync <= y_cnt <= 10'd6;
end
always @ ( posedge clk or negedge rst_n )
if ( !rst_n )
valid <= 1'b0;
else
valid <= ( ( x_cnt > 10'd180 ) && ( x_cnt < 10'd980) &&
( y_cnt > 10'd35) && ( y_cnt < 10'd635) );
endmodule
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -