0% found this document useful (0 votes)
1K views4 pages

Quick Reference Specman

Quick reference for specman-E
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views4 pages

Quick Reference Specman

Quick reference for specman-E
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

e Language

Quick Reference

November 2011
This card contains selected e constructs. For complete e syntax, see
the Specman e Language Reference.
Abbreviations:
arg - argument
bool - boolean
enum - enumerated
exp - expression

inst - instance
num - number
TCM - time-consuming method
TE - temporal expression

Predefined Types
bit

byte

int

bool

uint

string

int | uint ( bits: n | bytes: n )

Predefined Events
Method / TLM Interface Ports Statements, Struct and Unit Members

sys.any

port-inst-name: [list of] direction method_port of method-type is


instance;

Temporal Expressions (TEs)

keep bind(port-exp1, port-exp2);


keep bind(port-exp1, external | empty | undefined);
port-exp1.connect(port-exp2 |empty | undefined);
port-inst-name : [list of] [direction] interface_port of tlm-intf-type
[using prefix=prefix | using suffix=suffix] [is instance];
UVM Style Syntax - Instead of "direction interface_port of", use:
interface_port of
interface_export of
interface_imp of

real

list [ (key: field-name) ] of type

port1-exp.connect(port-exp2 | "external_uvm_path" | empty |


undefined)

exp = exp.as_a( type ) // type conversion

Constraints

User-Defined Types

Statements

struct struct-type [ like base-struct-type ] { struct members };


unit unit-type [ like base-unit-type ] { unit members };
type type-name : [u]int ( bits: n | bytes: n );

Struct and Unit Members

keep [name is [only]] [soft] constraint-definition // [only] option in


IntelliGen only
keep soft bool-exp == select { weight : value; ... };

sys.time

Basic Temporal Expressions


@[struct-inst.]event-name

change | fall | rise(port$) @sim

change | fall | rise(exp)

true(bool-exp)

cycle

Boolean Temporal Expressions


TE1 and TE2

TE1 or TE2

not TE

fail TE

Complex Temporal Expressions


TE @[struct-inst.]event-name

{ TE; TE; ... }

TE1 => TE2

TE exec { action; ... }

[ n ] [ * TE ]
delay(exp)

detach(TE)

Time-Consuming Actions
wait [[until] TE];

Preprocessor Directives

keep field-name in [range];

sync [TE];

Statements, Struct Members or Actiors

#define []name [ replacement ]

keep bool-exp1 [=> | or | and] bool-exp2;

type enum-type: [name1, name2, ...];

struct-inst.quit

#undef name

keep exp in list;

#if[n]def []name then {e-code} [ #else {e-code} ] ;

keep exp1 ? exp2 : exp3;

Macros

keep list1.all_different(exp)

define <tag'syntactic-category> "match-exp" as {replacement}

Struct and Unit Members

keep list1.sum(exp1) == exp2

define <tag'syntactic-category> "match-exp" as computed {action;}

fields

constraints

when conditions

keep for each ( item ) in list { [soft] constraint-bool-exp; ... };

Syntactic Categories

methods and TCMs

cover groups

events

keep field-name.hdl_path() == string ;

statement struct_member action exp type cover_item command

extend type-name : [ name [=n], ... ];


extend struct-type | unit-type { additional struct or unit members };

temporal struct|unit members

preprocessor directives

Fields

Struct and Unit Members

Generation On the Fly

Actions

Variable Declarations and Assignments

Actions

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

var var-name : type;

var var-name : = value;

[const][!][%]field-name : type;

do field-name [keeping {constraint,...}] //sequences

var-name = exp ;

[struct-exp.]field-name <= exp

when const-field { ...};

Predefined Methods for Any Struct

field-name[n] : list of type;

field-name : unit-type is instance;

run() extract()

list of [list of] type;

Conditional Extensions using When

finalize() visualize()

init() pre_generate() post_generate()

Struct and Unit Members

struct | unit struct-type | unit-type {


field-name : enum-type;
when name1 struct-type | unit-type { additional members };
};
extend name1 struct-type | unit-type { ... };

Simple / Event / Buffer Ports

check()

Struct and Unit Members

port-inst-name:[list of] [direction] simple_port of element-type is


instance;

Predefined Methods for Any Unit


get_unit() get_all_units()

