주석
Coddy Verilog 여정의 기초 섹션에 포함된 레슨. 90개 중 4번째.
Comments는 코드에서 computer가 무시하는 메모입니다. Comments는 코드가 무엇을 하는지 설명하는 데 도움이 됩니다.
Comments의 두 가지 유형:
1. Single-line comment
// 이것은 한 줄 주석입니다
assign c = a & b; // 주석은 코드 뒤에도 올 수 있습니다// after의 모든 내용은 computer에 의해 ignored됩니다.
2. 여러 줄 comment
/* 이것은 여러 줄 주석입니다
여러 줄에 걸쳐 있을 수 있습니다
긴 설명에 유용합니다 */
assign c = a & b;/*와 */ 사이의 모든 내용은 ignored 상태입니다.
주석을 사용하는 이유는 무엇인가요?
- Module이 하는 일을 설명합니다
- 각 input과 output의 용도를 설명합니다
- 코드를 더 쉽게 이해할 수 있게 합니다
- 자신이나 다른 사람을 위해 메모를 남깁니다
챌린지
이 챌린지에서는 기존 module에 comments를 추가해야 합니다.
할 일:
module이 무엇을 하는지 설명하는 single-line comment를 맨 위에 추가하세요// This is a module called 'test'counter가 무엇을 하는지 설명하는 multi-line comment를 코드 끝에 추가하세요/** It has a clock input, a reset input,* and a 4-bit output called count.* The initial block prints a message* to show that comments are ignored.*/
직접 해보기
module test(
input clk,
input reset,
output reg [3:0] count
);
initial $display("Comments are ignored by the computer");
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 컴파일러