1. 문제 및 설명
- 1부터 10까지 카운트하는 주기 10의 이진 카운터를 구현하시오
- reset입력은 동기식이며, 카운터를 0으로 초기화해야 한다.
2. 모듈 정의
module top_module (
input clk,
input reset,
output [3:0] q);
3. 답
module top_module (
input clk,
input reset,
output [3:0] q);
always @(posedge clk)
if (reset || q == 4'd10)
q <= 4'd1;
else
q <= q + 4'd1;
endmodule'Verilog > HDLbits' 카테고리의 다른 글
| [HDLBits] Exams/ece241 2014 q7a (0) | 2026.01.06 |
|---|---|
| [HDLBits] Countslow (0) | 2026.01.05 |
| [HDLBits] Count10 (0) | 2026.01.05 |
| [HDLBits] Count15 (0) | 2026.01.03 |
| [HDLBits] Dualedge (0) | 2026.01.03 |