e Language
Field Guide
Syntax Conventions
Comments, Identifiers & Literals
Types, Constants, Fields & Variables
Operators, Loops and Flow Control
Structs & Units
Methods & TCMs
Checking & Coverage
Packing & Simulator Interface
Events & Temporal Expressions (TE)
Generation & Constraints
Lists & List Pseudo-Methods
Actions (Predefined Routines)
Miscellaneous & Specman Test Flow
e Language
Field Guide
Revision 1.0 (for e v3.3)
The following conventions are used in this guide:
bold
->
Keywords & required syntax elements
name
->
User supplied/specified name
expr
->
User supplied/specified e expression
[xyz]
->
Optional elements ([ ] not included)
[]
->
Required elements ([ ] only)
->
Choice
...
->
Optional repeated element
->
Explanatory note
Syntax Conventions
Comments, Identifiers & Literals
Types, Constants, Fields & Variables
Operators, Loops and Flow Control
Structs & Units
Methods & TCMs
Checking & Coverage
Packing & Simulator Interface
Events & Temporal Expressions (TE)
Generation & Constraints
Lists & List Pseudo-Methods
Actions (Predefined Routines)
Miscellaneous & Specman Test Flow
Comments, Identifiers, & Literals
Sized Numeric Literals
Comments
All can include _ for readability and - for negation
Code blocks are enclosed by <'' '>
// or -- used for inline comments
Legal Characters
Identifiers
Case sensitive
Start with letter, then any combination of a-z, A-Z, _ and
0-9
File names follow these same rules and end with ''e''
#'d, #'D then: 0..9
2'd3, 8'D11, -14'D8763
Binary
#'b, #'B then: 0..1
-2'b11, 4'b10_01
Hex
#'x, #'X, #'h, #'H then: 8'x2F, -4'h1, 16'X2a_3b
0..9, a..f, A..F
Octal
#'o, #'O then 0..7
3'o7, -6'O37, 12'o55_66
String Literals
Any ASCII character or escape sequence enclosed in
Escape sequences: \n = new line \t = tab
\f = form feed \ = quote
\\ = backslash \r = carriage return
Unsized Numeric Literals
All may include _ for readability and - for negation
Decimals may use K (kilo *1024) and M (mega *10242)
Legal Characters
Examples
Decimal
Examples
Decimal
0..9
2K, 11, 3_456, -8763
Binary
0b, 0B then: 0..1
-0b11, 0B10_01
Hex
0x, 0X, 0h, 0H then:
0..9, a..f, A..F
0x2F, -0h10, 0X2a_3b
Octal
0o, 0O then 0..7
0o76, -0O37, 0o55_66
Character Literals
Single ASCII character enclosed in & preceded by 0c
var c: uint (bytes:2) = 0cA
Comments, Identifiers & Literals
Types, Constants, Fields & Variables
Operators, Loops & Flow Control
Structs & Units
Methods & TCMs
Checking & Coverage
Packing & Simulator Interface
Events & Temporal Expressions (TE)
Generation & Constraints
Lists & List Pseudo-Methods
Actions (Predefined Routines)
Miscellaneous & Specman Test Flow
Types, Constants, Fields & Variables
Constants
Predefined Types
Type
int
uint
bit
byte
time
bool
string
locker
file
Name
Description
32 bit signed integer
32 bit unsigned integer
1 bit unsigned integer (values: 0 or 1)
8 bit unsigned integer (values: 0..255)
64 bit unsigned integer (values: 0..263-1)
1 bit boolean (values: 0=FALSE, 1=TRUE)
A group of ASCII characters enclosed in
Struct to control access to shared resources
Used for file I/O
User-Defined Types (Statements)
Any user-defined struct/unit can be used as a type.
New scalar types can be defined and extended using:
type type_name : [name [=n],...];
extend type_name : [name [=n],...];
New scalar sub-types can be created using:
type type_name : [u]int (bits:n | bytes:n);
Default
0
0
0
0
0
Used with boolean variables, fields, and expr
FALSE
Used with boolean variables, fields, and expr
NULL
With structs = null pointer, with strings = empty
UNDEF
Indicates NONE when index or value expected
MAX_INT
Largest 32 bit int (231-1)
MAX_UINT Largest 32 bit uint (232-1)
FALSE
Smallest 32 bit int (-231)
MIN_INT
NULL
NULL
NULL
Description & Usage
TRUE
Fields (Struct/Unit Members)
[!!][%
%]field_name : type;
// !=dont gen %=physical
[!!][%
%]field_name : type [ (bits:n | bytes:n)];
// limit size
[!!][%
%]field_name : type [ [ min..max ] ]; // constrain gen value
// create list
[!!][%
%]field_name[gen_size] : list of type;
Variables (Actions)
var var_name : [ type ] [ = expr ]; // create a variable
// assign to existing variable
var_name = expr;
Type Conversion (Actions)
name = expr.as_a(type);
Types, Constants, Fields & Variables
Operators, Loops & Flow Control
Structs & Units
Methods & TCMs
Checking & Coverage
Packing & Simulator Interface
Events & Temporal Expressions (TE)
Generation & Constraints
Lists & List Pseudo-Methods
Actions (Predefined Routines)
Miscellaneous & Specman Test Flow
Operators, Loops & Flow Control
Looping Constructs (Actions)
Operators and Precedence (Expressions)
Operator
[]
[..]
[:]
f( )
Description
List indexing
List slicing
Bit slicing
Method call
Field selection
~
!, not
{;}
%{ }
Unary +, *, /, %
+, >>, <<
<, <=, >, >=
is [not] a
==, !=
===, !==
~, !~
[not] in
&, |, ^
&&, ||, and, or
=>
a?b:c
Bitwise not
Boolean not
List concatenation
Bit concatenation
Unary plus, minus
Multiply, divide, modulus
Add and subtract
Shift right, shift left
Comparison
Subtype identification
Equality, inequality
Verilog four-state comparison
String matching
Range list operator
Bitwise AND, OR, XOR
Boolean AND, OR
Boolean implication
Conditional operator (Ex: if a then b else c)
while bool_expr [do] { action; ... };
for {initial; bool_expr; step} [do] {action;...};
for iterator from expr [down] to expr [step expr]
[do] { action;... };
for each [type] [(iterator_name )]
[using index (index_name)]
in [reverse] list [do] { action;... };
for each file [(iterator_name )] matching file_name_expr
[do] { action;... };
for each line [(iterator_name )] in_file file_name
[do] { action;... };
break; terminates execution of the loop
continue; go to next loop iteration now
Flow Control Constructs (Actions)
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;...};] };
all of { {action blk1;} {action blk1;}... };
first of { {action blk1;} {action blk1;}... };
Operators, Loops & Flow Control
Structs & Units
Methods & TCMs
Checking & Coverage
Packing & Simulator Interface
Events & Temporal Expressions (TE)
Generation & Constraints
Lists & List Pseudo-Methods
Actions (Predefined Routines)
Miscellaneous & Specman Test Flow
Structs & Units
when Inheritance (Struct/Unit Members)
when value['field] struct_type { struct/unit_member ;... };
extend value['field] struct_type { struct/unit_member ;... };
Defining (Statements)
struct struct_type [like struct_type] {
struct_member;... };
unit unit_type [like unit_type] { unit_member;... };
Example of using when inheritance
//Add non-generated field to GOOD version on my_unit
extend GOOD my_unit {
!data : my_struct;
};
Extending (Statements)
extend struct_type { new_struct_member;... };
extend unit_type { new_unit_member;... };
Predefined Methods (Struct/Unit Members)
See also when inheritance below.
Common
Methods
Instantiating (Struct/Unit Members)
// !=do not generate
[!!]field_name : struct_type;
// field name=struct type
[!!]struct_type;
[!!]field_name[gen_size] : list of struct_type; // create a list
// instantiate a unit
name : unit_type is instance;
// field name unit name
unit_name is instance;
field_name[gen_size] : list of unit_type;
// create a list
Example: define, extend & instantiate structs/units
struct my_struct {
struct_int : int;
};
unit my_unit {
kind
: [GOOD, BAD];
unit_int : int;
};
extend my_struct {
struct_int2 : int; // Add a new field to my_struct
};
Description
init()
Initializes ungenerated fields, etc.
pre_generate()
[empty] - Prepares for generation
post_generate() [empty] - Manipulates generated data
run()
[empty] - Starts TCMs at time 0
extract()
[empty] - Extracts from DUT post test
check()
[empty] - Defines post test check
quit()
Deactivates a struct/unit instance
finalize()
Creates final reports, etc.
copy()
Returns a non-recursive copy of struct
do_print()
Defines print format; called by print action
print_line()
Prints a struct/unit in a single line
do_pack()
Called when struct/unit is packed
do_unpack()
Called when struct/unit is unpacked
extend sys {
test_bench : my_unit is instance;
my_unit is instance; // instance of my_unit
hdl_path()
Ties unit to DUT component; units only
get _unit()
Returns reference to a unit
};
(get|try)_enclosing_unit(unit-type) Rtn ref nearest unit unit-type
Structs & Units
Methods & TCMs
Checking & Coverage
Packing & Simulator Interface
Events & Temporal Expressions (TE)
Generation & Constraints
Lists & List Pseudo-Methods
Actions (Predefined Routines)
Miscellaneous & Specman Test Flow
Methods & TCMs
Result & Return Keywords
Defining Methods (Struct/Unit Members)
method( [input: [*]type, ...] ) [ :return_type ] is {action;...};
result = expr;
return = [ expr; ]
Extending Methods (Struct/Unit Members)
method( [input: [*]type, ...] ) [ :return_type ]
is also | is first | is only { action;... };
Using Methods (Actions)
A regular method can be called from a regular method.
Example: method() is { method1(); method2();}
Inputs must match those previously defined.
Defining TCMs (Struct/Unit Members)
method( [input: [*]type, ...] ) [ :return_type ] @ event is
{ action;... };
A regular method or TCM can be called from a TCM.
Example: TCM()@event is { method1(); TCM1;}
A TCM can be started from a regular method or TCM.
Example: method() is { method1(); start TCM1;}
Extending TCMs (Struct/Unit Members)
method( [input: [*]type, ...] ) [ :return_type ] @ event
is also | is first | is only { action;... };
Example: using return, result, & invoking methods
extend test {
data
: list of byte;
!parity1 : byte;
!parity2 : byte;
parity_calc1(input:list of byte) :byte is {
result = 0;
for each (byte) in input {
result = result ^ byte
Time Consuming Actions (Actions)
sync TE;
wait [until] TE;
// continue when TE succeeds
// wait until next time TE succeeds
};
Example: define
struct test {
method1() is
method2() is
tcm1() @ clk
};
and extend methods and TCMs
parity_calc2() :byte is {
var tmp : byte = 0;
for each (byte) in data {
tmp = tmp ^ byte;
{ out(Hello - m1); };
{ out(Hello - m2); };
is { wait; out(Hello - tcm1); };
};
};
extend test {
method1() is also { out(2nd msg - m1); };
tcm1() is first { wait; out(1st msg - TCM); );
method2() is only { out(Only msg - m2); };
return tmp;
};
run() is also {
start tcm1; //tcm1 defined in prev example
parity1 = parity_calc1(data);
parity2 = parity_calc2();
};
Executing method1() results in:
Executing method2() results in:
Executing tcm1() results in:
Hello - m1; 2nd msg - m1
Only msg - m2
1st msg - TCM; Hello - tcm1
};
};
Methods & TCMs
Checking & Coverage
Packing & Simulator Interface
Events & Temporal Expressions (TE)
Generation & Constraints
Lists & List Pseudo-Methods
Actions (Predefined Routines)
Miscellaneous & Specman Test Flow
Checking & Coverage
Coverage Group Options
Data Checks (Actions)
check [ that ] bool_expr [else dut_error(string-expr)];
no_collect
count_only
global
text = string
weight = uint (default 1)
when = bool_expr radix = DEC | HEX | BIN (default DEC)
Temporal Checks (Struct/Unit Members)
Coverage Item Options
expect TE [ else dut_error(string-expr) ];
Setting dut_error() Response (Actions)
set_check ( match string, Check Effect );
Check Effect
Description
ERROR
Print message, increase num_dut_errors,
terminate method and test run
ERROR_
Print message, increase num_dut_errors,
BREAK_RUN stop simulation at next clock boundary
Print message, increase num_dut_errors,
ERROR_
AUTOMATIC terminate method as if hit stop_run()
ERROR_
CONTINUE
WARNING
IGNORE
Print message, increase num_dut_errors,
continue the test run
Print message, increase num_dut_warnings,
continue test run
No message and does not increase error or
warning counters
Coverage Definition (Struct/Unit Members)
cover group_event [using cover_group_options]
is [also] {
};
item name [ : type=expr ] [using cover_item_options, ...];
cross item1, item2, ...[using cover_item_options, ...];
transition item [using cover_item_options, ...];
no_collect
at_least = uint (default 1)
text = string
weight = uint (default 1)
when = bool_expr radix = DEC | HEX | BIN (default DEC)
ignore | illegal = cover_item_boolean_expr
ranges={range( [n..m], name, [every_count, at_least] );
range( [n..m], name, [every_count, at_least] ); }
Configuring Coverage (Actions)
set_config(cover, mode, coverage_mode );
coverage_mode: normal = save each sample/time
count_only = save only count/bucket
Typically, set_config is placed in an extension of the
global struct setup_test() method as shown below.
Example of defining coverage:
extend packet {
event pkt_data;
cover pkt_data using text=Packet Coverage is {
item address using illegal=address==0;
item data using
ranges={range([0..100], sm),
range([101..255], lg) },
radix = HEX, at_least = 10 ;
cross address, data ;
};
};
extend global {
setup_test() is also {
set_config(cover, mode, normal);
};
};
Checking & Coverage
Packing & Simulator Interface
Events & Temporal Expressions (TE)
Generation & Constraints
Lists & List Pseudo-Methods
Actions (Predefined Routines)
Miscellaneous & Specman Test Flow
Packing & Simulator Interface
Accessing HDL Signals (Expressions)
'[~/HDL/][path/]name [ @ x | @z ] '
// appends to hdl_path()
Packing (Expressions)
dest_name =pack( option, src_name [, src_name, ... ] );
unpack(option, src_name, dest_name [, dest_name, ...] );
options: packing.high packing.high_big_endian
packing.low
packing.low_big_endian
packing.network
list_of_bits.swap( unit_size, group_size );
Example of packing and unpacking:
struct packet {
%addr : uint (bits:4); keep addr == 2b1111;
%data : uint (bits:8); keep data == 8b10101010;
};
extend sys {
pkt1 : packet;
!pkt2 : packet;
test() is {
var packed : list of bit;
var swapped : list of bit;
packed=pack(packing.high, pkt1);//1111_10101010
unpack(packing.low, packed, pkt2); // oops!
swapped=packed.swap(4,12);
};
};
Executing sys.test() results in:
pkt2.addr=2b1010 and pkt2.data=8b1111_1010
swapped = 1010_10101111
Verilog Specifics (Statements/Struct/Unit Members)
verilog import filename;
verilog code {string [ ; string ] };
verilog time unit_time / precision;
verilog variable '~/HDL/path' using option, [, ...] ; // reg
options: net | wire, forcible
drive = verilog_expr
hold = verilog_expr // must also specify drive=
strobe = verilog_expr
verilog variable '~/HDL/path' [mem_range][width];
verilog function '~/HDL/path''(param1[, ...]) :rtn_bit_size;
verilog task '~/HDL/path' (param1[, ...]);
VHDL Specifics (Statements/Struct/Unit Members)
VHDL code {string [ ; string ] };
VHDL driver '~/HDL/path' using option [, ...];
options: disconnect value= sized_literal
delay= numeric_expr
mode= INERTIAL | TRANSPORT
initial value= sized_literal
VHDL time value units;
VHDL function 'name' using option [, ...];
options: interface= (param1[, ...]) return rtn_type
library= library_name
package= package_name
alias= alias_name
declarative_item= VHDL item;
VHDL procedure 'name' using option [, ...];
options: same as for VHDL function
force & release (Actions)
force '~/HDL/path' = expr;
release '~/HDL/path';
The force/release actions work for any VHDL signal, but
only work for Verilog signals declared forcible in a verilog
variable statement.
Packing & Simulator Interface
Events & Temporal Expressions (TE)
Generation & Constraints
Lists & List Pseudo-Methods
Actions (Predefined Routines)
Miscellaneous & Specman Test Flow
Events & Temporal Expressions (TE)
Defining Events (Struct/Unit Members)
event name;
event name is TE;
event name is only TE;
// named event
// temporal event
// extending
Triggering Events (Actions)
emit event_name;
// trigger named event (Action)
Acting On Events (Struct/Unit Members)
on event_name { action; ... };
TCMs also rely on events (see Methods & TCMs).
Predefined Events
sys.any
sys.tick_start
session.start_of_test
struct.quit sys.new_time
sys.tick_end
session.end_of_test
Temporal Expressions (Expressions)
TEs are valid only within wait and sync constructs,
event declarations, and expect constructs.
@[struct_instance.]event_name // event as a TE
TE @sampling_event
// TE w/ associated sampling event
change | rise | fall (expr)@
@sampling_event // transition TE
change | rise | fall ( '~/HDL/path' )@
@sim // HDL related TE
true(bool_expr)@
@sampling_event
// boolean condition TE
//
occurrence
of a sampling event
cycle @sampling_event
// specify a sim time delay of expr
delay( expr )
// repetition of TE, expr=numeric
[ expr ] [*TE]
[ [min] .. [max] ] [*TE]; TE2 // 1st match or TE2 var repeat
~[ [min] .. [max] ] [*TE]
// xlates: [min]*TE or [min+1]*TE...
{ TE1; TE2 [;...] }
// temporal sequence - TE1 then TE2
TE1 => TE2
// if TE1 succeeds, then TE2 must occur
// logical and/or
TE1 and | or TE2
// logical negation at any time
not TE
fail TE
// succeeds when all possibilities to pass are exhausted
// TE happens eventually
eventually TE
// creates a separate thread
detach(TE)
// exec action on TE succeed
TE exec { action; ... }
// remove event occurrence
consume( @event ;
Some examples of TE:
// Define sim controlled event (rise of clk)
event clk is rise ('~/top/clk') @sim;
// Event A occurs if TE1 and TE2 occur in the same
// clk cycle
event A is {TE1 and TE2} @clk;
// Event B occurs if TE2 occurs 1 cycle after TE1
// (action is exec when TE1 occurs)
event B is {TE1 exec{action;} ; TE2} @clk;
// Event C occurs if TE2 occurs within n1 & n2 clk
// cycles after TE1
event C is {TE1; [n1-1..n2-1]; TE2} @clk;
// Event D occurs if TE2 occurs after n clk cycles
// with no TE1
event D is V{[n]* not TE1 ; TE2} @clk;
// Event E occurs if TE3 occurs anytime after TE1
// with no TE2 in between
event E is {TE1; [..]*not TE2; TE3} @clk;
// TE2 must occur 1 clk cycle after TE1
expect TE1 => TE2 @clk;
// If TE1 occurs, eventually TE2 must occur
expect TE1 => (eventually TE2) @clk;
// TE3 must occur n cycles after TE1 or TE2 occur
expect (TE1 or TE2) => { [n-1]; TE3 } @clk;
// If TE1 occurs, TE2 cant occur for n cycles
expect TE1 => { [n]* not TE2; TE2 }@clk;
// If TE1 occurs ~/top/ready must be true
expect (not TE1 or true('~/top/ready'))@clk;
// If TE2 occurs, TE1 must occur n cycles before
expect TE2 => detach( {TE1; [n+1]} )@clk;
Events & Temporal Expressions (TE)
Generation & Constraints
Lists & List Pseudo-Methods
Actions (Predefined Routines)
Miscellaneous & Specman Test Flow
Generation & Constraints
Generation (Actions)
gen name;
// name can be a field, variable, or struct instance
gen name keeping { [soft] constraint_expr; ... };
Generation Methods (Struct/Unit Members)
Whenever a struct is generated, its predefined methods
are run in order. Extend these to tailor generation.
Method
Description
init()
Initializes ungenerated fields, etc.
pre_generate()
[empty] - prepares for generation
post_generate()
[empty] - manipulates generated data
Constraints (Struct/Unit Members)
[!!][%
%]field_name : type [ [ range ] ];
keep [soft] bool_expr;
keep [soft] name [not] in [ range ];
keep [soft] name [not] in list;
keep bool_expr1 => bool_expr2;
keep for each [(iterator_name)]
[using [index (index_name)] [prev (prev_name) ] ]
in list_name { [soft] bool_expr | nested_for_each };
keep soft name == select {weight : value;
weight : value;... };
keep [soft] gen (name1 [, ...] ) before (name2 [, ...]);
keep struct_list.is_all_iterations( .field_name [, ... ] );
keep struct_list.is_a_permutation( list );
keep name.reset_soft()
keep unit_name.hdl_path() == [~/HDL/][path/]string;
keep struct_name is [not] a value['field] struct_type;
Constraint Examples:
x : int [0..10];
// same as keep x in [0..10]
keep soft x == 1
// x defaults to 1
keep x <= y;
// x less than or equal to y
keep x in {3,4,5}; // x must be 3 or 4 or 5
keep x+y == z;
// restrict x+y to value z
keep parity = parity_calc(); // force w/ method
// if x is 1, then y must be in range 1..10
// translates to: x != 1 or y in [0..10]
keep x == 1 => y in [0..10];
struct packet {
kind :[good, bad];
addr : uint;
data : uint;
};
extend sys {
pkts : list of packet
keep pkts.size() < 20;
// gen < 20
keep for each (pkt) in pkts {
index > 0 =>
pkt.addr == prev.addr; // same addr
index==2 =>
pkt is a good packet;
// #3=good
};
list1 : list of packet;
!list2 : list of packet;
keep list1.is_all_iterations(.addr);
gen_one() is {
gen list2 keeping {
it.is_a_permutation(list1);
};
};
Generation & Constraints
Lists & List Pseudo-Methods
Actions (Predefined Routines)
Miscellaneous & Specman Test Flow
Lists & List Pseudo-Methods
Defining Lists (Struct/Unit Members)
[!!][%
%]field_name[gen_size] : list of type;
[!!][%
%]field_name[gen_size] : list (key: field_name) of type;
Ex: To create multi-dim arrays, create list structs:
struct one_dim { a : list of uint; };
struct two_dim { b : list of one_dim; };
Lists Pseudo-Methods (Actions/Expressions)
Direct Modification of a List
// add item or list to end of list
list.add(item | list);
// add item or list to start of list
list.add0(item | list);
// delete all items in list
list.clear();
list.delete(index);
// delete item at index (adjust others)
// delete item at index (move last)
list.fast_delete(index);
list.insert(index,item | list); // add item / list at index of list
// delete & return last item in list
item = list.pop();
// delete & return first item in list
item = list.pop0();
// add item to the end of list
list.push(item);
// add item to the start of list
list.push0(item);
list.resize(size [,full, filler, keep_old]); // pad or truncate list
Queries & General Operations on a List
// all w/ bool_expr=TRUE
list=list.all(bool_expr);
list1=list.all_indicies(bool_expr); // all w/ bool_expr=TRUE
// compute on each item
list1=list.apply(expr);
// # where bool_expr=TRUE
int=list.count(bool_expr);
// TRUE if index is in the list
bool=list.exists(index);
// 1st w/ bool_expr=TRUE
item=list.first(bool_expr);
int=list.first_index(bool_expr); // index 1st w/ bool_expr=TRUE
list1=list.get_indicies(list_of_int); // new list index items listed
bool=list.has(bool_expr);
// TRUE if list has bool_expr=TRUE
bool=list.is_a_permutation(list1);// checks list vs. list1
// TRUE if no items in list
bool=list.is_empty();
// last item bool_expr=TRUE
item=list.last(bool_expr);
int=list.last_index(bool_expr); // index last w/ bool_expr=TRUE
item=list.max(expr);
// item w/ expr calcs to max
// index w/ expr calcs max
int=list.max_index(expr);
// max value calcd for expr
int=list.max_value(expr);
// item w/ expr calcs to min
item=list.min(expr);
// index w/ expr calcs to min
int=list.min_index(expr);
// min value calcd for expr
int=list.min_value(expr);
// rev order of items of list
list1=list.reverse();
// number of items in the list
int=list.size();
list1=list.sort(expr);
// sort list incr order of expr value
list1=struct_list.sort_by_field(field); // sort list in incr order
var struct_list_holder := struct_list.split(expr); // split on expr
// return last item, no delete
item=list.top();
// return first item, no delete
item=list.top0();
list1=list.unique(expr);
// list1 where expr is unique in list
Math & Logic Operations on a List
bool=list.and_all(bool_expr); // AND of all w/ bool_expr=TRUE
// int avg expr calcd for ea item
int=list.average(expr);
// OR of all w/ bool_expr=TRUE
bool=list.or_all(bool_expr);
// int prod of expr calcd ea item
int=list.product(expr);
// int sum of expr calcd ea item
int=list.sum(expr);
int=list.crc_8(from,num);
// crc8 bit/byte list-start at from byte
int=list.crc_32(from,num); // crc32 bit/byte list-start at from byte
int=list.crc_32_flip(from,num); // crc32 ea byte & result flipped
Specifics for Keyed Lists
// list item with key = value
item=list.key(value);
// index of list item w/ key = value
int=list.key_index(value);
bool=list.key_exists(value); // TRUE if key = value exists in list
Lists & List Pseudo-Methods
Actions (Predefined Routines)
Miscellaneous & Specman Test Flow
Actions (Predefined Routines)
Output (Actions)
// output expr new line end
out(expr [,,expr...]);
outf(format_string,expr [,,expr...]); // formatted output of exprs
format_string = %[ 0 | - ] [ min# ] [. [ max# ] ] (s | d | x | b | o | u)
0 - pads w/ 0s not blanks s- string
b - binary
- aligns left
d - decimal
o - octal
x- hex
u - uint
Arithmetic (Expressions)
int= op=value // (op can be: +,-,*,/,%,&,|,^) ex: x +=1 increments x by 1
int=[min][max[(expr1,expr2); // min / max of expr1 or expr2
// absolute value of expr
int=abs(expr);
// TRUE if expr is odd
bool=odd(expr);
// TRUE if expr is even
bool=even(expr);
// log base-n of expr (n=2, 10)
int=ilogn(expr1);
// x to the power of y (xy)
int=ipow(expr1, expr2);
// square root of expr
int=isqrt(expr);
int=div_round_up(expr1,, expr2); // expr1 / expr2 round nxt int
Bitwise (Expressions)
bit=bitwise_op(expr);
// unary reduct(op = and, or, xor, nand, nor, xnor)
Copy and Compare (Expressions)
// recur struct copy
struct_type=deep_copy(struct_inst);
string_list=deep_compare(struct1,struct1,max); // recur all
string_list=deep_compare_physical(struct1,struct1,max);
String Manipulation (Expressions)
string=append(expr [,expr...]);
string=appendf(expr [,expr...]);
string=bin(expr [,expr...]);
string=dec(expr [,expr...]);
string=hex(expr [,expr...]);
string1=quote(string);
// concat expr to string
string1=str_chop(string,length); // truncate string to length
bool=str_empty(string);
// TRUE if string initd or empty
string1=str_exactly(string,length); // pad or trunc string to len
string1=str_expand_dots(string); // use with macro defines
string1=str_insensitive(reg_exp); // return AWK style reg expr
string1=str_join(string_list,sep); // concat using separator
// get the string length
int=str_len(string);
// conv string to lower case
string1=str_lower(string);
bool=str_match(string,reg_exp); // TRUE if string matches reg_exp
// pad string to length
string1=str_pad(string,length);
string1=str_replace(string,reg_exp,replacement);
string_list=str_split(string,sep); // break to strings on separator
string_list=str_split_all(string,sep); // separator also is string
string1=str_sub(string,from_int,length); // cut out substring
string1=str_upper(string);
// convert string to upper case
string1=expr.to_string(); // convert expr (struct, list, ...) to string
Misc (Actions/Expressions)
Actions
set_config(category, option, value [option,value])
[ [with] {action;...} ];
// set config for only specified actions
value_type=get_config(category, option); // value of option
// write config to file.ecfg
write_config(filename);
// read config from file.ecfg
read_config(filename);
// sets keep-across-restore
set_keep(TRUE | FALSE);
// gets keep-across-restore
bool=get_keep();
The keep-across-restore value controls whether config
& debug settings are retained across restores and reloads.
// concat & send to Specman
specman(command[,,...] );
spawn(command[,,...] );
spawn_check(command);
// concat & exec via system()
// send cmd-errors = error()
// concat fmtd (see outf)
// concat w/ binary num fmt
Expressions
// concat w/ dec num fmt
// snd cmd return result code
int=system(command);
string_list=output_from(command); // get result as string list
string_list=output_from_check(command); // calls error()
string=get_symbol(env_variable); // gets unix env variable
// gets current date and time
string=date_time();
// concat w/ hex num fmt
// copy of string in quotes
Actions (Predefined Routines)
Miscellaneous & Specman Test Flow
Specman Test Flow (Reference)
Miscellaneous
Compile Time Directives
// load e file; if no ext, .e used
import filename;
#ifdef [`]macro then { e code }; // if macro def, incl e code
#ifndef [`]macro then { e code};// if macro not def, incl e code
Initialization
Load
global.init()
Test
Macros
global.setup_test()
define [`]macro replacement;
// simple macro replacement
define <macro'non-terminal-type> match_string
as {replacement using <parsing elements>};
define <macro'non-terminal-type> match_string
as computed {replacement using <parsing elements>};
Pre-Run Generation
global.generate_test()
<struct>.init()
<struct>.pre_generate()
<struct>.post_generate()
Sharing Resources
resource_name: locker; // define locker filed in shared resrc
// reserve resource (waits until avail)
resource_name.lock();
resource_name.unlock(); // release the resource
State Machines
Simulation Run
global.start_test()
<struct>.quit()
Gen action
(on the fly)
global.run_test()
state machine state_holder [until final_state]
{ (transition | state) {action;...} ... };
transition can be: state => state or * => state
sys.time
global.stop_run()
<struct>.run()
Post-Run Check
File I/O
global.extract_test()
file=files.open(filename, mode, description);
mode can be: r, w, rw, a
// r / w line as text
bool=files.read[write](file, string);
bool=files.read[write]_lob((file, string); // r / w line as bin
// close open file
files.close(file);
// flush file buffers
files.flush(file);
string=files.add_file_type(name,ext,check_if_exists);
global.check_test()
<struct>.check()
Finalization
Legend
global.finalize_test()
Extendable method
Recursive call
Simulation run time
Non-extendable method
Miscellaneous & Specman Test Flow
Abstract phase flow
B u i l d y o u r k n o w - h o w.
Learn more than just e syntax. Learn how to apply
the language as a power tool for verifying todays
ultra complex systems.
Qualis offers a family of methodology-based training courses focused on Specman Elite. Youll go
from learning the basics of e to learning an
advanced verification methodology applying random constrained test generation, data/temporal
checking, and functional coverage. Detailed
course descriptions are available on our website at
www.qualis.com/learning.catalog.html/.
Attend a public course in North America or
Europe, or schedule a private onsite class. Start
building your verification knowledge today.
Qualis Design Corporation
Solutions in Advanced Verification and Design
Other quick reference cards available in print or from the web:
VHDL, Verilog, 1164 Packages and e Language.
Phone: +1.503.670.7200
Email:
[email protected]FAX: +1.503.670.0809
Web: http://www.qualis.com
We welcome your comments about this document.
Send them to
[email protected]. Identify the revision (Rev 1.0).
2001 Qualis Design Corporation. Permission to reproduce and
distribute strictly verbatim copies of this document in whole is granted.