
首先PLL应用就不用说明了,这个直接调用内部软核来实现,没有涉及到代码。就分频代码我简单写个8分频的代码,其他的大同小异。
module div_8(clk_100M,rst,clk_125M);
input clk_100M,rst;
output reg clk_125M;//8分频输出125M
reg[3:0] temp;
always@(posedge clk_100M or negedge rst)
begin
if(!rst)
begin
temp<=4'b0000;
clk_125M<=1'b0;
end
else if(temp==4'd3)
begin
clk_125M<=~clk_125M;
temp<=4'b0000;
end
else
temp<=temp+1'b1;
end
endmodule
这个只是8分频代码,其他的16分频可参考这个来写,原理是一样的。
以上就是关于用VerilogHDL设计一个FPGA定时器!全部的内容,包括:用VerilogHDL设计一个FPGA定时器!、、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)