本次是第二次试验,用于设计模71计数器设计
module mod71(clk,rst_n,ge,shi);
input clk;
input rst_n;
output[3:0]ge;
output[2:0]shi;
reg[3:0]ge;
reg[2:0]shi;
always@(posedge clk)
if(rst_n==1'b0)
ge<=4'd0;
else if(ge==4'd9)
ge<=4'd0;
else if(ge>=4'd1 && shi>=3'd7)
ge<=4'd0;
else
ge<=ge+1;
always@(posedge clk)
if(rst_n==1'b0)
shi<=3'd0;
else if(shi<3'd7)
begin
if(ge==4'd9)
shi<=shi+1;
else;
end
else if(shi>=3'd7&& ge>=4'd1)
shi<=4'd0;
else;
endmodule