Simulating_Modus_Verilog_Patterns_App_Note
Simulating_Modus_Verilog_Patterns_App_Note
© 2019 Cadence Design Systems, Inc. All rights reserved worldwide. Cadence and the Cadence logo are
registered trademarks of Cadence Design Systems, Inc. All others are the property of their respective
holders.
Contents
Purpose ................................................................................................................................................... 4
Audience .................................................................................................................................................. 4
Overview .................................................................................................................................................. 4
Review Modus Pattern Output and “mainsim.v” ...................................................................................... 5
Compile and Simulate Modus Patterns ................................................................................................... 6
Modus Test Pattern Plus (+) Options .................................................................................................... 10
MISCOMPAREDEBUG ...................................................................................................................... 11
Zero-Delay Simulation ........................................................................................................................... 12
SDF Annotation and Simulation ............................................................................................................ 13
Items to Check before Running SDF Simulations .............................................................................. 14
How to Execute SDF Timing via Modus Test Bench ......................................................................... 17
Execute SDF Timing without Using the Modus Test Bench sdf_annotate ......................................... 18
Additional Xcelium Simulator Information .............................................................................................. 20
XMLS and XMHELP .......................................................................................................................... 22
What Will My Simulation Output Look Like? .......................................................................................... 23
Xcelium Profiling .................................................................................................................................... 25
Summary ............................................................................................................................................... 26
Support .................................................................................................................................................. 26
Feedback ............................................................................................................................................... 26
Purpose
This application note illustrates how to compile and simulate Modus Verilog patterns using the
Cadence Xcelium simulator.
The application note is based on the “DELAY_SDF_TIMED” lab within the Advanced ATPG RAK
example. It is recommended that you download this Modus Advanced ATPG example and
practice running Xcelium simulation of the patterns.
Audience
All Modus users who want to first verify their test patterns before they are released to a
hardware tester.
Overview
Cadence Modus will produce LBIST (Logic BIST), MBIST (Memory BIST), and ATPG patterns
for both static and delay/transition faults. These patterns rely on test structures within the design
and possibly on the special event sequences defined by the user. Because of this dependence
and the possibility of incorrect event timing, all patterns created by Modus (or any test-
generation tool) should be verified via simulation.
This document defines how you simulate the Modus patterns. The process steps are fairly
simple:
• Simulate the Modus test bench by explicitly referencing a test pattern file(s) via the
+TESTFILE plus argument.
<WORKDIR>/testresults/verilog
In the export directory, you see the ‘mainsim.v’ file, which is the top-level test bench, and two
pattern files (one for the scan shift confidence patterns and one for the ATPG logic patterns).
VER.COMPRESSION_DECOMP_OPCG.data.logic.ex1.ts2.verilog
VER.COMPRESSION_DECOMP_OPCG.data.scan.ex1.ts1.verilog
VER.COMPRESSION_DECOMP_OPCG.mainsim.v
For some designs, there can be many pattern files. The ‘mainsim.v’ test benches are unique
for the test mode and type of pattern output. NEVER mix and match the mainsim.v files and
the pattern files.
It is for this reason that separate directories are recommended for each unique test mode and
for Parallel and Serial patterns.
o Note that if Genus has produced the ATPG data, the netlist will be in your Modus
working directory.
Hint: Look at the build_model command line to find the netlist and technology files. With very
few exceptions, the netlist and technology libraries here are also imported into Xcelium.
As an example, here is a list of files from the Advanced ATPG RAK referenced above.
• VER.COMPRESSION_DECOMP_OPCG.mainsim.v
• dtmf_chip.test_netlist.v
• ./LIBS/atpg/stdcell.v
• ./LIBS/atpg/pllclk_dft.v
• ./LIBS/atpg/pads.v
• ./LIBS/atpg/CDK_R512x16_dft.v
• ./LIBS/atpg/CDK_S128x16_dft.v
• ./LIBS/atpg/CDK_S256x16_dft.v
In the following example, you compile and simulate from within the write_vectors output
directory.
Genus write_atpg will output a single run script similar to this example.
xrun \
+simvision \
-delay_mode zero -seq_udp_delay 50ps -nospecify \
-timescale 1ns/1ps -override_timescale \
VER.COMPRESSION_DECOMP_OPCG.mainsim.v \
…/../../dtmf_chip.test_netlist.v \
-v ../../../LIBS/verilog/include_libraries_sim.v -incdir ../../../ \
+HEARBEAT +FAILSET \
+TESTFILE1=VER.COMPRESSION_DECOMP_OPCG.data.scan.ex1.ts1.verilog \
+TESTFILE2=VER.COMPRESSION_DECOMP_OPCG.data.logic.ex1.ts2.verilog
• This is NOT recommended for large designs. You will create too much data.
• This defines zero-delay simulation and tells the simulator to insert a 50ps delay
before updating the output of UDP sequential devices. This delay MUST be greater
than ½ of the timescale accuracy. It avoids zero-delay event order problems.
• -nospecify says to NOT use any of the technology cell ‘specify’ block timing
information. This is assumed when you use -seq_udp_delay.
• Set the ‘timescale’ for any module definitions that do not have one. If a module
is missing a timescale, you will get an elaboration error.
d. List the mainsim.v, chip Verilog, and technology library files to be compiled.
• The include file in this example references all of the technology files above Figure
1.
e. +HEARTBEAT requests runtime messages. Do this to show that the simulation has
not died. +FAILSET requests that every miscompare produces CPP failure data for
Cadence Diagnostics. This failure data is placed into a ‘FAILSET’ file.
f. Enter one ‘+TESTFILE<int>’ for each pattern file you want to simulate.
• If there is a simulation miscompare, you can rerun the simulation and ask for only
that pattern file.
• If the pattern files are huge, you can ask write_vectors to output a smaller range
of patterns:
write_vectors -testrange
With this three-step process, you simulate that exact same pattern set as in Figure 1 but use the
individual Xcelium commands.
Notes:
• Always use the same Xcelium version for each command. Different versions are not
compatible.
• Be consistent with ‘-64bit’. You cannot mix and match this parameter.
• If you are running Incisive, and not Xcelium, do not invoke the ‘ncXXX’ commands from
within the Modus environment. The Modus installation has several of these functions
for netlist import. You will create a version mismatch.
• Run zero-delay simulation first to verify that the ATPG pattern event order is correct.
Then, run SDF annotated timing simulation. Do not run unit delay.
Table: 1
There is an xmvlog compiler directive within the mainsim.v test bench. If you are using a
third-party Verilog simulator, set this to avoid referencing Cadence-only code.
MISCOMPAREDEBUG
“xmvlog -define MISCOMPAREDEBUG” turns on special debug code in the
mainsim.v test bench. “xmsim + MISCOMPAREDEBUGFILE <file name>”
executes the code that invokes the “$processSimulationDebugFile” script.
This system task is produced by Cadence and is available within the Modus installation. You
must set the library path to point to this custom script.
LD_LIBRARY_PATH=$Install_Dir/../plilib:$LD_LIBRARY_PATH
This is an enhanced process for debugging simulation miscompares and is beyond the
scope of this application note. For more information, refer to the “Modus Simulation
Miscompare Debugging Tools” documentation.
Zero-Delay Simulation
This section provides a background on zero-delay simulation.
By default, the timing within your library models comes from the “specify” block. The delay
timing within a specify block is usually set to 1 (essentially, this is unit-delay simulation), but
it can be any number. Thus, if you are not running with SDF timing do NOT have the simulator
use this specify block information (-nospecify). If you are not doing timing simulation, use
zero delay:
-delay_mode zero
There is a potential problem with zero-delay simulation. Many state device modules are
modeled with UDPs. By default, the Cadence simulator solves a UDP by using what is called
a “non-blocking” assignment. This means that in zero-delay mode, the output is updated
immediately without advancing time. This can cause an event order problem where a UDP
output is updated and then used in the same time frame. When this happens, you will get
simulation errors that look like two clock pulses were issued. What you will see is that on a
single clock edge, the data input to one FF will get transferred to its output, propagate to the
next FF, and get captured there too! You avoid this problem with -seq_udp_delay.
Note: The amount of delay you assign via “seq_udp_delay” should be greater than or equal
to 50% of the precision field of the Verilog timescale. For example, if you have “`timescale
1ns/100ps”, you should enter 50ps to 100ps on the “seq_udp_delay” parameter.
For behavior level FF and latch models, “Q = Data_In;” is a blocking assignment and “Q
<= Data_In; “ is a non-blocking assignment. Having a blocking assignment is good. If you
are interested in learning more about Verilog blocking and non-blocking assignments, refer to:
http://www.sutherland-hdl.com/papers/1996-CUG-presentation_nonblocking_assigns.pdf
BC SDF is generated based on the lowest temperature and highest voltage corner in the
library. For example, a BC SDF can contain timing data at -40C and 2.3V. Running
simulations with BC will ensure that the design will meet hold time. It is critical that the shift
path of the scan chain meets the hold requirement.
WC SDF ensures that even under the worst-case condition, the device will still meet its timing
requirements. This data is generally generated at high temperature and lowest voltage.
The following table illustrates the terminology used during physical design flow.
Table: 2
NOTE THAT NOT ALL THREE TIMING VALUES MAY BE IN YOUR SDF.
If a timing value is missing, you cannot request the simulator to use those values. An
example of only WC timing values is as follows:
• Ensure that all the cells in the library have a “specify…endspecify” block. The
specify block is required by the simulator to annotate the timing information from the
SDF. In addition, the timing arcs and conditions specified in the SDF must exist within
the specify block. Two examples are given below:
• If the SDF contains a timing arc from SEL input to Y output of a MUX cell, that
definition must exist within the specify block of your Verilog library model.
• If the SDF timing says that data ‘in’ goes to Q output on posedge of a clock,
that posedge condition must be defined in the specify block.
• Check for “ifdef” statements in your technology library models that may
restrict/control access to code within the specify block. The example below contains
“`ifdef NTC”.
• This requires the user to enter “xrun -define NTC” (xmvlog -define
NTC) in order to invoke/access the Negative Timing Checks within the specify
block.
• Check the timescale entries within your Verilog, especially the library models. Make
sure that the precision portion on each timescale entry is small enough to
accommodate the timing that you will get from the SDF. For example, if your
timescale entry is 1ns/100ps, all timings in your SDF that are smaller than 100ps
will be simulated at 100ps. A 9ps delay becomes a 100ps delay!
specify
(posedge CP => (Q +: D))=(0, 0);
$width(posedge CP, 0, 0, notifier);
$width(negedge CP, 0, 0, notifier);
`ifdef NTC // Reserve for NTC.
$setuphold(posedge CP &&& xSE, posedge SI, 0, 0, notifier, , ,CP_d, SI_d);
$setuphold(posedge CP &&& xSD, negedge D, 0, 0, notifier, , ,CP_d, D_d);
$setuphold(posedge CP, negedge SE, 0, 0, notifier, , ,CP_d, SE_d);
$setuphold(posedge CP &&& xSE, negedge SI, 0, 0, notifier, , ,CP_d, SI_d);
$setuphold(posedge CP &&& xSD, posedge D, 0, 0, notifier, , ,CP_d, D_d);
$setuphold(posedge CP, posedge SE, 0, 0, notifier, , ,CP_d, SE_d);
`else // Reserve for non NTC.
$setuphold(posedge CP &&& xSE, posedge SI, 0, 0, notifier);
$setuphold(posedge CP &&& xSD, negedge D, 0, 0, notifier);
$setuphold(posedge CP, negedge SE, 0, 0, notifier);
$setuphold(posedge CP &&& xSE, negedge SI, 0, 0, notifier);
$setuphold(posedge CP &&& xSD, posedge D, 0, 0, notifier);
$setuphold(posedge CP, posedge SE, 0, 0, notifier);
`endif
endspecify
endmodule
IMPORTANT NOTE ON NEGATIVE TIMING CHECKS: The SDF can contain negative
values to represent hold times of the sequential elements. In Figure 3 above, the
default behavior of this library model is to convert these negative hold values to 0. This
becomes more pessimistic checking and can cause the simulations to fail. The use of
“xrun -noneg_tchk” will only print the information about the timing checks. You
should enable Negative Timing Checks (as shown in this example), whenever possible.
For this example, enter the following compiler directive to access Negative Timing
Checks.
• Ensure that the timescale used for the netlists, test benches, and libraries match the
value used in the SDF. Within the Verilog models, you will see a timescale directive.
The first term (1ns) refers to the time unit, and the second term (1ps) is the precision.
`timescale 1ns/1ps
In Figure 4 above, the delay through the buffer on rising “I” input is 87.1ps. Because
of the timescale precision of 1ps, the simulator will round this delay to 87ps. On a
falling “I”, the delay will be rounded up to 59ps.
The expected SDF file name in the above example is “default.sdf”. There is no path as part
of the name. You may have to edit the test bench to provide the correct path and SDF file name.
To execute worst-case SDF annotation using the example above, you would run the following
(See Figure 6):
o Note that the SDF annotation information will be placed into "sdf_Max.log".
xrun \
+simvision \
-timescale 1ns/1ps -override_timescale \
VER.COMPRESSION_DECOMP_OPCG.mainsim.v \
…/../../dtmf_chip.test_netlist.v \
-v ../../../LIBS/verilog/include_libraries_sim.v -incdir ../../../ \
+HEARBEAT +FAILSET \
+TESTFILE1=VER.COMPRESSION_DECOMP_OPCG.data.scan.ex1.ts1.verilog \
+TESTFILE2=VER.COMPRESSION_DECOMP_OPCG.data.logic.ex1.ts2.verilog \
-define sdf_annotate -define SDF_Maximum
Again, note that the example in this application note is from the Modus Advanced ATPG RAK.
It is using the DELAY_SDF_TIMED lab within the RAK:
− DELAY_SDF_TIMED/testresults/verilog/COMPRESSION_DECOMP_OPCG_PARALLEL
Execute SDF Timing without Using the Modus Test Bench sdf_annotate
Via this method, you do NOT have to edit the test bench or the device netlist to invoke SDF
timing. The process is as follows:
1. Compile the SDF file. The output SDF file will have a “.X” postfix on the name.
xmsdfc –compile –output <compiled sdf file> <input sdf>
2. Create an SDF command file. This file has an entry for each field on the
$sdf_annotate system task. You only need the first two entries below.
As with the $sdf_annotate task, the SCOPE entry points to the instance within the
hierarchy that matches the module for which the SDF file was created. This is usually
just the DUT instance name within the test bench but can actually be any block within
the hierarchy.
COMPILED_SDF_FILE="default.sdf.x",
SCOPE=DELAY_SDF_TIMED_COMPRESSION_DECOMP_OPCG.dtmf_chip_inst,
LOG_FILE="My_sdf_annotate.log";
// Using the Advanced ATPG RAK example, this is the following command
xrun \
-timescale 1ns/1ps -override_timescale \
VER.COMPRESSION_DECOMP_OPCG.mainsim.v \
../../../dtmf_chip.test_netlist.v \
-v ../../../LIBS/verilog/include_libraries_sim.v \
-incdir ../../../ \
+HEARBEAT +FAILSET \
+TESTFILE1=VER.COMPRESSION_DECOMP_OPCG.data.scan.ex1.ts1.verilog \
+TESTFILE2=VER.COMPRESSION_DECOMP_OPCG.data.logic.ex1.ts2.verilog \
-sdf_cmd_file SDF_COMMAND_FILE -maxdelays
2. Following are some other useful Xcelium options. These options are given in terms
of “xrun”.
a. –access +rw - Enable access to internal signals for waveform dump. If this is not
included, internal signals are optimized out to improve simulation performance.
The equivalent to this is xmelab -access +r.
b. -compile - Only compile the provided Verilog files and libraries. Do not elaborate
or simulate. This is a good step to try on your initial script.
• ncverilog +xmelabargs+gateloopwarn
f. -64bit – Run the 64-bit version of NC-Verilog. IMPORTANT: Once you invoke
64bit, you must continue to use this parameter on all subsequence NC commands.
l. –seq_udp_delay 10ps - Use this for zero-delay simulation. This will tell NC to
insert a minimal delay onto the output of UPDs. This will help you avoid zero-time
(delta time) simulation event order problems. Use a DELAY VALUE that is
GREATER than ½ of the timescale accuracy.
xmls -snap = Ask xmls to list all simulation snapshots that you have created.
If you are not sure which version of a module you are using for simulation, list the source file
for all compiled modules or for a specific module. You can use this information to compare the
model versions imported into Modus.
xmls -source <module name> = Report the source Verilog for a specific module.
If you are getting error or warning messages that are confusing, “xmhelp” may be able to
provide more information. For example, if you want to learn more about an xmelab message,
you can use the following command:
Two examples:
• TVE-205 and TVE-206 provide the number of comparisons and the number of
miscompares for EACH input vector test file.
• TVE-203 and TVE-204 provide the total number of comparisons and miscompares
for the entire set of test files.
• TVE-202 messages are from the +HEARTBEAT keyword. For long simulation runs,
having regular heartbeat messages can assure you that your job is still active.
• TVE-650 and TVE-660 are miscompare messages. Bad news! You will need to
debug. Debug the first miscompare message.
Following are the simulation results for the DELAY_SDF_TIMED lab within the Advanced ATPG
RAK. An error was manually created in the dtmf_chip netlist. The write_vector output and
the simulation working directory is:
− DELAY_SDF_TIMED/testresults/verilog/COMPRESSION_DECOMP_OPCG_PARALLEL
INFO (TVE-206): The number of good comparing vectors for the file just completed is
21190
INFO (TVE-205): The number of miscomparing vectors for the file just completed is 0
INFO (TVE-206): The number of good comparing vectors for the file just completed is
3127638
INFO (TVE-205): The number of miscomparing vectors for the file just completed is 6
Xcelium Profiling
For large designs, there may be times when you want to profile your Xcelium simulation to
debug infinite loops or see how much memory is being consumed. Below is a brief list of
Xcelium commands that dump various pieces of information and improve performance.
If you are seeing infinite loops (stuck in delta simulation time), try putting a delay on the “@”
wait Verilog entries.
xmvlog –delay_trigger
If you are running Linux, enable multi-core code generation. Set the max number of core to
use.
xmsim -mcdump
For more information on the available performance and profiling features, see “Frequently
Asked Questions on performance and usage of Xcelium / Incisive profiler” within the
Cadence Support website https://support.cadence.com.
Summary
Throughout this application note, you have used the DELAY_SDF_TIMED lab within the Modus
Advanced ATPG RAK. This RAK was released for Modus version 18.10, but you ran Modus
19.11.
You are invited to download the RAK and use it to learn about Modus ATPG and how to
simulate the test patterns. Search for the following within the Cadence Support pages:
Modus DFT Software Solution – Advanced ATPG Rapid Adoption Kit (RAK) Overview
This RAK is designed as a quick reference to advanced ATPG techniques. The goal is to
provide visibility at advanced ATPG techniques, and provide quick examples and flows for each
topic.
Support
Cadence Support Portal provides access to support resources, including an extensive
knowledge base, access to software updates for Cadence products, and the ability to interact
with Cadence Customer Support. Visit https://support.cadence.com.
Feedback
Email comments, questions, and suggestions to [email protected].