modulejianfaqi( RST,//复位端CLK,//时钟输入端Q,//计数输出端 ); inputRST; inputCLK; outputreg [2:0]Q; always ( posedgeCLKornegedgeRST ) beginif (RST==0) Q<=3'b000;elseQ<=Q-1'b1;endendmodule
仿真的时序图:
modulejianfaqi( RST,//复位端CLK,//时钟输入端Q,//计数输出端 ); inputRST; inputCLK; outputreg [2:0]Q; always ( posedgeCLKornegedgeRST ) beginif (RST==0) Q<=3'b000;elseQ<=Q-1'b1;endendmodule
仿真的时序图: