|
发表于 2011-9-8 09:08:12
|
显示全部楼层
module counter_fiv(clk,rst,start0,counter_out);
input clk,rst;
input start0;
wire reset = !rst | !start0;
output [5:0] counter_out;
reg [5:0] counter_out;
always @ (posedge clk or posedge reset) begin
if (reset)
counter_out <= 6'd0;
else if (start0 == 1'b1)
counter_out <=counter_out +1'b1;
endmodule
按你的想法可以这样写,但是一般都会按照6楼的写法来写的。 |
|