16count2.v
来自「用VERILOG实现的秒表 用VERILOG实现的秒表」· Verilog 代码 · 共 28 行
V
28 行
module jscount(clk,reset,out1,out2,out3,out4);
input clk,reset;
output [3:0] out1,out2,out3,out4;
wire [3:0] out1,out2,out3,out4;
reg [15:0] count;
integer i;
always@(posedge clk or posedge reset)
begin
if (reset==1'b1)
count[15:0]<=16'h0000;
else if (count[3:0]<9)
count<=count+1;
else if (count[3:0]==4'b1001)
for(i=0;i<7;i=i+1)
count<=count+1;
else if (count[7:0]==8'b10011001)
for(i=0;i<49;i=i+1)
count<=count+1;
else if (count[11:0]==12'b100110011001)
for(i=0;i<343;i=i+1)
count<=count+1;
end
assign out1=count[3:0];
assign out2=count[7:4];
assign out3=count[11:8];
assign out4=count[15:12];
endmodule
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?