get_enclosing_unit()

set_unit() connect_ports() check_generation()


try_enclosing_unit()

connect_pointers()

Temporal Struct and Unit Members


on [const-path.]event {action; ...}
on [const-path.]event-port$ {action; ...}

quit()

Template Types
template (struct | unit) template-name of (param-list) [like basetype] {template members }:
template-name of ( actual-param-list )

Methods and TCMs

[final] method-name ([param-list]) [: return-type] [@event] is


{action;...} // @event required for TCM
param-list syntax: param-name:param-type[=default-exp], ...
method-name ([param-list]) [: return-type] [@event-type] is
[also|first|only] {action;...}
return [exp]

port-inst-name:[list of] [direction] buffer_port of element-type is


instance;

expect | assume [rule-name is [only ]] TE


[ else dut_error( string, exp, ... ) ];

event-port-field-name:[list of] [direction] event_port is instance;

Events

[[struct-exp].]method-name([param-list])

keep [soft] port-exp.attribute() == value;

event event-name [ is [only] TE];

start TCM() // starts TCM in a new thread

keep bind(port-exp1, port-exp2);

emit [struct-inst.]event-name;

keep bind(port-exp1, external | empty | undefined);

Struct and Unit Members

Invoking Methods and TCMs

Actions

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

Sequence-Driver API

Selected Operating System Interface Routines

method1() is { method2(); method3(); };

gen_and_start_main: bool

system(command): int

method() is { start TCM();};

bfm_interaction_mode: bfm_interaction_mode_t

output_from(command): list of string

arbitration_mode: seq_arbitration_mode_t

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

get_next_item(): item_type @clock

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

Conditional Procedures

Actions

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


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

try_next_item(): item_type @clock

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

event item-done

case case-exp { case-action-block;... [ default[:] { action; ... } ;] };

driver.wait_for_grant(seq: any_sequence) @sys.any

Loops

Actions

date_time(): string

Stopping a Test
stop_run();

driver.deliver_item(item: any_sequence_item)

List Pseudo-Methods

driver.wait_for_item_done(item: any_sequence_item)@sys.any

Selected List Actions

