|
发表于 2009-12-29 18:30:57
|
显示全部楼层
按billwaston的方法,50M/19.2K=2604.17 采用2604/2605分频
累加数为100-17=83 程序如下:
//2604分频电路
module fd2604(clkin, clkout);
input clkin;
output clkout;
reg clkout;
reg[12:0] q;
[email=always@(posedge]always@(posedge[/email] clkin)
begin
begin
if(q<2603)
q<=q+1;
else
q<=0;
end
clkout<=q[11];
end
endmodule
//2605分频
module fd2605(clkin, clkout);
input clkin;
output clkout;
reg clkout;
reg[12:0] q;
[email=always@(posedge]always@(posedge[/email] clkin)
begin
begin
if(q<2604)
q<=q+1;
else
q<=0;
end
clkout<=q[11];
end
endmodule
//2604/2605分频
module fd26045(clkin,clkout);
input clkin;
output clkout;
reg clkout;
reg[7:0] a;
wire clkout1,clkout2;
fd2604 fd26041(clkin,clkout1);
fd2605 fd26051(clkin,clkout2);
[email=always@(posedge clkin]always@(posedge clkin[/email])
begin
if(a<100)
begin
clkout<=clkout2;
a<=a+8'd83;
end
else
begin
clkout<=clkout1;
a<=a-8'd100;
end
end
endmodule |
|