|
|
|
|
|
|
|
|
|
|
|
|
String
|
|
|
Strings are character data types that have a set of predefined methods associated with them for manipulating characters. (See the section entitled ""String Methods" on page 12-51" for a description of these methods). |
|
|
|
|
|
Syntax string variable_name [=initial_value]; variable_name |
|
|
|
|
|
Specifies the initial value for the declared variable. If this specification is omitted, the initial value of the declared variable is null. |
|
|
|
|
|
As in Verilog, Vera permits strings to be assigned to integers. Strings greater than 32-bits are truncated. Integers, however, cannot be assigned to strings. |
|
|
|
|
|
|
|
|
|
|
|
Example : String
|
|
|
|
|
|
1 program string_t {
2 // Declare
3 string i;
4 // Declare and init value
5 string j = "This is sample string";
6 // Declare multiple and assign
7 integer m,n,o,p = "Guess this";
8 // Print all the values
9 printf("value of i %s\n",i);
10 printf("value of j %s\n",j);
11 printf("value of m %s\n",m);
12 printf("value of n %s\n",n);
13 printf("value of o %s\n",o);
14 printf("value of p %s\n",p);
15
16 }
You could download file string_t.vr here
|
|
|
|
|
|
Simulation : String
|
|
|
|
|
|
value of i
value of j This is sample string
value of m
value of n
value of o
value of p this
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Copyright © 1998-2014 |
Deepak Kumar Tala - All rights reserved |
Do you have any Comment? mail me at:deepak@asic-world.com
|
|