任意倍数奇数分频 Verilog.docx

上传人:牧羊曲112 文档编号:3261322 上传时间:2023-03-12 格式:DOCX 页数:2 大小:36.55KB
返回 下载 相关 举报
任意倍数奇数分频 Verilog.docx_第1页
第1页 / 共2页
任意倍数奇数分频 Verilog.docx_第2页
第2页 / 共2页
亲,该文档总共2页,全部预览完了,如果喜欢就下载吧!
资源描述

《任意倍数奇数分频 Verilog.docx》由会员分享,可在线阅读,更多相关《任意倍数奇数分频 Verilog.docx(2页珍藏版)》请在三一办公上搜索。

1、任意倍数奇数分频 Verilog 自己写的代码,只是经过功能仿真之后的。如果有更好的方法的话,请指教了。 /奇数分频 module div_clk( input clk_in, input rst_n, output clk_div ); reg 3:0count1; reg 3:0count2; reg clk_div_1; reg clk_div_2; always (posedge clk_in , negedge rst_n) begin if(!rst_n) begin count1=4b0; clk_div_1=1; end else if(count1=4b0010) begin

2、 count1=4b0; clk_div_1=0; end else begin count1=count1+4b1; clk_div_1=1; end end always (negedge clk_in , negedge rst_n) begin if(!rst_n) begin count2=4b0; clk_div_2=1; end else if(count2=4b0010) begin count2=4b0; clk_div_2=0; end else begin count2=count2+4b1; clk_div_2=1; end end assign clk_div=clk_div_1 & clk_div_2; endmodule 对于N倍的奇数分频,首先是在系统时钟的上升沿得到占空比为的分频时钟2*Nclk_div_1,然后在系统时钟的下降沿得到占空比为的clk_div_2,最后将两个分频之2*N后的时钟相与便会得到想要的奇数分频。如上图所示为进行三分频时的功能仿真波形图。光标之间便为分频之后的解释。想要得到任意倍数奇数分频的话只需改变上述的两个计数寄存器的阈值即可。

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 生活休闲 > 在线阅读


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号