Quartus波形仿真教程 |
您所在的位置:网站首页 › 60进制计数器仿真波形图 › Quartus波形仿真教程 |
下面我以一个模为60的BCD码加法计数器为例来讲解此教程。 先贴上代码: module bcd60counter(clk,switch,count); input clk,switch; output[7:0]count; reg[7:0]count=8'b0; always@(posedge clk) begin if(switch) begin count=count+8'b1; //若低四位向高四位进位 if(count[3:0]==4'b1010) count=count+8'b00000110; //若到了60 if(count==8'b01100000) count=0; end else begin //count=count-8'b1; //若低四位向高四位借位 if(count[3:0]==4'b0000) begin //count[3:0]=4'b1010 count=count-8'b1; count=count-8'b00000110; end else count=count-8'b1; if(count==8'b00000000-8'b00000111) count=8'b01011001; end end endmodule程序写好后,点击如图按钮进行编译:
|
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |