top of page

4.1 white space or blank spaces requirements

White spaces are used in the strings which can be incorporated using the double quotes (“). Follow the below table containing the semantics required to provide the white spaces in the string sequence:

ESCAPE STRING

Character produced by escape string

\n

New line character

 Verilog

module wh_sp;   

    initial begin       

        $display("This is First Line.\nThis is second line.");   

    end

endmodule

 Output

This is First Line.

This is second line.

\t

TAB character

 Verilog

module tb_char;   

    initial begin

        $display("This is First Line.\tThis is second line.");           

    end

endmodule

 Output

This is First Line.    This is second line.

\\

\ character

 Verilog

module tb_char;   

    initial begin

        $display("This is First Line.\\ This is second line.");           

    end

endmodule

 Output

This is First Line.\ This is second line.

\"

" character

 Verilog

module tb_char;   

    initial begin

        $display("This is First Line. \"This is second line.\"");          

    end

endmodule

 Output

This is First Line. "This is second line."

\ddd

A character specified in 1-3 octal digits (0 <=d <= 7).

  • If less than three characters are used, the following character shall not be an octal digit.

  • Implementations may issue an error if the character represented is greater than \377.
    ​​​​​​​

 Verilog

module octal_example;

  reg [7:0] data;

  initial begin

    // Assign an octal value to the 'data' register

    data = "\123";  // Octal 123 is equivalent to decimal 83

    // Display the value in different formats

    $display("Octal value: %o", data); //Display in octal 

    $display("Decimal value: %d", data); //Display in decimal

    $display("Hexadecimal value: %h", data); //Display in hexadecimal

  end

endmodule

 Output

Octal value: 123

Decimal value: 83

Hexadecimal value: 53

Lexical convention

Comments implementation

© Copyright 2025 VLSI Mentor. All Rights Reserved.©

Connect with us

  • Instagram
  • Facebook
  • Twitter
  • LinkedIn
  • YouTube
bottom of page