IES Training
IES Training
IES Training
Yu Peng
pengyu@cadence.com
021-61222335
Module 1: Fundamentals:
Briefly describe Incisive simulation
Set up your environment for Incisive simulation
News group
http://groups.google.com/group/comp.lang.verilog
http://www.faqs.org/faqs/verilog-faq
Verilog Publications
Donald E. Thomas and Philip Moorby. The Verilog Hardware Description
Language. Springer (http://www.springer.com), 2009.
Cadence Documentation
Verilog-XL Reference (http://sourcelink.cadence.com)
News group
http://groups.google.com/group/comp.lang.verilog
http://groups.google.com/group/SystemVerilog
SystemVerilog Publications
Bergeron, J., Cerny, E. (et al.), Verification Methodology Manual for
SystemVerilog. Springer (http://www.springer.com), 2005.
Cadence Documentation
SystemVerilog Reference (http://sourcelink.cadence.com)
From the GUI, select the Help menu in windows and Help button on forms
Customer
Submit a service request online. Support
Online Form If your problem requires more
From the SourceLink web site, Service than customer support, then a
fill out the Service Request product change request (PCR)
Creation form.
Request is initiated.
PCR R&D
Chapter 1
Module topics:
Introduction to Incisive simulation
The Incisive verification platform
Interleaved Native Compiled-code Architecture (INCA)
Simulator support of SystemC, VHDL, Verilog, and SystemVerilog
The simulator library of derived design data
The simulator tool flow
Elaborate
ncelab SIG
Path Legend
primary SSS
transparent
optional
ncsim
This training focuses on the multi-step mode only to promote your understanding.
You may elect to use the single-step mode for most of your work.
Chapter 2
Module topics :
Setting up the simulation environment
Create library directories
Create cds.lib and hdl.var files
Optionally create a setup.loc file
Use the nchelp, ncls, and ncrm utilities
The default search order for the cds.lib and hdl.var and setup.loc files is:
1. Current directory
2. $CDS_WORKAREA
3. $CDS_SEARCHDIR
4. $HOME
5. $CDS_PROJECT
6. $CDS_SITE
7. <install_dir>/share
The simulator must find a valid cds.lib file and a valid hdl.var file in this search. The simulator
uses only the first cds.lib and hdl.var files found during the search, but you can use the
INCLUDE keyword to explicitly include additional files.
You can alternatively just read the help message files in:
<install_dir>/tools/inca/files/help
Just enter the arguments to remove one or all views of a specified cell from one or
all libraries. Omitting the library and view removes all versions of the cell.
Chapter 3
Module topics:
Compiling your design
Specify the source HDL location
Specify the destination library
Maximize simulator performance
COD
ncelab SIG
Path Legend
SSS primary
transparent
optional
ncsim
INCA
To conditionally compile Verilog code to be run by the simulator only
`ifdef CDS_TOOL_DEFINE
Cadence-specific Verilog code...
`ifdef INCA
Incisive simulator-specific Verilog code...
`endif
`endif
-specificunit [lib.]cell[:view]
Specify a single design unit to compile
and optionally a library and view in which to store compiled units
ncvlog alu.v -specificunit design_lib.arith:rtl
-cmdfile filename
Provide a compilation command file
ncvlog -cmdfile 2bit_adder_test.cmd
-unit [lib.]cell[:view]
Specify a design unit to recompile (the original source must still be accessible)
ncvlog -unit design_lib.arith
VIEW_MAP
Map file extensions to view names
Define VIEW_MAP (.vb => behav, .vr => rtl, .vg => gate, + => module)
VIEW
Specify the view in which to store compiled objects.
This variable overrides the VIEW_MAP variable.
Define VIEW gate
-view view_name
Specify the view in which to store compiled objects.
This option overrides the VIEW and VIEW_MAP variables.
ncvlog top.v -view behav
-specificunit [lib.]cell[:view]
Specify a single design unit to compile
and optionally a library and view in which to store the compiled objects.
This option overrides the work and view options.
ncvlog alu.v -specificunit design_lib.arith:rtl
`worklib design_lib
`view rtl
module alu(...);
// definition...
endmodule
`noworklib
`noview
The IEEE Std. 1364 does not reference the `worklib and `view compiler
directives. These are vendor directives specific to the Cadence simulator.
-linedebug
Enable support for all line debug operations.
This option negatively impacts subsequent simulation performance!
ncvlog fifo.v -linedebug
-noline
Suppress display of source code with error messages.
ncvlog fifo.v noline
-libcell
Tag compiled modules as library cells
ncvlog -libcell cell_lib.v
-sv
Enable SystemVerilog constructs
ncvlog -sv top.v
-v1995
Favor Verilog 1995 constructs
ncvlog -v1995 top.v
Chapter 4
Module topics:
Elaborating your design
Specify the top-level design units to elaborate
Specify the design configuration
Specify the destination snapshot name
Maximize subsequent simulator performance
ncelab SIG
Path Legend
primary SSS
transparent
optional
ncsim
INCLUDE $CDS_INST_DIR/tools/inca/files/cds.lib
Define WORK worklib
The IEEE Std. 1364-2001 describes Verilog configurations. Other binding rules this
subsection describes are specific to the Cadence simulator.
VIEW_MAP
Specify views and the order to search them
Define VIEW_MAP ( .vr => rtl, .vg => gate, + => module )
The elaborator searches the LIB_MAP libraries and VIEW_MAP views in order,
starting with the library and view in which it found the definition of the subunit parent
and wrapping around to the beginning of the list if necessary.
-viewname view_name
Specify views and the order to search them. Overrides VIEW_MAP.
ncelab top -viewname gate -viewname module
The version 9.2 documentation does not describe the -viewname option. These training
materials describe this undocumented option for historical purposes. Although the elaborator
still accepts this option, your use of it unnecessarily complicates the subunit resolution process.
The IEEE Std. 1364 does not reference the `uselib compiler directive.
This directive is specific to the Cadence simulator.
Specify the library map file. The library library mlib top.v;
library lib1 sub1.v;
map file specifies configurations for
library lib2 sub2.v;
each design unit to elaborate. You must config top;
define the libraries in the cds.lib file. The design top;
library map file overrides all other default liblist mlib lib1 lib2;
methods to specify the library in which instance top.sub1 use lib1.sub;
to find subunit definitions. instance top.sub2 use lib2.sub;
endconfig
ncelab top -libmap libmap.txt
-snapshot [lib.]cell[:view]
Explicitly specify a library, cell, or view in which to store a snapshot.
ncelab top -access RWC -snapshot debug
-access [+] [-] access Set the default global design object access control:
R read, W write/read, C connectivity/read
-ncinitialize [Verilog] Retain RW access to variables for initialization
-show_forces [Verilog] Enable simulator to show Verilog code forces.
Requires access.
-afile filename Provide a file of design object access controls that override
the default global design object access controls
Option Description
-loadpli1 library:boot_function Dynamically register a PLI application
-loadvpi library:boot_function Dynamically register a VPI application
See the Applications Programming chapter.
-sparsearray size
Implement as a sparse array any one-dimensional array of reg vector, integer, or time
having the specified number of elements or more
ncelab top -sparsearray 1024
In the first lab, you In the second lab, you In the third lab, you
compile, elaborate, and compile, elaborate, and compile, elaborate, and
simulate an ALU design simulate a memory design simulate a scalable
and its testbench and its testbench multiplexor design and its
testbench
8 8 aw w w
addr
accum data a b
read mem
opcode alu s smx
3 write data
aluout zero y
8 dw w
Chapter 5
Module topics:
Simulating your design
Specify the simulation snapshot
Specify the simulation run mode
Automatically update your design
Maximize simulator performance
.so SSS
AST SCD VST
ncsim
Path Legend
primary user
transparent interface
optional
-tcl
-batch
Invoke the simulator with the Tcl
Override a -tcl option
command-line interface
(perhaps in NCSIMOPTS variable)
ncsim -tcl cpu_test
ncsim -batch cpu_test
-run
Start simulation immediately without
-exit
waiting for command input
ncsim -gui -run cpu_test Explicitly exit simulation upon executing
a Verilog $stop system task or upon
ncsim -tcl -run cpu_test simulation completion
ncsim cpu_test \
-input my_script.tcl exit
Option Description
-loadcfc library:boot_function Dynamically register a CFC application
-loadfmi library:boot_function Dynamically register a FMI application
-loadvhpi library:boot_function Dynamically register a VHPI application
-loadvpi library:boot_function Dynamically register a VPI application
See the Applications Programming chapter.
The profiler samples the simulation 100 times per CPU second, recording what
code line or simulator function is currently executing
The -profile or -sprofile option writes three tables to ncprof.out
Detailed full profile ranking
Profile ranking by module
Profile ranking by sample type
------------------------------------------------------------
Stream Counts (96 hits total)
------------------------------------------------------------
%hits #hits #inst name
45.8 44 [ ] Method SSS_KM_CL2TA (method)
15.6 15 [ 1] Always stmt (file: ./top.vlog, line: 29 in worklib.top [module])
7.3 7 [ ] Method SSS_KM_FINDRFT (method)
6.2 6 [ 1] Always stmt (file: ./top.vlog, line: 9 in worklib.top [module])
5.6 5 [ 1] Logic primitive 'nand' (zero delay) (method)
...
------------------------------------------------------------
Most Active Modules (behavioral)
------------------------------------------------------------
%hits #hits #inst name
33.3 32 [ 1] worklib.top:vlog (file: ./top.vlog line: 3)
------------------------------------------------------------
Stream Type Summary Counts (96 hits total)
------------------------------------------------------------
%hits #hits #inst name
56.2 54 [ ] Standard methods (mostly fanout propagation)
21.9 21 [ 2] Always statements
9.4 9 [ ] Logic primitives
8.3 8 [ 4] Non-blocking assignments
3.1 3 [ 1] Continuous assignments
1.0 1 [ ] Outside engine
0 1 2 3 4 5 6 7
clk
sel
sel rd ALUOP
opcode rd
ld_ir
ld_ir
zero inc_pc inc_pc SKZ JMP
ctl halt halt HALT
clk ld_pc
data_e ld_pc JMP
rstn ld_ac
data_e STO
wr
ld_ac ALUOP
rd STO
Module topics:
Debugging with the textual interface
Enter the interactive simulation mode
Examine and traverse the design
and much more!
and more...
When you interrupt the simulator, it enters interactive mode and prompts you:
ncsim>
While the simulation is suspended, all signals retain their current state.
You can enter interactive commands at the prompt, and then resume simulation.
Until you complete the current command, Tcl instead prompts with: >
You can get help with the standard Tcl commands from SourceForge
(http://tcl.sourceforge.net/) and the Tcl Developer Xchange (http://www.tcl.tk/).
The Incisive Simulator Tcl Command Reference online document and the Tcl help command
partially document the standard Tcl commands marked here with an asterisk (*).
For brief help on debugging commands, enter help or help command from the interactive
mode. For a detailed description, refer to the Incisive Simulator Tcl Command Reference
online document.
You can provide multiple object names, and you can wildcard the object names:
ncsim> find carry
ncsim> find carry out
ncsim> find ca*
ncsim> find *
If updating a signal
Displays time of breakpoint, and current debug scope
ncsim> where
Line 32, file "./rgs_test.v", scope (rgs_test)
Scope is (rgs_test.r1)
rgs_test
scope -set rgs_test.r1.d7 c1 r1
scope -list m0 m4 d0 d4
m1 m5 d1 d5
m3 m7 d3 d7
scope -list d7
module rgs (
output [7:0] q ,
input [7:0] data,
input clk ,
input enb ,
input rstn );
You can also use scope -drivers to list all drivers, including currently active
forces, on signals at the current HDL scope.
initial
begin
$shm_open("waves.shm");
$shm_probe("S",top.alu, "AC");
end
June 21, 2011 Incisive Enterprise Simulation training 135
Probe Signals from Testbench Code: Verilog VCD
The Verilog language provides testbench capture of signal waveform data.
A Value Change Dump (VCD) file contains ASCII header information, variable definitions, and
value change data.
You can manipulate a VCD database with these Verilog system tasks:
initial
begin
$dumpfile("verilog.dump");
$dumpvars(0,top);
end
$dumpports ( scopes, filename ) Open database. Optionally provide scopes and name.
Standard default name is dumpports.evcd
$dumpportslimit ( size, filename ) Stop recording after size bytes
$dumpportsoff ( filename ) Stop recording
$dumpportson ( filename ) Start recording again
$dumpportsall ( filename ) Checkpoint the values of all recorded signals
$dumpportsflush ( filename ) Flush database to disk
initial
$dumpports(top.dut); // DUT scope to dumpports.evcd
See the slightly different Cadence $dumpports implementation on the next page.
initial
$dumpports(top.dut); // DUT scope to verilog.evcd
ncsim> run 20 ns
Ran until 60 NS + 0
ncsim> run step
Stepped to 60 NS + 0
If you input the command script with input and continue the simulation:
At the next interactive prompt the simulator echoes and executes the script:
ncsim> input script.tcl; run 10
Ran until 10 NS + 0
ncsim> puts [format "Executed script at %s" [time -nounit]]
Executed script at 10
Entering Control-d twice consecutively from the interactive prompt also exits
the Tcl shell process.
status Display resource (CPU time and memory) usage and simulation time
status
ncsim> status
data
ld_ac accumulator instruction ld_ir
clk
rstn (rgs) register clk
ac_out (rgs) rstn
data sel
[7:5] ir_out [4:0]
ir_addr
opcode (operand)
ALU MUX
ld_pc program pc_out (smx)
inc_pc counter
alu_out (cnt)
zero rstn
rd addr
wr memory
ld_ir (mem) data
controller ld_ac
ld_pc
(ctl) inc_pc
halt
data_e
sel
June 21, 2011 Incisive Enterprise Simulation training 155
Debugging with the Graphical Interface
Chapter 7
Simulator &&
Post-Processing Environment Simvision
Access all component of Simvision without simulator
snapshot
terminate
Console Register
Design Browser
Waveform
Register
Expression Calculator
Assertion Browser
Simcompare Manager
PD group
- shutoff expr
-- expr signals
- isolation group
-- isolation expr
--- expr signals
-- isolation port(s)
- retention group
-- save expr
--- expr signals
-- restore expr
--- expr signals
-- retention element(s)
note cross-hatched outputs!
Chapter 8
Module topics:
Introduction to simulator utilitie
Use ncroot in your scripts to get the installation root of cds_root itself.
%ncroot
/cds/INCISIV92/IUS92
HAL checks the design for consistency, reusability, portability, semantic correctness,
synthesizability, testability, and more.
Just enter the arguments to remove one or all views of a specified cell from one or
all libraries. Omitting the library and view removes all versions of the cell.
The ncsdfc utility by default writes the filename.X compiled SDF file and the
filename.sdfd decompiled file.
To find the library file suffix that the installed tools use, e.g.
You can use ncsuffix in a shell command to filter file names:
ncsuffix {-all -ast -cod -pak -sig -sss -vst} [options]
% set suffix = ncsuffix -nocopyright -pak
% echo $suffix
sun4v.174.pak
% ls worklib/*.$suffix
worklib/inca.sun4v.174.pak
This example determines whether the proposed name is a legal Verilog name.
nmp isLegalName Verilog '$myName'
illegal
This example maps an escaped Verilog library name to the file system namespace.
nmp mapName Verilog Filesys '\cpu-lib '
cpu#2dlib
Following pages more fully describe the comparison and check commands.
You can translate VCD, EVCD, HSPICE, Nutmeg, Epic, and Qsim to SST2.
You can translate SST2 to VCD or CSV.
The simvisdbutil utility by default creates local SST2 .dsn and SST2 .trn files.
Use the HAL definition file editor to examine the default definitions
Chapter 9
Module topics:
Annotating SDF timing
Briefly describe the purpose of annotation
Understand an SDF timing data file
Work around SDF annotation issues
Annotate SDF timing data
Interconnect parasitics
Total load
Environmental factors
process
temperature
voltage
You also need to simulate fast clock with slow data and slow clock with fast data.
Most event simulators cannot directly do this.
Delay calculators can generate SDF data, or directly annotate timing data using the
Application Programming Interface (API).
Keyword Specifies
ABSOLUTE Absolute (replaced) delay values
INCREMENT Incremental (added) delay values
(LABEL (ABSOLUTE (name delays) ... ) (INCREMENT
(name delays) ... ) ... )
syntax
Keyword Specifies
ABSOLUTE Absolute delay replaces any existing delay
INCREMENT Incremental delay adds to any existing delay
PATHPULSE Path pulse control reject and error values
PATHPULSEPERCENT Path pulse control reject and error ratios (percent)
DEVICE Cell delay to a specific (or all) cell output(s) (or inout(s))
IOPATH Cell delay from a specific cell input (or inout) to a specific cell output (or
inout)
RETAIN Time for IOPATH to maintain previous state
COND Conditional cell delay
CONDELSE Default cell delay (applies only to matching COND)
NETDELAY Net delay from all sources of the net to all loads of the net
PORT Net delay from all sources of the net to a specific input (or inout) port
INTERCONNECT Net delay from a specific output (or inout) port to a specific input (or inout)
port
syntax
The IOPATH keyword to specify the delay from an instance input to an instance
output
This specifies min:typ:max delay for rise, fall, and turn off edges
( IOPATH INA OUTA (7:8:9) (1:2:3) (4:5:6) )
This specifies min:typ:max delay, reject, and error for all edges
( IOPATH INA OUTA ( (7:8:9) (1:2:3) (4:5:6) ) )
syntax
Keyword Specifies
PATHCONSTRAINT Max path delay
PERIODCONSTRAINT Max clock period
SUM Max sum of multiple path delays
DIFF Max difference between two path delays
SKEWCONSTRAINT Max clock skew
ARRIVAL Input port arrival time
DEPARTURE Output port departure time
SLACK Input port available slack
WAVEFORM Clock waveform
syntax
The annotator must apply cell path data only to existing constructs
Edge-qualified SDF cell paths do not map to unqualified cell paths
Conditional SDF cell paths do not map to unconditional cell paths
The elaborator by default executes any $sdf_annotate system tasks unambiguously scheduled
to execute at simulation time 0. That means:
You cannot place the $sdf_annotate system task in an always block
You cannot precede the $sdf_annotate system task with a timing control
You cannot place the $sdf_annotate system task in a case, for, repeat. or while
You cannot place the $sdf_annotate system task in an if statement if the conditional
expression is not statically computable
Chapter 10
Functional Verification
Formal Verification with PSL
Module-Based
OVM
L Incisive XL SystemC
Verification
with VHDL Simulation of PSL Verification (SCV)
Assertions
XL Verification XL
Specman Elite
Advanced Planning Using
Verification Enterprise Planner
Basics for
Environment Verification
Developers Workshop
Simulation