e Language
Quick Reference
February 2002 This card contains selected e constructs. For complete e syntax, see the e Language Reference. Abbreviations: arg - argument bool - boolean enum - enumerated expr - expression inst - instance num - number TCM - time-consuming method TE - temporal expression
Constraints
keep [soft] bool-expr;
Struct and Unit Members
// for example, keep eld1 <= MY_MAX // bool-expr1 implies bool-expr2
Invoking Methods and TCMs
TCM2()@event-name is { TCM1(); method();}; method1() is { method2(); method3(); }; method() is { start TCM();};
Actions
// calling methods // calling methods
keep [soft] eld-name in [range]; // example: keep eld1 in [0..256] keep bool-expr1 => bool-expr2; keep [soft] eld-name in list; keep list.is_all_iterations( eld-name ); keep list1.is_a_permutation( list2 ); keep for each ( item ) in list { [soft] bool-expr; ... }; keep soft bool-expr == select { weight : value; ... }; keep [soft] gen ( item-a ) before ( item-b ); keep gen-item.reset_soft(); // ignore soft constraints on gen-item keep eld-name.hdl_path() == string ; //eld-name is unit instance
// 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.
Checks
check that bool-expr [ else dut_error( ... ) ];
Actions
Predened Types
bit byte int uint bool // unsigned integer with value 0 or 1 (default: 0) // unsigned integer in the range 0-255 (default: 0) // 32-bit signed integer (default: 0) // 32-bit unsigned integer (default: 0) // n-bit or n-byte signed int or uint // one-bit boolean (0 = FALSE, 1 = TRUE) (default: FALSE)
Variable Declarations and Assignments
var var-name : type; // declare a variable
Actions
var-name = expr ;
// e.g. eld-name=expr, var-name=method()
Generation On the Fly
gen gen-item ; gen gen-item keeping { [soft] constraint-bool-expr ; ... };
Actions
var var-name : = value; // declare and assign a variable
int | uint ( bits: n | bytes: n )
Operators
Operator precedence is left to right, top to bottom in the list [ ] list indexing [:] bit slicing . eld selection {... ; ...} list concatenation ~ bitwise not +, - unary positive, negative +, - plus, minus <, <=, >, >= boolean comparison ==, != ~, !~ string matching &&, and !, not boolean and boolean not [..] list slicing
list [ (key: eld-name) ] of type // a list of elements of the specied type (default: empty) string // strings are enclosed in quotes: my string (default: NULL)
Methods and TCMs
Struct and Unit Members
regular-method ( [arg : type, ...] ) [: return-type] is { action; ... }; TCM ([arg : type, ...] ) [: return-type] @event-name is { action; ... };
f () method or routine call
in range list %{... , ...} bit concatenation !, not boolean not *, /, % multiply, divide, modulus >>, << shift right, shift left is [not] a subtype identication
Type Conversion
expr = expr.as_a( type )
Extending or Changing Methods and TCMs User-Dened Types
unit unit-type [ like base-unit-type ] { unit members }; type type-name : [u]int ( bits: n | bytes: n ); // denes a scalar type type type-name : [ name [=n], ... ]; // denes an enumerated type extend type-name : [ name [=n], ... ]; // extends an enumerated type extend struct-type|unit-type { additional struct or unit members }; // extends a struct or unit
Statements
method ( arg : type, ... ) [: return-type] is also|rst|only { action; ... }; TCM ( arg : type, ... ) [: return-type] @event-name is also|rst|only { action; ... };
struct struct-type [ like base-struct-type ] { struct members };
Conditional Procedures
if bool-expr [ then ] { action; ... } [ else if bool-expr [ then ] { action; ... } ] [ else { action; ... } ] ;
Actions
boolean equal, not equal ===,!== Verilog 4-state compare &, |, ^ bitwise and, or, xor ||, or => boolean or boolean implication
case { bool-expr[:] { action; ... } ; [ default[:] { action; ... } ;] }; case expr { value[:] { action; ... } ; [ default[:] { action; ... } ;] };
a ? b : c conditional if a then b, else c
Struct and Unit Members
elds methods and TCMs constraints cover groups when conditions events preprocessor directives
Loops
Actions
Simulator Interface
verilog import le-name;
Statements and Unit Members
// n is result size in bits // statement only // statement only // unit member only
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 le le-name [do] {action; ... }; while bool-expr [do] { action; ... }; break; continue; // break the current loop // go to the next iteration of the loop
verilog function HDL-path(params) : n; verilog task HDL-path(params); verilog time Verilog-timescale; vhdl driver HDL-path using option, ;
temporal struct|unit members
Fields
[!][%]eld-name : type;
Struct and Unit Members
// ! = do not generate, % = physical eld // creates a list with n elements // for units only, not structs
eld-name[n] : list of type; eld-name : unit-type is instance;
vhdl function designator using option, ; vhdl procedure identier using option, ; vhdl time VHDL-timescale; // statement only
Conditional Extensions using When
Struct and Unit Members
Predened Methods of All Structs
run() init() copy() extract() pre_generate() do_print() check()
Struct and Unit Members
nalize() quit()
type enum-type: [name1, name2, ...]; struct|unit struct-type|unit-type { eld-name : enum-type; when name1 struct-type|unit-type { additional members }; }; extend name1 struct-type|unit-type { ... };
Printing
print expr[,] [using print-options] ; print struct-inst ;
Action
post_generate() print_line()
Events
event event-name [ is [only] TE]; // struct or unit member emit [struct-inst.]event-name; // action
Predened Routines Deep Copy and Compare Routines
deep_copy(expr : struct-type) : struct-type
Actions
List Pseudo-Methods Selected List Actions
add[0](list-item : list-type) clear() pop[0]() : list-type add[0](list : list) delete(index : int) push[0](list-item : list-type)
Predened Events
sys.any
deep_compare[_physical](inst1: struct-type, inst2: struct-type, max-diffs: int): list of string
struct-inst.quit
Output Routines Temporal Struct and Unit Members
on event-name { action; ... } ; expect|assume [rule-name is [only ]] TE [ else dut_error( string, expr, ... ) ]; out (string, expr, ...); out ( struct-inst ); outf ( string %c ..., expr ); // c is a conversion code: s, d, x, b, o, u
insert(index : int, list : list | list-item : list-type)
Selected List Expressions
size() : int reverse() : list sum(expr : int) : int exists(index : int) : bool is_empty() : bool all(expr : bool) : list rst(expr : bool) : list-type rst_index(expr : bool) : int key(key-expr : expr) : list-item max(expr : int) : list-type min(expr : int) : list-type top[0]() : list-type sort(expr : expr) : list count (expr : bool) : int has(expr : bool) : bool is_a_permutation(list: list) : bool all_indices(expr : bool) : list of int last(expr : bool) : list-type last_index(expr : bool) : int key_index(key-expr : expr) : int max_value(expr : int) : int | uint min_value(expr : int) : int | uint
Selected Conguration Routines
Note: Categories for these routines are listed in Conguration Commands in the Specman Elite Quick Reference. set_cong( category, option, option-value ) get_cong( category, option );
Temporal Expressions (TEs)
All TEs have an explicit or implicit sampling event
Basic Temporal Expressions
@[struct-inst.]event-name change|fall|rise(expr) // event instance true(bool-expr) cycle change|fall|rise(HDL-path) @sim // simulator callback annotation
Selected Arithmetic Routines
min|max ( x: int, y: int): int ipow(x: int, y: int): int odd|even (x: int): bool fail TE abs(x: int): int isqrt(x: int): int div_round_up(x: int, y: int): int
Boolean Temporal Expressions
TE1 and TE2 TE1 or TE2
not TE
Bitwise Routines
expr.bitwise_and|or|xor|nand|nor|xnor(expr: int|uint): bit
Complex Temporal Expressions
TE @[struct-inst.]event-name
{ TE; TE; ... } // explicit sampling // sequence // if TE1, then TE2 follows // execute when TE succeeds // xed repeat // rst match repeat // true match repeat detach(TE)
swap(small : int, large : int) : list of bit crc_8|32(from-byte : int, num-bytes : int) : int unique(expr : expr) : list append(expr, ...): string bin|dec|hex(expr, ...): string
Selected String Routines
appendf(format, expr, ...): string
TE1 => TE2 TE exec { action; ... }
[ n ] [ * TE ] { ... ; [ [n]..[m] ] [ * TE ]; TE; ... } ~[ [n]..[m] ] [ * TE ] delay(expr)
expr. to_string(): string
Coverage Groups and Items
Struct and Unit Members
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
cover cover-group [ using [also] cover-group-options ] is [empty] [also] { item item-name [: type = expr ] [ using [also] cover-item-options ]; cross item-name1, item-name2, ... ; transition item-name; }; To enable coverage, extend the global struct as follows: setup_test() is also {set_cong(cover, mode, cover-mode)}
consume( @[struct-inst.]event-name )
Selected Operating System Interface Routines
system(command): int date_time(): string output_from(command): list of string
Time-Consuming Actions
wait [[until] TE]; sync [TE];
Coverage Group Options
text = string count_only weight = uint no_collect global radix = DEC|HEX|BIN when = bool-expr agent_options=SureCov options
output_from_check(command): list of string get_symbol(UNIX-environment-variable: string) : string les.write_string_list(le-name: string, list: list of string)
Using Lock and Release
struct struct-type { eld-name: locker; TCM() @event-name is { eld-name.lock(); ... eld-name.release(); }; };
Time-Consuming Actions
external=surecov
Coverage Item Options Stopping a Test
stop_run(); // stops the simulator and invokes test nalization text = string no_collect at_least = num no_trace per_instance when = bool-expr weight = uint radix=DEC|HEX|BIN name name ignore | illegal = cover-item-bool-expr ranges=range( [ n..m ], sub-bucket-name, sub-bucket-size, at-least-number ); agent_options=SureCov options
Copyright (c) 2000-2002 Verisity Design, Inc. 2041 Landings Drive, Mountain View, CA 94043 (650) 934-6800 http://www.verisity.com
Name Macros
dene []macro-name [ replacement ]
Statements
Packing and Unpacking Pseudo-Methods
expr = pack( pack-options, expr, ) // pack options: packing.high, packing.low
unpack( pack-options, value-expr, target-expr [ , target-expr, ... ] )
Preprocessor Directives
#if[n]def []macro-name then {string} [ #else {string} ] ; Note: Preprocessor directives can be statements, struct or unit members, or actions.
Specman Elite
Quick Reference
February 2002 This card contains selected Specman Elite commands and procedures. For more information, see the Specman Elite Command Reference. Abbreviations: dir - directory inst - instance expr - expression num - number
Simulator-Related Commands
show functions show procedures show subprograms // Verilog and VHDL // Verilog // VHDL // VHDL show tasks [and functions]
Conguration Commands
cong category -option = value; Category print Options radix, title, window, raw, items, list_from, list_is_horizontal, list_lines, list_starts_on_right, list_grouping, list_of_bit_in_hex, list_index_radix, list_end_ag, full, source_lines, line_size at_least_multiplier, grading_formula, verbose_interface, show_mode, sorted, max_int_buckets, absolute_max_buckets, mode, test_name, run_name, tag_name, dir, le_name, show_le_names, show_sub_holes, show_instances_only, show_partial_grade, ranking_cost, ranking_precision, gui_sync_mode, check_illegal_immediately, hole_color, illegal_bucket_color, chart_colors seed, default_max_list_size, reorder_elds, absolute_max_list_size, max_depth, max_structs, warn, resolve_cycles, check_unsatised_cons auto_scroll, use_help_browser tick_max, error_command, use_manual_tick exit_on,
show denes [ -v ] [ -e ] [ " [`]macro-name" ] // Verilog denes
General Help
help command [syntax] Specview Help button apropos command [syntax] Specview Vadvisor button
Starting Specman Elite or the Specview GUI Starting Specman Elite in Text Mode
specman [ -p[re_commands] commands ] [ -c[ommands] commands ] Example: specman -p "cong print -radix = HEX" -p "load top" // Starts Specman Elite, sets print radix to hex, and loads top.e
cover
Creating an HDL Stub File
write stubs -verilog | -qvh | -ncvhdl | -spd [le-name] specman -command load top.e; write stubs -verilog // creates stub le named specman.v for most Verilog simulators specman -command load top.e; write stubs -qvh my_stub.vhd // creates stub le for ModelSim VHDL named my_stub.vhd
Starting the Specview GUI
specview [ -p[re_commands] commands ] [ -c[ommands] commands ] [ integrated-executable parameters ] Example: specview xl_specman +gui -s xor.v specman.v // Starts Specview along with the Verilog-XL GUI, loads the xor.v // le and the specman.v stubs le
gen
gui run memory misc debug wave
Compiler Script
%sn_compile.sh // use with no arguments to display compiler script options %sn_compile.sh top.e // create an executable named top with compiled top.e module
gc_threshold, gc_increment, max_size, absolute_max_size, print_msg warn, pre_specman_path, short_is_signed watch_list_items working_mode, auto_refresh, register_structs, use_wave, stub_message_len, stub_output, stub_errors, stub_events, event_data, stub_integers, stub_strings, stub_strings_len, stub_booleans, list_items, thread_code_line, hierarchy_name, port, dump_le, timeout post_specman_path,
Running from Compiled Executables
%specsim [-pre-commands command ...] [-commands command ... ] [ integrated-executable parameters ] // General way to pass pre-commands to a compiled executable Verilog-XL: % xl_top -s le1.v le2.v specman.v // Invokes an executable named xl_top to start Specman Elite with // Verilog-XL, and load Verilog-XL les my_le1.v and my_le2.v Verilog-XL: %specsim -p "@batch.ecom" xl_top -s le1.v le2.v specman.v // Same as above, but with optional pre-commands ModelSim: % specsim -p "@batch.ecom" vsim -keepstdout top < batch.do VCS: % specsim -p "@batch.ecom" vcs_cpu_top -s -i batch.cmd
Verilog-XL or ModelSim
%sn_compile.sh top.e -sim xl // creates a Specman Elite executable named xl_top that // includes the compiled top.e module and Verilog-XL %sn_compile.sh top.e -sim qvh // creates a library that includes top.e and ModelSim (VHDL)
VCS
%sn_compile.sh -sim vcs -vcs_ags le1.v ... specman.v top.e // creates a Specman Elite executable named vcs_top that // includes VCS, compiled top.e and Verilog source les
show cong [ category [ option ]] write cong [ to ] le-name read cong [ from ] le-name
Incremental Compilation Command Sequence
1. sn_compile.sh -e my_dir -t . rst.e 2. sn_compile.sh -s my_dir/rst -t . next.e 3. sn_compile.sh -s my_dir/next -t . last.e
Test Phase Commands
test [ -option = value] setup_test check generate [-option = value] run [ -option = value] nalize_test start [-option = value] extract
Using a Specman Elite Command File
@le-name [parameter ...] Example: // Contents of my_batch.ecom le: load <1>; out(<2> is <3>); Execute my_batch.ecom: Specman> @my_batch my_code Today Wednesday Result: Loads my_code.e, prints Today is Wednesday
Switching between Specman Elite and Simulator Prompts
<Cntl>-<Return> // switch from simulator prompt to Specman Elite // in text mode (no simulator GUI is being used) $sn ; // switch from Verilog-XL or VCS to Specman Elite sn // switch from ModelSim to Specman Elite call sn // switch from NC Simulator to Specman Elite <Return> // switch from Specman Elite back to the simulator
Test Phase Command Options
seed = n | random max_depth = n max_structs = n reorder_elds = TRUE | FALSE resolve_cycles = TRUE | FALSE check_unsatised_cons = TRUE | FALSE default_max_list_size = n absolute_max_list_size = n warn = TRUE | FALSE
Record Commands Specman Elite Commands from Simulator Prompt
Verilog-XL or VCS: $sn(command); ModelSim: sn command NC Simulator: call sn {command} record start [ -dir = dir-name ] [ -redo [ redo-options ] ] [ -comment = "comment-text"] [ -comment_le = le-name ] [ -override [!] ] session-name
Saving and Restoring the State
load le-name save le-name restore [-override] [ -nokeep ] [le-name] reload [ -nokeep ]
Show Modules Command
show modules
Managing Breakpoints
delete break [ last | id-number | "pattern" ] disable break [ last | id-number | "pattern" ] enable break [ last | id-number | "pattern" ] set log off show breakpoint
Log Commands
set log le-name
Coverage Commands
read cover le-name clear cover show cover [-kind = full|summary|spreadsheet ] [-le = le-name ] [-contributors[= num]] [-window] [struct-type[.cover-group[(instance)][.item-name]]] show cover -tests show cover -def [struct-name[.event-name[.item-name]]] show cover -new -cross = (struct-type.cover-group.item-name, ...) [-interval = (struct-type.event-name, [struct-type.event-name | next])] [-only_simultaneous] [-win] show cover -unique_buckets le_name include cover[_tests] full-run-name [on|off] rank cover [-sort_only] [-recover] [-window] [-le=le_name] [-initial_list=le_name] [item-wild-cards] // wild cards can be used in le-name
Shell Commands
shell shell-command
Setting and Managing Watches
[l]watch exp [-radix = DEC|HEX|BIN] [-items = value] [#thread-id] update watch watch-id [radix = DEC|HEX|BIN] [-items = value|default] show watch delete watch [watch-id]
write cover [-merge] le-name
Print and Report Commands
Note: print and report can also be used in e code as actions. print expr, [using print-options] report list-expr, {[headers]}, expr, [using print-options] Note: Use the show cong print command to display print options. Examples: print sys.packets using radix=HEX report sys.packets, {"Addr \t Indx"; "%d \t %d"},.address,index tree [struct-inst | list-expr] // display the contents of a struct or list
Setting Traces
[l]trace [once] [on] call [extension] [struct-wild-card.]method-wildcard [@module-name] [#[thread-handle]] [if bool-expr] [l]trace [once] [on] return [extension] [struct-wild-card.]methodwild-card [@module-name] [#[thread-handle]] [if bool-expr] [l]trace [once] [on] line [line-number] [@module-name] [if bool-expr] [l]trace [once] [on] special-event-name [special-wild-card] [@module-name] [#[thread-handle]] [if bool-expr] trace [once] [on] change expr trace [on] packing trace [on] reparse
Generation Debugger Commands
col[lect] generation [off] show gen [-instance instance-name[.eld-name]]
Waveform-Related Commands
set wave [ -mode=working-mode ] viewer wave [ -when [ = when-regular-exp ] ] [ -eld[s] [ = elds-regular-exp ] ] [ -event[s] [ -event_data=event-data ] ] [ -thread[s] [ -code_line=bool ] ] exp wave event [ -data=data-option ] [ struct-type.event-type ] wave out
Special Events and Special Wild Cards
Special Event Name tcm_start abort tcm_end tcm_call tcm_return tcm_wait tcm_state call return sim_read sim_write output Special Wild Card
Source Code Debugger Commands
continue [to breakpoint-syntax] step next step_anywhere nish
struct-wild-card.tcm-wild-card struct-wild-card.tcm-wild-card struct-wild-card.tcm-wild-card struct-wild-card.tcm-wild-card struct-wild-card.tcm-wild-card struct-wild-card.tcm-wild-card struct-wild-card.method-wild-card struct-wild-card.method-wild-card signal-name-wild-card signal-name-wild-card text wild-card
In the next two sections, the #thread-handle option can only be used with the l (local) form of the command (e.g. lbreak, but not break). The special events and special wild cards used as options for some of the commands are listed separately at the end.
Memory Commands
show memory [-recursive] [struct-type | unit-type] who is [-full] struct-expr // show paths for all pointers to a struct
Setting Breakpoints
[l]break [once] [on] call [extension] [struct-wild-card.]method-wild-card [@module-name] [#[thread-handle] [if bool-expr] [l]break [once] [on] [return] [extension] [struct-wild-card.]method-wild-card [@module-name] [#[thread-handle]] [if bool-expr] [l]break [once] [on] line [line-number] [@module-name] [#[thread-handle]] [if bool-expr] [l]break [once] [on] special-event-name [special-wild-card] [@module-name] [#[thread-handle]] [if bool-expr] [l]break [once] [on] event [[struct-wild-card.]event-wild-card] [@module-name] [#[thread-handle]] [if bool-expr] break [once] [on] change expr break [once] [on] error break [once] [on] interrupt break [once] [on] simulator break [on] alloc [memory-size]
Event Commands
collect events [event-name [,]] [on | off] echo events [event-name [,]] [ on | off ] delete events show events [event-name | [ num [..[num] ] ] show event denitions [event-name, ] show events -chart [time-value | -prev | -next | -beginning | -end] [event-name, ]
Command-Line Mode Debugging Commands
show stack show threads // show the calls stack for the current thread // show all threads // show the e source for the current thread // show the full tree of calls for the current thread
show thread source show thread tree
show thread #thread-handle
Show Pack and Unpack Commands
show pack(options: pack_options, expr, ...) show unpack(options: pack_options, value-expr, target-expr, ... )
Copyright (c) 2000-2002 Verisity Design, Inc. 2041 Landings Drive, Mountain View, CA 94043 (650) 934-6800 http://www.verisity.com