Skip to content

Instantly share code, notes, and snippets.

@jz5
Last active December 30, 2015 02:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jz5/7763270 to your computer and use it in GitHub Desktop.
Save jz5/7763270 to your computer and use it in GitHub Desktop.
down counter
always @(posedge clk or negedge rst_n) begin
if (~rst_n) begin
count <= max_count; // 初期値をカウンタ最大値にする
end
else if (count == 0) begin
count <= max_count; // count = 0 でリセット
end
else begin
count <= count - 1;
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment