RE: [sv-bc] Hex escape codes in string literals


Subject: RE: [sv-bc] Hex escape codes in string literals
From: Michael McNamara (mac@verisity.com)
Date: Wed Feb 04 2004 - 09:28:50 PST


You could also do:

    ab\o7\o1 and ab\x7\x1 to get \o40\o41\o07\o01

however I admit that 007 does have a certain je n'sais quoi...

    -mac

-- On Feb 4 2004 at 11:31, Rishiyur S. Nikhil sent a message:
> To: sv-bc@eda.org
> Subject: "[sv-bc] Hex escape codes in string literals"
> 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 - 09:36:35 PST