for i from exp [ down ] to exp [step exp] [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-exp [do] { action; ... };

driver.execute_item(item: any_sequence_item)

add[0](list-item : list-type)

Messages

clear()

delete(index : int)

pop[0]() : list-type

push[0](list-item : list-type)

Ways to exit a loop:


break;

Message-Logger API
continue;

message([tag], verbosity, exp, ) [action-block]

Selected List Expressions

tags: list of message_tag

Checks

Actions

check [[name] that] bool-exp [else dut_error(message-exp, ...)]

verbosity: message_verbosity
// NONE (default), LO, MEDIUM, HIGH, FULL

size() : int

top[0]() : list-type

reverse() : list

sort(exp : exp) : list

sum(expr : int) : int

count (exp : bool) : int

exists(index : int) : bool

has(exp : bool) : bool

Operators

to_file: string
// target log file for printing (default extension is .elog)

is_empty() : bool

is_a_permutation(list: list) : bool

Operator precedence is left to right, top to bottom in the list

to_screen: bool // TRUE by default

all(expr : bool) : list

all_indices(exp : bool) : list of int

[ ] list indexing

[..] list slicing

first(expr : bool) : list-type

last(exp : bool) : list-type

[:] bit slicing

f() method or routine call

set_actions(verbosity: message_verbosity, tags: list of


message_tag, modules: string, text: string, op: message_operation)

key(key-expr : expr) : list-item

key_index(key-exp : exp) : int

. field selection

in range list

Packing and Unpacking Pseudo-Methods

max(expr : int) : list-type

max_value(exp : int) : int | uint

{... ; ...} list concatenation

%{... , ...} bit concatenation

exp = pack( pack-option, exp, )

min(expr : int) : list-type

min_value(exp : int) : int | uint

~ bitwise not

!, not

unpack( pack-option, value-exp, target-exp [ , target-exp, ... ] )

swap(small : int, large : int) : list of bit

+, - unary positive, negative

*, /, % multiply, divide, modulus

Predefined Routines

crc_8|32(from-byte : int, num-bytes : int) : int

+, - plus, minus

>>, << shift right, shift left

<, <=, >, >=

is [not] a subtype identification

Deep Copy and Compare Routines

==, !=

comparison

boolean not

boolean equal, not equal ===,!== Verilog 4-state compare

Actions

deep_copy(exp : struct-type) : struct-type

unique(exp : exp) : list

all_different(exp : exp)

Coverage Groups and Items

Struct and Unit Members

set_config( category, option, option-value )

cover cover-group [ using [also] cover-group-options ] is [empty]


[also] {
item item-name [: type = exp ] [ using [also] cover-item-options ];
cross item-name1, item-name2, ... ; transition item-name;
};

a ? b : c conditional if a then b, else c

get_config( category, option );

Coverage Group Options

Sequences

Selected Arithmetic Routines

text = string

sequence seq-name [using sequence-option,...];


Options:
item = item-type // virtual sequence if not used
created_driver = driver-name // default: seq_name_driver
created_kind = kind-name // default: seq_name_kind
// pre-defined seq_name_kind: MAIN, SIMPLE, RANDOM

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

abs(x: int): int

when = bool-exp

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

isqrt(x: int): int

Coverage Item Options

odd|even (x: int): bool

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

text = string

weight = uint

no_collect

Bitwise Routines

radix = DEC|HEX|BIN

when = bool-exp

at_least = num

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

per_instance = bool

ignore | illegal = cover-item-bool-exp

Selected String Routines

ranges=range( [ n..m ], sub-bucket-name,


sub-bucket-size, at-least-number );

~, !~ string matching

&, |, ^ bitwise and, or, xor

deep_compare[_physical](inst1: struct-type, inst2: struct-type,


max-diffs: int): list of string

&&, and

||, or

Selected Configuration Routines

!, not

boolean and

boolean not

=>

boolean or
boolean implication

body() @driver.clock is [only] { ... };


do field-name [keeping {constraint;...}]
do [when-qualifiers] field-name [on driver-exp] [keeping
{constraint;...}]

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

append(exp, ...): string

exp. to_string(): string

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

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


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

weight = uint no_collect

radix = DEC|HEX|BIN

per_unit_instance [=unit-type]

Copyright 2000-2011 Cadence Design Systems, Inc.


2655 Seely Avenue, San Jose, CA 95134
(408) 943-1234 http://www.cadence.com

Specman

Quick Reference
January 2011
This card contains selected Specman commands and procedures. For
more information, see the Specman Command Reference.
Abbreviations:

dir - directory
inst - instance

exp - expression
num - number

General Help
help [string... | reg-exp] // ASCII help sn_help.sh
Help button in GUI

cdnshelp // help GUI

read cov[er[age]] [-merge -file = merge-filename] wildcardfilename,...

Starting Specman with a Simulator


%specrun [-p[re_commands] commands | @cmd-file.ecom]
[-c[ommands] commands...] [-e | -gui] -dlib | linked-specmanexecutable-and-parameters // Specman invocation using a linked
executable or dynamically linked to a shared library

IES Simulator
%irun file1.v file2.v test.e -snprerun "@batch.ecom"// single call
flow with IES (compiles Verilog files and e file, and executes precommands)

ModelSim

Creating an HDL Stub File

vsim -c -keepstdout top-module vsim-options

write stubs -ncvlog | -ncvhdl | -ver[ilog] | -ncsc | -ncsv | -esi [filename] // IES only; stub files not required for irun

integrated-vcs-executable -ucli [vcs-options]

VCS

write cov[er[age]] [-merge] filename


clear cov[er[age]]
sh[o[w]] cov[er[age]] [-kind = full | sum[mary] | spread[sheet]]
[-f[ile] = file-name ] [-contr[ibutors] [= num]] [-win[dow]]
[struct-type[.group-name[.item-name]]] [,...]
sh[o[w]] cov[er[age]] def [struct-type[.group-name[.item-name]]]
rank co[ver] [-sort_only] [-recover] [-window] [-file=file_name]
[-initial_list=file_name] [struct-type[.group-name[.item-name]]]

Waveform-Related Commands
set wave [ -mode=working-mode] viewer
// not needed for IES

write stubs -ver[ilog] | -qvh | -mti_sv | -osci | -vcs | -vcssv |-esi


[file-name]

Specman-specific irun Options

wave [exp] [-when] [-depth=uint] [ -field[s] [ -event[s] [ -thread[s]


exp

-nosncomp // prevents compiling Specman input files

wave ev[e[n[t]]] [ struct-type.event-type ]

Example: specman -command load top.e; write stubs -osci

-snchecknames // generates a warning if Specman references an


incorrect HDL path

Memory Commands

Compiler Script

-sncompargs strings // passes arguments to sn_compile.sh

*sh[o[w]] mem[ory] options


*sh[o[w]] path options

%sn_compile.sh // displays compiler script options

-snload files // loads e files before HDL access generation

%sn_compile.sh top.e // creates an executable named top with


compiled top.e module (and all other modules loaded by top.e)

-snprerun "comds" // specifies Specman commands to be executed


before simulation

% sn_compile.sh e_module -shlib t tmp_directory

-snseed seed // passes seed value to Specman

Message Command

%sn_compile.sh -shlib -exe top.e // creates a shared library and


executable that can be loaded dynamically into a simulator
(example-. Modelsim)

-snset "comds" // specifies Specman commands to be executed


before compiling or loading e files

*set me[s[sage[s]]] options

%sn_compile.sh -sim vcs -vcs_flags file1.v ... specman.v top.e


// creates a Specman executable named vcs_top that includes
VCS, compiled top.e, and Verilog source files

-snshlib shared-lib-path // uses the specified precompiled e shared


library

Log Commands
set log file-name [{command;...}]

Event Commands

-snstage stage_name // compiles all e files as a staged compile

show event[s] [time[..[time]] [struct-name.event-name] // wildcards


allowed for event commands.

Some Common Switches

-defineall macro // defines macro from command line for all


compilers

sh[ow] event def[initions] [struct-name.event-name [,]]

sim // specifies name of the simulator to be linked (xl, ncvlog, ncvhdl,


ncsim, vcs, vcssv)

-intelligen // configures generator to use intelligen

enable_DAC // compiles define as computed macros in the same


compilation phase
shlib // creates a shared library
parallel // improves performance by compiling modules in parallel

Starting Specman Standalone

Syntax Examples:

collect event[s] [struct-name.event-name [,]] [on | off]


tra[c[e]] ev[e[nt[s]]] options
del[ete] event[s]

% irun snshlib libsn_e_module.so hdl_files e_module


% irun snstage stage_name e_files -snstage stage_name e_files
-snstage -endsnstage e_files hdl_files

irun Coverage Options

Show Pack and Unpack Commands


show pack(pack-option, exp, ...)
show unpack(pack-option, value-exp, target-exp1 [,target-exp2,...])

-covworkdir work-dir // selects coverage work directory

%specman [-p[re_commands] commands | @cmd-file.ecom]


[-c[ommands] commands...] [-e | -gui]

-covscope scope-name // selects coverage scope name

Example:
specman -p "config print -radix = HEX" -p "load top" -e // starts
Specman, sets print radix to hex, loads top.e, and enables command
line editing mode.

Test Phase Commands

-covtest test-name // selects coverage test name

test | setup | generate | start | run [-option = value, ...] // options are
the related configuration options.
check

finalize

extract

Shell Commands
shell shell-command

Specman: Main Configuration Options


Categories
run

cover

Switching between Specman and Simulator Prompts

Saving and Restoring the State

gen

memory

<Return> // switches from Specman to the simulator


sn [spmn-cmd] // switches from simulator to Specman

*sav[e] options

simulation

ies

*res[t[ore]] options

gui

print

nc nc-cmd // passes simulator command from Specman to IES

*rel[o[ad]] options

Coverage Commands

*set retain state options

debugger
*conf[ig[ure]] category -option=value...

*sh[o[w]] conf[ig[ure]] // To see all configuration settings


*sh[o[w]] conf[ig[ure]] category // To see a specific category of
settings
*sh[o[w]] conf[ig[ure]] category -option // To see one or more
specific options of a category
*write conf[ig[ure]]
*read conf[ig[ure]]

Print and Report Commands

Special Events and Special Wild Cards (continued)

b[reak] [once] [on] break-option [@module] [if cond]


lb[reak] [once] [on] break-option [@module] [#[thread-handle] [if
cond]
Where break-options are:
c[all] [ext[ension]] [struct-wildcard.]method-wildcard
re[urn] [ext[ension]] [struct-wildcard.]method-wildcard
event [[struct-wildcard.]method-wildcard]
special-event-type [special-wildcard]

tcm_return

struct-wild-card.tcm-wild-card

tcm_wait

struct-wild-card.tcm-wild-card

tcm_state

struct-wild-card.tcm-wild-card

call

struct-wild-card.method-wild-card

return

struct-wild-card.method-wild-card

sim_read

signal-name-wild-card

sim_write

signal-name-wild-card

output

text wild-card

b[reak] [once] [on] l[ine] [line-number] [@module | @expansionindex] [if cond]

p[r[int]] exp[, ] [using print-options]


rep[ort] list-exp, {[headers]}, exp, [using print-options]
Note: Use the show config 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 | list-exp]

Setting Breakpoints

// display the contents of a struct or list

lb[reak] [once] [on] l[ine] [line-number] [@module | @expansionindex] [#[thread-handle] [if cond]

Command-Line Mode Debugging Commands

b[reak] [once] [on] change exp | error | interrupt | sim |


contention

sh[ow] sta[ck]

b[reak] [on] alloc [memory-size]

Managing Breakpoints

*write doc options

delete | disable | enable break [ last | id-number | "pattern" ]

Sequence Debug Command

show breakpoint

tra[ce] seq[uence] [destination] [on | off] [wild]


destination options: msg, log, transaction, all (default)

Setting and Managing Watches


customize watch watch-id [radix = DEC | HEX | BIN] [-items =
value | default]

Generation Debugger Commands


break [on] gen [action id [cfs id]] [error] [field
struct_name.field_name] // set generation break point; enable
collection of generation information
Examples:
break on gen error// collect generation information and stop on next
contradiction
break on gen field my_packet_s.*// collect generation information
and stop on next generation of any field of my_packet_s
sh[ow] gen [instance instance-name[.fieldname] | -ascii]

Source Code Debugger Commands


ne[xt]

fin[ish]

show watch

delete watch [watch-id]

abort

In the next few 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.

// show all threads

sh[ow] thr[ead] so[urce] [#[thread-id[.call-id]]] // show the e source


for the current thread
sh[ow] thr[ead] tr[ee] [#[thread-id]] // show the full tree of calls for
the current thread
sh[o[w]] def[ine[s]] [ -v ] [ -e ] [ " [`]wildcard-name" ] // -e : e
defines only; -v : Verilog defines
*sh[ow] macro[_call][s] options
collect [-file=file-name] [-after=module-name] [-reload] structname.method, // collect method extensions and print to log
sh[o][w]] mod[u[les]] [-checksum | -win[dow]]

Setting Traces

NOTE

tra[ce] [once] [on] trace-option [@module-name] [if cond]


ltra[ce] [once] [on] trace-option [@module-name] [#[thread-handle]]
[if cond]
Where trace-option is:
c[all] [ext[ension]] [struct-wildcard.]method-wildcard
re[urn] [ext[ension]] [struct-wildcard.]method-wildcard
l[ine] [line-number]
special-event [special-wildcard]

* --The command has '-h[elp]' option that prints the description

tra[ce] [once] [on] change exp | contention

cont[inue] [to breakpoint-syntax] step_any[where]


st[ep]

[l]watch exp [-radix = DEC | HEX | BIN] [-items = value] [#thread-id]

sh[ow] thr[ead]

// show the calls stack for the current thread

tra[ce] [on] packing | reparse


tra[ce] [on] check [struct-wild-card.method-wild-card ] [@modulename]
tra[ce] deep
tra[ce] glitch [on | off] c[all] [port-e-path]
tra[ce] internal-port-activity [unit-wildcard | port-wildcard]
[destination] [off]
tra[ce] external-port-activity [[agent-wildcard.]unit-wildcard. | portwildcard] [destination] [off]

Special Events and Special Wild Cards


Special Event Name

Special Wild Card

tcm_start

struct-wild-card.tcm-wild-card

tcm_end

struct-wild-card.tcm-wild-card

tcm_call

struct-wild-card.tcm-wild-card

of this command and its options. The parameters of this


command can be given in any order.

Copyright 2000-2011 Cadence Design Systems, Inc.


2655 Seely Avenue, San Jose, CA 95134
(408) 943-1234 http://www.cadence.com

You might also like