REPLACE:

A string literal and a concatenation or replication of string literals are the only types of packed arrays that are allowed to be assigned to variables of type string.

 

WITH:

 

A variable of type string can be assigned an expression of type string, string literal, or packed array.

 

A string literal can be assigned to a string, a character, or a packed array.  If their size differs the literal is right justified and zero filled on the left.  For example:

 

char            c = “A”;                            // assign to c “A”

bit [10:0]      a = "\x41";                       // assigns to a ‘b000_0100_0001

bit [1:4][7:0]  h = "hello" ;                     // assigns to h “ello

 

A string, string literal, or packed array can be assigned to a string variable.  The string variable will grow to accommodate the packed array.  If the size (in bits) of the packed array is not a multiple of 8 then the packed array is zero filled on the left.  For example:

 

string  s1 = "hello";                                          // sets s1 to “hello”

bit [11:0] b = 12’ha41;

string  s2 = b;                                                  // sets s2 to ‘h0a41