在网上查到一个39进制的计数器,不知道怎么改成九进制的计数器,求解答module counter_39{
add,
dec,
counter
};
input add; //为1时加操作
input dec; //为1时减操作
output [5:0] counter;
reg [5:0] counter;
always @(add and dec) begin
if(add && !dec) begin
if(counter == 6'd38) begin
counter <= 6'd0;
end
else begin
counter <= counter + 1'b1;
end
end
if(!add and dec) begin
if(counter == 6'd0) begin
counter <= 6'd38;
end
else begin
counter <= counter - 1'b1;
end
end
end
endmodule