Menu
Coddy logo textTech

주석

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의 용도를 설명합니다
  • 코드를 더 쉽게 이해할 수 있게 합니다
  • 자신이나 다른 사람을 위해 메모를 남깁니다
challenge icon

챌린지

이 챌린지에서는 기존 modulecomments를 추가해야 합니다.

할 일:

  1. module이 무엇을 하는지 설명하는 single-line comment를 맨 위에 추가하세요 

    // This is a module called 'test'

  2. 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
quiz icon실력 점검

이 레슨에는 짧은 퀴즈가 포함되어 있습니다. 레슨을 시작해 문제를 풀고 진행 상황을 기록하세요.

기초의 모든 레슨

직접 연습해 보세요: 온라인 Verilog 컴파일러