4 Bit Counter
Coddy Verilog 여정의 기초 섹션에 포함된 레슨. 90개 중 84번째.
챌린지
0부터 15까지 세고 다시 0으로 돌아가는 4비트 카운터를 만드세요.
모듈 인터페이스
| 포트 | 방향 | 너비 | 설명 |
|---|---|---|---|
clk | input | 1 bit | 클록 신호 |
reset | input | 1 bit | 카운터를 0으로 재설정 |
count | output | 4 bits | 현재 카운터 값 |
진리표
| 클록 사이클 | count |
|---|---|
| 재설정 후 | 0 |
| 1 | 1 |
| 2 | 2 |
| ... | ... |
| 15 | 15 |
| 16 | 0 (순환하여 돌아감) |
아래 모듈을 완성하는 것이 여러분의 과제입니다.
할 일:
reset에서count를 0으로 설정합니다- 각 상승 클록 에지에서
count를 1씩 증가시킵니다 count가 15에 도달하면 다음 증가 시 0으로 순환해야 합니다
직접 해보기
module counter (
input clk,
input reset,
output reg [3:0] count
);
// TODO: posedge clk와 posedge reset이 있는 always 블록 추가
// 리셋 시: count <= 0
// 그렇지 않으면: count <= count + 1
endmodule기초의 모든 레슨
4Operators Part 1
Arithmetic OperatorsModulo OperatorComparison OperatorsRecap - Simple MathBitwise Operators7Assign And Gates
Continuous AssignmentAssign With OperatorsBuilt In Gate PrimitivesAND OR NOT GatesXOR XNOR GatesRecap - Logic Gate Circuit10Decision Making
If StatementIf - ElseRecap - Simple ComparatorCase StatementCasex And CasezRecap - ALU Design5Operators Part 2
Logical OperatorsReduction OperatorsShift OperatorsConcatenation OperatorConditional OperatorRecap - Operator Challenge3Number System
Binary RepresentationSized NumbersUnsized NumbersNegative NumbersSpecial Values X And ZRecap - Number Formats6Modules
Module StructureInput And Output PortsInout PortsModule InstantiationPort Mapping By NamePort Mapping By OrderRecap - Build A Module9Procedural Blocks
Always BlockInitial BlockSensitivity ListBlocking AssignmentNon Blocking AssignmentRecap - Always vs Initial15Traffic Light Controller
Defining The StatesState Machine Logic직접 연습해 보세요: 온라인 Verilog 컴파일러