Previous Section Next Section

A.4 Actions

A.4.1 Generation On the Fly

gen gen-item ;

gen gen-item keeping { [soft] constraint-bool-expr ; ... };

A.4.2 Conditional Procedures

if bool-expr [ then ] { action; ... }

[ else if bool-expr [ then ] { action; ... } ]

[ else { action; ... } ] ;

case { bool-expr[:] { action; ... } ; [ default[:] { action; ... } ;] };

case expr { value[:] { action; ... } ; [ default[:] { action; ... } ;] };

A.4.3 Loops

for i from expr [ down ] to expr [step expr] [do] { action; ... };

for each [struct-type] (list-item) [ using index (index-name) ] in [reverse] list [do] { action; ... };

for each [line] [(line-name)] in file file-name [do] {action; ... };

while bool-expr [do] { action; ... };

break; // break the current loop

continue; // go to the next iteration of the loop

A.4.4 Invoking Methods and TCMs

TCM2()@event-name is { TCM1(); method();}; // calling methods

method1() is { method2(); method3(); }; // calling methods

method() is { start TCM();}; // starting a TCM on a separate thread

Note: A TCM can only be called from another TCM. However, a TCM can be started from a regular method or from another TCM.

A.4.5 Checks

Check that bool-expr [ else dut_error( ... ) ];

A.4.6 Variable Declarations and Assignments

var var-name : type; // declare a variable

var-name = expr ; // e.g. field-name=expr, var-name=method()

var var-name : = value; // declare and assign a variable

A.4.7 Printing

Print expr[,…] [using print-options] ;

Print struct-inst ;

A.4.8 Predefined Routines

A.4.8.1 Deep Copy and Compare Routines

deep_copy(expr : struct-type) : struct-type

deep_compare[_physical](inst1: struct-type, inst2: struct-type, max-diffs: int): list of string

A.4.8.2 Output Routines

out ("string", expr, ...);

out ( struct-inst );

outf ( "string %c ...", expr ); // c is a conversion code: s, d, x, b, o, u

A.4.8.3 Selected Configuration Routines

set_config( category, option, option-value )

get_config( category, option );

A.4.8.4 Selected Arithmetic Routines

min|max ( x: int, y: int): int

abs(x: int): int

ipow(x: int, y: int): int

isqrt(x: int): int

odd|even (x: int): bool

div_round_up(x: int, y: int): int

A.4.8.5 Bitwise Routines

expr.bitwise_and|or|xor|nand|nor|xnor(expr: int|uint): bit

A.4.8.6 Selected String Routines

appendf(format, expr, ...): string

append(expr, ...): string

expr. To_string(): string

bin|dec|hex(expr, ...): string

str_join(list: list of string, separator: string): string

str_match(str: string, regular-expr: string): bool

str_replace(str:string, regular-expr:string, replacement:string):string

str_split(str: string, regular-expr: string): list of string

A.4.8.7 Selected Operating System Interface Routines

system("command"): int

date_time(): string

output_from("command"): list of string

output_from_check("command"): list of string

get_symbol(UNIX-environment-variable: string) : string

Files.write_string_list(file-name: string, list: list of string)

A.4.8.8 Stopping a Test

stop_run(); // stops the simulator and invokes test finalization

Previous Section Next Section