[sv-bc] Hex escape codes in string literals


Subject: [sv-bc] Hex escape codes in string literals
From: Rishiyur S. Nikhil (nikhil@bluespec.com)
Date: Wed Feb 04 2004 - 08:31:35 PST


Background from V2K:

     The the V2K LRM, "Section 2.6.3 Special characters in strings" says
     that the \ddd escape can have from 1-3 octal digits.

     But what if we want a string where the escaped character is
     followed immediately by a literal octal character? How to avoid
     the literal octal character from being part of the escape code?

     E.g., a string containing the following characters:

         'a' 'b' '\o7' '1'

     can't be written as: "ab\o71" (means 'a' 'b' '\o71' ?)

     No problem: since the escape code has a maximum of 3 octal digits,
     we can use 3 digits for the escape code to ``push out'' the
     following literal octal digit beyond the code:

                                 "ab\o0071"

Issue in SV:

     In the SV LRM, "Section 2.6 String literals", says:

         SystemVerilog adds the following special string characters:
             ...
             \x02 hex number

     but does not specify the number of hex digits required (exactly 2?
     from 1-2? any number of hex digits?).

I suggest specifying that it must be 1 or 2 hex digits.

Nikhil



This archive was generated by hypermail 2b28 : Wed Feb 04 2004 - 08:39:16 PST