module clk16x
(
clk16x,
CLK_3M125,
CLK_25M,
FPGA_nRESET_reg1
);
output clk16x ;
input CLK_3M125 ;
input CLK_25M ;
input FPGA_nRESET_reg1 ;
reg [15:0] clk16x_cnt ;
reg [7:0] cnt;
reg clk16x ;
always @(posedge CLK_3M125)
begin
if(!FPGA_nRESET_reg1)
begin
clk16x_cnt <= 16'h0000;
cnt <= 8'h00;
end
else
begin
if(cnt == 8'h7D)
begin
cnt <= 8'h00 ;
if(clk16x_cnt == 16'h63)
begin
clk16x_cnt <= 16'h0000;
end
else
clk16x_cnt <= clk16x_cnt + 1;
end
else
cnt <= cnt + 1 ;
end
end
always@(posedge CLK_25M)
begin
if(!FPGA_nRESET_reg1)
begin
clk16x <= 16'h0000 ;
end
else if(!clk16x_cnt)
begin
clk16x <= ~clk16x ;
end
end
代码有什么错误嘛?
仿真不出想要的结果呢?clk16x_cnt和cnt 两个量始终没数,新手求解答,谢谢!
|