Development Tools User’s Guide
251
Intel
®
IXP2400/IXP2800 Network Processors
Transactor
a 128-bit vector called foo; "vect( expr ) foo;" defines a vector, foo, of width specified by the C
expression. Like model states, bit field specifications may be made by appending a one or two-
argument function list.
•
synonym states: A synonym state can be defined in order to map another state or a particular
bit field of a state to a preferred name. The synonym state name can then be used in place of
the former state to reference the former state. Creation of a synonym state with its defined state
mapping is done by calling the "def_syn" C function. See topic "Built-In C Functions" for
more information on "def_syn".
•
string: The keyword "string" defines a variable length text string container (e.g. "string foo;"
declares a string called foo). Text can be assigned to a string via the "=" operator (foo =
"abcd";). Text can be appended via the "+" or "+=" operators (foo = "abcd" + "xyz";). The
relational operators, "==", "!=", "<", "<=", ">", and ">=" can be applied to 2 strings to produce
a boolean result. In addition, many built-in string functions can be applied using the syntax
"string_var_name.string_function_name(...)". The following string functions exist:
length():
returns the number of characters in the string
empty()
:
resets the string to the null string
isempty()
:
returns 1 if it contains the null string or 0 otherwise
left( int n )
:
returns the left-most n characters of the string
right( int n )
:
returns the right-most n characters of the string
mid( int n, int len )
: returns the substring starting at index n, and whose length is limited
to no more than len characters. If len < 0, or if len is not supplied, the
entire substring starting at n is returned.
find( string s )
: returns the zero-based starting index of the left-most occurrence of string
s in the string. If s is not found in the string, -1 is returned.
reverse_find( string s )
: returns the zero-based starting index of the right-most
occurrence of string s in the string. If s is not found in the string, -1 is
returned.
format( format_str, ... )
: Formats the contents of the string, according to the "printf"
variable argument list
8.5
Simulation Switches
Several pre-defined simulation states exist that act as user setable simulation switches/parameters.
All such states exist under the "sim." hierarchy. The following is a description of the states:
•
sim.error_count
: Indicates the number of unexpected errors that were flagged during the
session.
•
sim.error_handle_mode
: Indicates what action should be taken when the error occurs.
The valid values are:
—
0
suppress and ignore error message
—
10
print the error but ignore its occurrence (i.e. the sim.error_count is not incremented and
the simulation continues)
—
20
turn model errors into warnings