📄 counter.v.bak
字号:
module counter(clk,rst_n,beep,sled,dataout);
input clk;
input rst_n;
output wire beep;
output wire[3:0]sled;
output wire[15:0]dataout;
reg[5:0]scount;
reg[5:0]mcount;
reg[3:0]hcount;
assign sled[3:0]={clk,clk,clk,clk};
assign dataout[3:0]=mcount%'d10,
dataout[7:4]=mcount/'d10,
dataout[11:8]=hcount%'d10,
dataout[15:12]=hcount/'d10;
assign beep=scount==0?0:1;
always @(negedge rst_n or posedge clk)
begin
if(!rst_n)
begin
scount<=0;
mcount<=0;
hcount<=0;
end
else if(scount<'d60)
scount<=scount+'d1;
else if(mcount<'d60)
begin
scount<=0;
mcount<=mcount+'d1;
end
else if(hcount<'d24)
begin
scount<=0;
mcount<=0;
hcount<=hcount+'d1;
end
else
begin
scount<=0;
mcount<=0;
hcount<=0;
end
end
endmodule
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -