用verilog 实现 74LS160,然后实现2000分频占空比50的分频器
生活随笔
收集整理的這篇文章主要介紹了
用verilog 实现 74LS160,然后实现2000分频占空比50的分频器
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
因為這周有個作業要求用3個160實現一個類似2000分頻占空比50的分頻器,然后沒用過verilog,就直接從網上抄了一個,但是并不好使,索性自己來
module LS160(clk,ep,et,ld,clr,dn,qn,cout);input clk,ep,et,ld,clr; output cout; input [3:0] dn; output [3:0] qn; reg [3:0]temp; reg cout;always @(posedge clk or negedge clr) begin if(clr==0)temp<=4'd0; else begin if(clk==1&ld==0) temp<=dn; else if(clk==1&ld==1) begin if((ep&et)==0) begin temp<=temp;cout=0; end else begin temp<=temp+1;cout=0; end endif(temp==4'd9) begin cout=1; temp<=4'd0; end end end assign qn=temp;endmodule module count1000(clk,enp,ent,ld,clr,dn,qn,Q1000,Q100,out); input clk,enp,ent,ld,clr; input [11:0] dn; output [11:0] qn; output out; reg [3:0]temp; wire rco1,rco2,cout; output Q100,Q1000; reg out; LS160 LS0 (clk,enp,ent,ld,clr,dn[3:0],qn[3:0],rco1); LS160 LS1 (~rco1,1,1,ld,clr,dn[7:4],qn[7:4],rco2); LS160 LS2 (rco2,1,1,ld,clr,dn[11:8],qn[11:8],cout); assign Q100=rco2,Q1000=cout;always@(posedge cout) begin if(cout==1) out=~out; end endmodule
總結
以上是生活随笔為你收集整理的用verilog 实现 74LS160,然后实现2000分频占空比50的分频器的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 如何科学的使用LMD DockingPa
- 下一篇: 凯斯轴承数据故障诊断PHM轴承寿命预测深