Lab_Debugging_Simulation_Mismatches
Lab_Debugging_Simulation_Mismatches
Lab
Debugging Simulation Mismatches
This document contains information that is trade secret and proprietary to Mentor Graphics Corporation or its licensors
and is subject to license terms. No part of this document may be photocopied, reproduced, translated, distributed,
disclosed or provided to third parties without the prior written consent of Mentor Graphics.
This document is for information and instruction purposes. Mentor Graphics reserves the right to make
changes in specifications and other information contained in this publication without prior notice, and the
reader should, in all cases, consult Mentor Graphics to determine whether any changes have been
made.
The terms and conditions governing the sale and licensing of Mentor Graphics products are set forth in
written agreements between Mentor Graphics and its customers. No representation or other affirmation
of fact contained in this publication shall be deemed to be a warranty or give rise to any liability of Mentor
Graphics whatsoever.
MENTOR GRAPHICS MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS MATERIAL
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE.
MENTOR GRAPHICS SHALL NOT BE LIABLE FOR ANY INCIDENTAL, INDIRECT, SPECIAL, OR
CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING BUT NOT LIMITED TO LOST PROFITS)
ARISING OUT OF OR RELATED TO THIS PUBLICATION OR THE INFORMATION CONTAINED IN IT,
EVEN IF MENTOR GRAPHICS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
U.S. GOVERNMENT LICENSE RIGHTS: The software and documentation were developed entirely at
private expense and are commercial computer software and commercial computer software
documentation within the meaning of the applicable acquisition regulations. Accordingly, pursuant to
FAR 48 CFR 12.212 and DFARS 48 CFR 227.7202, use, duplication and disclosure by or for the U.S.
Government or a U.S. Government subcontractor is subject solely to the terms and conditions set forth
in the license agreement provided with the software, except for provisions which are contrary to
applicable mandatory federal laws.
TRADEMARKS: The trademarks, logos and service marks ("Marks") used herein are the property of
Mentor Graphics Corporation or other parties. No one is permitted to use these Marks without the prior
written consent of Mentor Graphics or the owner of the Mark, as applicable. The use herein of a third-
party Mark is not an attempt to indicate Mentor Graphics as a source of a product, but is intended to
indicate a product from, or associated with, a particular third party. A current list of Mentor Graphics’
trademarks may be viewed at: www.mentor.com/trademarks.
End-User License Agreement: You can print a copy of the End-User License Agreement from:
www.mentor.com/eula.
If this is the first time you are launching this VM (Virtual Machine), you must
download and extract the lab data as described in the "Obtaining Lab Data
Caution
section below.
Whenever you are using the VM for lab exercises and are finished with your
session, please use the "Disconnect" feature of the Desktop Viewer before the
VM times out to preserve the data from one session to the next. Failure to do
so will remove the VM, and its contents.
If the VM was removed, you will be presented with a new VM requiring you
to follow the download and extract process. This allows you to "refresh" the
lab data so you can go through the labs again with a new database.
The environment uses bash and is ready to use for the labs with all needed
environment variables already setup.
If this is the first time you are starting a session for this VM, the atpg_data
directory will not be in the home directory and you will need to download and
extract it using the following instructions.
3. In the resultant window, select the Download button, enable the Save File
button, then select the OK button to download the file.
Move the file in the Downloads directory to the home directory. If you are using
the terminal (Applications>Favorites>Terminal) you can use the following
command:
mv ./Downloads/tessent_atpg_data_v2020.1_20200611.tgz .
4. In a terminal window, extract the files from the compressed tar file using the
command:
You should now have a directory named atpg_data in your $HOME directory.
That directory contains all the files you need to perform the exercises, in this
learning path.
Introduction
In this lab, you learn to use the automated simulation mismatch tools in Tessent
Shell. You will then manually debug a simulation mismatch.
Objectives
Upon completing this lab, you should be able to:
Setup Instructions
The following steps and dofiles will guide you through the process of creating
test patterns and verifying them through simulation from within Tessent Shell.
There are several dofiles, which you will execute, which contain the commands
necessary to create the patterns and the associated Verilog testbenches for
verification.
The next step is to perform an analysis to see if there were any simulation
mismatches. During this step, the tool uses the Tessent Shell command,
analyze_simulation_mismatches –auto, to run the simulation mismatch
analysis. Also, the top-level design and Verilog library were compiled in the
work directory when the script in step 4 was run. ModelSim is the default
simulator used to perform the analysis.
Question:
How many steps are automatically taken when the command
analyze_simulation_mismatches executed?
_____________
Are there any simulation mismatches? _____________
In this activity, you again save patterns and perform automatic analysis of
simulation mismatch. However, this time, the internal connections in the aoi22
library cell are changed to cause a simulation mismatch.
Notice it performs the standard setups, generates, and writes patterns. It also
sets up the workspace for ModelSim and compiles the parallel test bench for
validation simulations.
Question:
What is the one difference between this dofile and the one used for the
no mismatch run? ________________________________________
When you examined the dofile, you may have noticed the
report_mismatch_sources command. The first instance tells the tool to
list all of the mismatch sources. These are displayed both in the transcript
tab of the Tessent Visualizer and in the shell window where you are running
the tool. The second instance tells the tool to load ID #1 of the reported
mismatches into the flat schematic tab of Tessent Visualizer.
12.Using a text editor of your choice, compare the two DFT library models and
the Verilog model located in $ATPG_LABS/libs.
adk.atpg adk.atpg_e
Introduction
The purpose of the lab exercise is to allow you to experience how to debug a
clock skew issue in a design. You will notice, depending on the amount of clock
skew and the hold requirement of the affected device, that this could also result in
a hold time violation due to the clock skew. For this exercise, the clock skew
issue was introduced for the purpose of demonstrating how to debug clock skew
issues in a parallel testbench.
In order to allow you to focus on the debug flow and techniques for each lab
rather the Tessent and ModelSim statements, scripts have been provided with a
numerical prefix indicating the order in which they are to be run during the
exercise. These scripts will create patterns, write the patterns in ASCII format
and the Verilog test bench, save a flat model, and run the Verilog simulation test
bench. You will extract pertinent debug information for the mismatches from the
log files.
Once the mismatches have been identified from the log files, additional scripts
are provided to load the design and patterns back into Tessent Shell and
ModelSim so you can proceed with your debug effort.
You will first review the scripts and the directory structure. As you use the scripts,
and this structure, you should see how keeping data organized will help make the
start of your mismatch debug much easier.
How you choose to organize your data will depend on the internal processes used
at your home office.
$ cd $ATPG_LABS/Lab11/Exercise2
2. Using your favorite text editor, review each of the scripts taking note of the
commands which perform the functionality described in the summaries below.
o 0.start: This script deletes any previous work that was done in the lab
directory and then run scripts for pattern generation (1.pattern_generation)
and Verilog simulation (2.verilog_simulation)
You will now generate patterns using Tessent Shell and run pattern verification
using ModelSim. As you perform each step, you will also explore the directories
to find the source files, identify the files which are created, and the directories to
which they are written.
Pattern Generation
3. Execute the “clean” script to initialize the lab directory (e.g. delete files
generated by the scripts previously run, etc.).
$ clean
o design: This directory contains the EDT inserted netlist, as well as SDF files
that can be applied to the netlist.
o edt: This directory contains the Tessent generated EDT “dofile” and test
procedure file that are to be used by Tessent Shell.
o libs: Contains the ATPG and simulation libraries.
o logs: Will contain the logfiles generated during the pattern creation, pattern
verification simulation, and debug sessions.
o sim: Currently contains a script that will add debug waveforms to the
ModelSim wave window. It will contain the Verilog testbench, the ASCII
pattern file and ATPG flat model.
5. Execute the generate patterns script to generate the patterns for the design.
$ 1.pattern_generation
o sim/netlist.flat.gz: This is the flat model that was generated by Tessent Shell
command, set_system_mode analysis. While not required for
simulation mismatch debug, it allows the debug process to work much
faster since you do not have to setup the design and run DRCs.
You should always save a flat model at the same time you save patterns.
o sim/pat.ascii: These are the patterns that were generated and then saved in
the Tessent ASCII format. This file loads very quickly into Tessent Shell.
You can also choose to save a binary file, that contains the same information.
The binary version of the file is not human readable, and takes up much less
disk space. You would use the –binary argument in place of the –ascii.
Pattern Validation
6. Run the Verilog testbench that was created by Tessent Shell to determine if
there are any simulation mismatches.
$ 2.verilog_simulation
The following flow chart from the lecture outlines the process you will be
following for the remainder of this lab.
As with any debugging task, the best practice is to gather as much data about the
issue as possible, and record it in a logical manner. By taking the time gather and
record the information in one place, you will be able to determine many things
about the mismatch.
The usage model for the tables is to complete the ATPG Information and the
Verilog Information sections using log files from your tool sessions you just
completed.
What command should you look for in the logfile to see if there are any
internally defined clocks or pins? __________________________________
C6, D1, K and T24 DRC violations will often cause simulation mismatches. We
suggest that in your pattern generation scripts, you add the command
report_drc_rules after set_system_mode analysis so you have one place
to look to see what DRC violations were reported.
Special tool setting is asking if the script set any of the tool settings that would
modify how the ATPG simulations run by default.
We suggest for clarity that you specify switches for write_patterns instead of
depending on default values for the command. Since simulation mismatch debug
is something you may not do every day, it’s much easier to have everything
documented in the logfile. This saves you time looking in the manual for the
command defaults.
We also suggest that if you add any simulation parameters to the Verilog
testbench, that those be added the command line, and not in a parameter file. The
contents of the parameter file are not captured to the log file.
This lab was qualified using the Tessent 2020.1 and ModelSim
2020.2 releases.
Note
o Right before you see simulation results, the transcript will report the
name of the Verilog testbench. Make sure this name matches the name
that you extracted from the ATPG log.
o In general, if there is both a pin and cell showing as a mismatch location,
choose the cell.
o The time and cycle number reported is when the mismatch was observed.
As such, you will typically be looking in the prior pattern.
For the purpose of this lab, you will explore the mismatch on chain3 at
1490nS. These entries have been pre-populated in the table for you.
Note
The portion of the table you just completed should look something like this:
(Remember, the failing times, pattern number, cell pathname,... may be different
for your design).
Refering back to figure 11-3 of this exercise, you will note that you have
completed steps 1 and 2 and are now progressing into step 3.
9. Run the script 3.debug_atpg. This invokes Tessent Shell, sets the context to
patterns -scan and reads the ASCII pattern file.
$ 3.debug_atpg
11.Display the failing scan cell in Tessent Visualizer using the command
report_scan_cells <chain_name> <cell_id> -display
ANALYSIS> report_scan_cell chain3 9 –display \
Keep in mind that the failing chain name and cell number may be
different, as discussed previously.
Note
Look at the Tessent Visualizer transcript and answer the following questions:
If the clock names do not match verify you have the correct pattern number
and chainID / CellID. If you are confident about that information, you may
have set up a clock controller incorrectly. (Not the issue here).
Note
What is the instance name? ______________________________________
Does this match the name reported in the simulation logfile? ________
What are the scan chain connections for this scan chain? _____ and ____
12.In the Tessent Visualizer, show the ATPG pattern on the displayed scan cell by
selecting the Open Gate Report Settings dialog, , icon in the lower left of
the Tessent Visualizer window to open the Gate Report Settings dialog window,
select the Pattern Index, External and Scan test radio buttons, then enter the
pattern number, 10, as demonstrated in the following graphic.
Note
2. Run the script 4.debug_verilog to invoke the ModelSim wave reader, read in
the waveform database, and display a set of debug waveforms.
$ 4.debug_verilog &
Notice the added debug waveforms. These were added by the script,
sim/wave.do, that was called when the commands in the 4.debug_verilog script
invoked ModelSim.
3. You will now investigate the simulation results of the failing cell graphically
by adding the failing scan cell connections to the ModelSim wave window.
a. In the Tessent Visualizer, select the scan cell and open the pop up menu by
right clicking on select the scan cell, then copy the hierarchical instance
name by left-clicking on the last menu item (Copy name) to place the
name of the failing cell into the copy buffer.
Figure 11-10. Copy Instance Name
c. Double click on the resultant name (i.e. the grey string in Search results
pane) and the instance will be displayed and selected in the navigation
pane.
d. Drag and drop the instance into the Wave window to add the input/output
waveforms of the scan cell to the waveform window.
e. To complete the initial setup for debug, add a cursor to the waveform
window at the time that the mismatch was reported. Cursor management is
located under the list of displayed signals. You can also add them, zoom on
a cursor, between two cursors, etc. using the toolbar icons. Grey time
indicates delta t between the cursors.
g. Zoom in to the cursor location and verify that the cursor is also located
during the reported failing cycle. Remember, in our current example, we
have specified the first for which a mismatch is reported for chain3, which
occurred in cycle 37 (actual cycle number can be software release
dependent). Your screen should resemble that of Figure 11-14.
Remember, the failing time and cycle number are reported at the “compare
simulated to expected value” event. This compare happens during the Load
procedure for the pattern after the failing pattern, for example, 11 when we
Note are looking at 10.
You have just set up a debug environment which includes the following:
o Compressed patterns (TestKompress design)
o Parallel testbench
o Scan test
o Tessent Visualizer displaying the failing cell and the ATPG pattern
o ModelSim displaying the time the mismatch was recorded and the
connections to the failing cell.
Referencing Figure 11-3, we see the next step is to determine if the mismatch
occurred during parallel shift or Capture.
Looking at Figure 11-15, you’ll see some debug suggestions. Notice that this
specifies that, based on the data you entered, there is an issue with parallel shift
or capture, and the mismatch is occurring at the reported failing cell.
First, we need to ensure the parallel data loaded was shifted correctly. In order to
determine if the mismatch occurred during parallel shift, you will need to verify
that the shift values match between ATPG and ModelSim.
b. Zoom in, and move the cursor so it is just to the right of the parallel pattern
release, indicated by the event release_frc_chain1_sibus icon, .
5. Compare the ATPG first clock frame of the first capture cycle to the simulation
value right after the parallel load release event.
ATPG Simulation
D ___________ ___________
CLK ___________ ___________
QB ___________ ___________
You will find it easier to acquire the correct clock frame values in the
ModelSim Wave viewer by doing two things.
Hint 1) Reorder the waveforms using the “drag and drop” in the Wave panel
containing the part-pin numbers such that they are in the same order
as the tables.
2) Declutter the viewer by deleting the signals which are not of concern.
Here, SI, SE, R and Q are not needed.
We see from the table that the ATPG and simulation values for the first clock
frame for all three pins match. This tells us the mismatch did not occur due to a
problem in the parallel shift procedure.
Since the simulated and expected values for the parallel shift match, the source of
the mismatch must be during capture.
Just as a quick review, the three clock frames seen in the Tessent Visualizer are
the values after parallel load, after the leading edge of the capture clock, and after
the trailing edge of the capture clock.
Value after
Leading
Value after edge
Value after
parallel load trailing edge
D 0 1 1
6. Move your cursor until it is right before the clock pulse during
LAUNCH_CAPTURE.
ATPG Simulation
D ___________ ___________
CLK ___________ ___________
QB ___________ ___________
It appears there are two mismatches, one at the D input (100 vs 000), which would
be shift issue, and the QB output (100 vs 111). We have already confirmed that
the issue is a capture issue, not a shift issue.
This being the case, let’s examine the timing relationship of the D input and the
clocks, clk1 and the clk at the register input.
During the lecture, the causes of mismatches were discussed. It was stated that
the majority of mismatch issues are caused by timing issues with Timing
representing about 60% of the mismatch issues.
You might have noticed that in simulation in the second clock frame, the data (D)
changed but, QB did not change. This could be a clock skew issue.
a. Drag and drop /clk1 so it is either above the D pin of the failing cell as this
will make any clock skew issue more obvious.
c. Zoom in such that you can see any time differences between signal edges
transitioning at about the same time.
If there were no clock skew issues, D = 0 in the first clock frame would have
been captured, and QB would be equal to 1.
The skew between clocks is longer than it should be.
Now that a skew has been identified, let’s take a look at what is causing the skew
using the Tessent Visualizer to identify the instances involved and the ModelSim
Wave viewer to view the simulated delays. Both these windows should still be
open from earlier in the exercise. If not, issue the Tessent Shell command
report_scan_cell chain1 1 -display, then add the pattern index data for pattern 17
using the Data menu to open, and setup the visualizer. Execute the
4.verilog_debug script to relaunch ModelSim.
9. Trace back from the CLK pin to the /clk1 instance by clicking on the CLK pin
of reg_sum_0_ix9, then on one of the “diamonds” with a plus sign to reveal the
two inverters.
Zero
Delay
300pS
Delay
We can see, in this case, that there is no delay through the ix210 inverter and a
rather large delay through the ix216 inverter. To further investigate, we will need
to open the SDF file which was loaded for the design.
11. Open the SDF file, design/netlist.sdf in a text editor of your choice.
a. Search for top_design_i/block1/ix210, taking note that there is no entry.
As such, a zero delay is assigned to that instance.
b. Search for top_design_i/block1/ix216, taking note the entry has a 300 pS
delay assigned to it.
c. Peruse several other instances, taking note that the delays assigned to these
elements are only 100 pS.
If a proper SDF file was used for this design with the proper delays assigned to
the instances, you would follow the same process of tracing back looking for the
offending instance, or instances, to determine if the skew was introduced
structurally or some other mechanism.
Review
List the steps you would take to troubleshoot areas of low coverage
Setup Tessent shell and your design and libraries
DRC Issues
Shadow Cells
Library Problems
Timing Violations
These labs were qualified using Tessent 2020.1 and ModelSim 2020.2, if
other Tessent versions were used, results contained in tables in these labs
Note may differ slightly from those shown in this Lab Answers section.
Exercise 1
Step 5
How many steps are automatically taken when the command
analyze_simulation_mismatches executed?
No
Step 7
What is the one difference between this dofile and the one used for the no
mismatch run?
The ATPG library used. The library used for the mismatch is
adk.atpg_e, for “error” which we inserted for demonstration
purposes.
Step 9
What does report_mismatch_sources -all display? Look in the Console
window to find out.
Displays/reports all instance and their gate IDs with the mismatch
and the reason for the mismatch
Step 11
What is the difference between the two DFT library models?
Exercise 2 (Optional)
Lab11; Ex2
File Locations
ATPG Information
internal pins/clocks No
DRC (C6/D1/K/T24) No
Verilog Information
pin/cell Cell
pattern number 10
cell number 9
Simulated/Expected 1/0
Step 7
How can you tell if the patterns were generated for an EDT design, or
bypass / FastScan design?
Two ways:
1. From the command “set_edt_instances -edt..”
What command should you look for in the logfile to see if there are any
internally defined clocks or pins?
Step 9
What pattern buffer does read_patterns place the patterns into: Internal or
External?
Step 10
What type of pattern is this pattern?
[clk1][clk2]
Step 11
What is the name of the shift_clock?
clk1
Is this the same clock that was reported for the capture clock sequence?
Yes
What is the instance name of the scan cell?
/top_design_i/block1/reg_sum_0_ix9
Does this match the name reported in the simulation logfile?
Yes
What are the scan chain connections for this scan chain?
SI and QB
clk1
Is it the same clock reported as the capture_clock_sequence for this pattern?
Yes.
Step 7
ATPG Simulation
D 100 000
CLK 010 010
QB 100 111