Electronic – VHDL Delimiter Character

fpgaspartanvhdl

I'm trying to define a string in VHDL with a pair of double quotes in the string itself. However I am unable to do so because the IDE (Xilinx ISE 14.7) only recognizes what's in-between the first pair of double quotes as the string. Is there some kind of delimiter or escape character I can use?

Here's the string definition:

constant AT_WKMOD       : string(1 to 15):="AT+WKMOD="SMS""&CR;

If I try:

constant AT_WKMOD       : string(1 to 15):="AT+WKMOD=/"SMS/""&CR;

It does the same thing. The last thing I tried was:

constant AT_WKMOD       : string(1 to 15):="AT+WKMOD=\"SMS\""&CR;

Which gives the following error upon synthesis:

Non-printing character is not allowed in extended identifier.

Best Answer

Since answers should be written as answers and not comments, I'll summarize here:

IEEE Std 1076-2008, section 15.7 - String literals

A string literal has a value that is a sequence of character values corresponding to the graphic characters of the string literal apart from the quotation mark itself. If a quotation mark value is to be represented in the sequence of character values, then a pair of adjacent quotation marks shall be written at the corresponding place within the string literal. ... The length of a string literal is the number of character values in the sequence represented."

For example:

constant AT_WKMOD: string (1 to 15) := "AT+WKMOD=""SMS""" & CR;

As an alternative, you can always create a string by concatenation, "AT+WKMOD=" & '"' & "SMS" & '"' & CR; as you are already doing with CR. Note '"' is a character literal, i.e. a " enclosed in a pair of 's.