module Counter200(clk,rst_n,cnt);
input clk;
input rst_n;
output reg [7:0] cnt;
always @ (posedge clk or negedge rst_n) begin
if(!rst_n) begin
cnt <= 8'b0;
end
else if(cnt == 200) begin
cnt <= 8'd200;
end
else begin
cnt <= cnt + 8'd1;
end
end
endmodule
input clk;
input rst_n;
output reg [7:0] cnt;
always @ (posedge clk or negedge rst_n) begin
if(!rst_n) begin
cnt <= 8'b0;
end
else if(cnt == 200) begin
cnt <= 8'd200;
end
else begin
cnt <= cnt + 8'd1;
end
end
endmodule
一周热门 更多>