down counter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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