Countslow
2023. 6. 20. 11:43ㆍFPGA/HDLBits
728x90
Problem Statement
Build a decade counter that counts from 0 through 9, inclusive, with a period of 10. The reset input is synchronous, and should reset the counter to 0. We want to be able to pause the counter rather than always incrementing every clock cycle, so the slowena input indicates when the counter should increment.
module top_module (
input clk,
input slowena,
input reset,
output [3:0] q);
always @(posedge clk)begin
if(reset)
q = 0;
else if(slowena) begin
q = q + 1;
if(q == 4'ha)
q = 0;
end
end
endmodule
'FPGA > HDLBits' 카테고리의 다른 글
Exams/m2014 q4k (0) | 2023.06.20 |
---|---|
Mt2015 lfsr (0) | 2023.06.20 |
Count1to10 (0) | 2023.06.20 |
Count10 (0) | 2023.06.20 |
Count15 (0) | 2023.06.20 |