Bit counter
Coddy Verilog 여정의 기초 섹션에 포함된 레슨. 90개 중 87번째.
챌린지
이 장에서는 UART 송신기를 단계별로 만듭니다. UART는 Universal Asynchronous Receiver-Transmitter를 의미합니다. UART는 두 장치가 하나의 전선(송신용)과 또 다른 전선(수신용)만 사용하여 통신할 수 있게 해 주는 간단한 하드웨어 프로토콜입니다.
두 사람이 전화로 이야기하는 것과 같다고 생각해 보세요. 한 사람은 말하고(송신), 다른 사람은 듣습니다(수신). UART는 각 바이트의 시작과 끝을 표시하는 시작 비트와 정지 비트를 사용하여 데이터를 한 번에 1비트씩 보냅니다.
UART 송신기는 10비트를 보냅니다. 시작 비트(1), 데이터 비트(8), 정지 비트(1)입니다. 어떤 비트를 보내고 있는지 추적하려면 0부터 10까지 세는 비트 카운터가 필요합니다.
비트 카운터의 작동 방식
- 0에서 시작
- 각 클록 주기마다 1을 더함
- 10에 도달하면 0으로 돌아감
- 영원히 반복
이 과제에서는 아직 재설정하지 않습니다. 값만 증가시킵니다.
해야 할 일:
uart_tx라는 이름의 모듈을 다음과 같이 만드세요.- 입력 하나:
clk - 출력 하나:
cnt(4비트, 유형reg)
- 입력 하나:
- 모듈 내부에서:
- initial 블록 내부의 시작 시점에
cnt를 0으로 설정하세요. always @(posedge clk)블록을 추가하세요.- 각 클록 에지에서
cnt가 1씩 증가하도록 만드세요.
- initial 블록 내부의 시작 시점에
직접 해보기
// TODO: 입력 clk와 출력 cnt(4 bits)를 가진 모듈 uart_tx 생성
// TODO: initial 블록 안에서 시작 시 cnt를 0으로 설정
// TODO: always @(posedge clk) 블록 추가
// TODO: cnt 증가기초의 모든 레슨
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 컴파일러