用你熟悉的设计方式设计一个可预置初值的7进制循环计数器,15进制的呢?
"module counter7(clk,rst,load,data,cout);
input clk,rst,load;
input [2:0] data;
output reg [2:0] cout;
always@(posedge clk)
begin
if(!rst)
cout<=3’d0;
else if(load)
cout<=data;
else if(cout>=3’d6)
cout<=3’d0;
else
cout<=cout+3’d1;
end
endmodule "