- 117
- 0
- 约小于1千字
- 约 2页
- 2020-09-10 发布于浙江
- 举报
简单程序:24加法计数器的两种verilog程序
1、
module cnt24(CntH,CntL,nCR,EN,CP);
input CP,nCR,EN;
output[3:0] CntH,CntL;
reg[3:0] CntH,CntL;
always@(posedge CP or negedge nCR)
begin
if(~nCR) {CntH,CntL}=8h00;
else if(~EN) {CntH,CntL}={CntH,CntL};
else if((CntH2)||(CntL9)||((CntH==2)(CntL=3)))
{CntH,CntL}=8h00;
else if((CntH==2)(CntL3))
begin
CntH=CntH;
CntL=CntL+1b1;
end
else if(CntL==9)
begin
CntH=CntH+1b1;
CntL=4b0000;
end
else
begin
CntH=CntH;
CntL=CntL+1b1;
end
end
endmodule
2、
module count
原创力文档

文档评论(0)