求一个verilog的计数器
时间:10-02
整理:3721RD
点击:
要求count从0计数到200,之后停止计数,且就计数一次
是对外部信号计数吗?比如说是一个按键给输入信号或者是传感器
不是啊,是本身内部的计数
不难吧
支持下小编,我是一个来赚积分的
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
