⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 16count.v

📁 用VERILOG实现的秒表 用VERILOG实现的秒表
💻 V
字号:
module sixteencount(reset,clk,out1,out2,out3,out4);
  
  input clk,reset;
  output [3:0] out1,out2,out3,out4;
  reg [3:0] out1,out2,out3,out4;
  reg cn1,cn2,cn3;

  always@(posedge clk or posedge reset)
    begin
     if (reset==1'b1)
       begin
        {out1,out2,out3,out4}<=16'h0000;
         cn1<=0;
         cn2<=0;
         cn3<=0;
       end
     else if(out1<10)
       begin
        out1<=out1+1;
        cn1<=0;
       end
     else if(out1==4'b1010)
       begin
         out1<=4'h0;
	     cn1<=1;
       end
     else out1=4'h0;
    end

  always@(posedge cn1)
    begin
      if (out2 < 10)
        begin
	      out2<=out2+1;
	      cn2<=0;
	    end
      else  if (out2==4'b1010)
        begin
	     out2<=4'h0;
	     cn2<=1;
	    end
     end

 always@(posedge cn2)
   begin
     if (out3 < 10)
	     begin
	     out3<=out3+1;
	     cn3<=0;
	     end
      else if (out3==4'b1010)
	     begin
	     out3<=4'h0;
	     cn3<=1;
	     end
    end

  always@(posedge cn3)
   begin
     if (out4 < 10)
	  out4<=out4+1;
      else if (out4==4'b1010)
	  out4<=4'h0;
    end
endmodule

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -