Fast Recompilation Application Note 1.0
Fast Recompilation Application Note 1.0
Fast Recompilation Application Note 1.0
© 2018 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
Terms .......................................................................................................................... 4
Overview...................................................................................................................... 5
Workdir ..................................................................................................................... 6
Pakfile ...................................................................................................................... 6
Library ...................................................................................................................... 6
Worklib ..................................................................................................................... 6
Requirements for using the Fast Recompilation Flow.................................................. 7
XRUN Default Recompilation Flow .............................................................................. 8
Issues....................................................................................................................... 9
Example1 : Issues in Default Recompilation Flow.................................................... 9
XRUN Fast Recompilation Flow ................................................................................ 10
Example 2: Fast Recompilation Flow ..................................................................... 10
Example 3: Single Command Fast Recompilation with Makelib ............................ 11
Example 4: MSIE with Fast Recompilation ............................................................ 12
Check only XRUN commands ................................................................................... 13
Example 5: ............................................................................................................. 13
Support ...................................................................................................................... 14
Feedback ................................................................................................................... 14
Appendix:...................................................................................................................... i
Source Files for Examples 1 and 2 ........................................................................... i
Source Files for Example 3 ....................................................................................... ii
Source Files for Example 4 ....................................................................................... ii
Purpose
This Application Note describes the XRUN fast recompilation flow, and shows how to
effectively use the flow with a few representative examples. It also lists the Xcelium
tools that are not currently supported in the flow. Throughout this document, the term
recompilation is used to refer to the recompilation of source files, the re-elaboration of
the snapshot, or both as applicable.
Audience
This document is intended for design and verification (D&V) engineers who intend to
avoid unnecessary recompilation and who want to minimize the dependency check time
during a rerun of the XRUN command.
Terms
VST1 Verilog Syntax Tree
1 In the rest of this document we’ll use the term VST to refer to both VST and AST
Learn more at Cadence Support Portal - https://support.cadence.com
© 2018 Cadence Design Systems, Inc. All rights reserved worldwide. Page 4
XRUN Fast Recompilation Flow
Overview
Figure 1 shows an example XRUN design and verification flow.
Workdir
The path to XRUN’s work directory (workdir) is as follows:
<xmlibdirpath>/<xmlibdirname>/<rundir>
<pwd>/xcelium.d/run.d
XRUN keeps many generated files under the workdir. These files are meant for XRUN
internal use only, such as dependency checks and core argument files required for
invoking other Xcelium tools.
Pakfile
Xcelium tools save compiled and elaborated data into a file with the .pak extension
under the work library.
Library
A library can be specified with a logical name and has an associated physical path. If
unspecified, XRUN infers the physical path of the library from its logical name as
<xmlibdirpath>/<xmlibdirname>/<logical_name>.
There are multiple ways to explicitly specify the mapping between the logical name and
physical path of a library, for instance:
• -reflib <libpath[:logical]>
• An entry in cds.lib
In general, a library contains the pakfile (compiled VSTs) that can be used in
elaborating a design snapshot (typically used and shared by multiple designs).
Worklib
The worklib is the default output library. The default worklib name is worklib. There
are multiple ways to explicitly specify the worklib, for instance:
• -work <worklib_name>
While xrun can print out the accumulated command history for a workdir, it can only
compare the current xrun command with the previous xrun command for a single
workdir. In contrast, worklibs are cumulative.
Separating the workdir ensures that the dependency files don’t get
overwritten.
-xmlibdirname <dir>
-xmlibdirpath <path>
➢ Compile your library with the xrun command2 rather than bare xmvlog/xmvlog
commands for better re-elaboration decisions (for XRUN commands that refer to the
library).
2 XRUN creates a proxy timestamp file for pakfile (pakfile file’s timestamp might change when it is
referred whereas proxy file’s timestamp doesn’t change when it is referred).
Learn more at Cadence Support Portal - https://support.cadence.com
© 2018 Cadence Design Systems, Inc. All rights reserved worldwide. Page 7
XRUN Fast Recompilation Flow
xrun foo.v
➢ Divide:
If the source file of a library (that is being used in building the snapshot)
changes but the library has not been rebuilt, decide carefully if you really want
to rebuild the library and re-elaborate the snapshot.
➢ Fast recompilation is not supported with –jg, -jc, -hw or –mce options.
XRUN uses the following mechanism for dependency checks and recompilation3
decisions:
1. For each Xcelium tool that XRUN invokes it keeps a list of hard arguments in an
internal file under the workdir. Upon rerun, if XRUN finds that any arguments
differ from the contents of this file, then the corresponding Xcelium tool is re-
invoked.
2. The pakfile header contains a list of source files (direct & included) and their
timestamps. Source files of the referenced library design units get inherited. Note
that source files include HDL source as well as other files consumed during the
process (such as, xprop input files and so on).
Upon rerun, XRUN compares the saved timestamps of the source files with their
current disk timestamp. If any source file is found to be out of date, then XRUN
recompiles and re-elaborates everything.
3The term “recompilation” here is used to refer to recompilation of source files or re-elaboration of
snapshot or both as applicable.
Learn more at Cadence Support Portal - https://support.cadence.com
© 2018 Cadence Design Systems, Inc. All rights reserved worldwide. Page 8
XRUN Fast Recompilation Flow
Issues
The default dependency check process has the following issues:
2. A source file may have been compiled by a separate xrun command, causing an
unnecessary recompilation that does not even touch any change files.
3. Running successive xrun commands with different source files in the same
workdir overwrites the hard arguments dependency check files.
1. First run:
touch a1.v
3. Rerun:
The rerun command recompiles des.v and tb.v, and re-elaborate the snapshot since
libA source file a1.v was modified, even though nothing was changed for the
command being rerun. The default dependency check does a full and slow dependency
check.
XRUN fast recompilation flow works as follows to overcome the issues in the default
recompilation flow:
Upon rerun XRUN (instead of the list of sources in pakfile header) compares the
saved timestamps of the source files in dependency check files (instead of the
list of sources in pakfile header) with their current disk timestamp. If any source
file is found out of date, then XRUN re-compiles and re-elaborates.
Unlike default recompilation flow, XRUN does not check the source files of the
libraries that were referenced.
2. XRUN creates a dependency check file that contains a list of pakfiles5 and
source files (files that elaboration directly depends upon, not compile sources)
referenced during elaboration along with their timestamps.
5 Instead of using the actual pakfile timestamp a proxy file (pakvst.ts) timestamp is used that changes
only when pakfile VSTs change. Note that pakfile contents (other than VSTs) might change when it is
referred.
Learn more at Cadence Support Portal - https://support.cadence.com
© 2018 Cadence Design Systems, Inc. All rights reserved worldwide. Page 10
XRUN Fast Recompilation Flow
1. First run:
...
touch dut.v
3. Rerun:
cp inc1.sv inc.sv
...
2. Change inc.sv:
cp inc2.sv inc.sv
3. Rerun:
Note that fast recompilation compiles only the changed file incr.sv which is a huge
saving over the default recompilation.
xrun -check_snap_dep
By default, this checks the snapshot defined by the SNAPSHOT variable in:
<xmlibdirpath>/<xmlibdirname>/hdl.var
xrun -check_vst_dep
<xmlibdirpath>/<xmlibdirname>/cds.lib
Example 5:
Run the steps in Example1 and then run the following checks:
xrun -check_snap_dep
xrun -check_vst_dep
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 content_feedback@cadence.com.
Appendix:
initial $display("libA:a1");
endmodule
a2.v
module a2();
initial $display("libA:a2");
endmodule
b1.v
module b1();
initial $display("libB:b1");
endmodule
b2.v
module b2();
initial $display("libB:b2");
endmodule
des.v
module des();
a1 a1_inst();
b1 b1_inst();
endmodule
tb.v
Learn more at Cadence Support Portal - https://support.cadence.com
© 2018 Cadence Design Systems, Inc. All rights reserved worldwide. Page i
XRUN Fast Recompilation Flow
module tb();
des des_i();
endmodule // tb
initial $display("DUT");
endmodule
tb.v
module tb();
dut I1();
endmodule
reg a;
endpackage
b.sv
package bigpkg;
import lowpkg::*;
endpackage
u.sv
package uppkg;
import bigpkg::*;
endpackage
dut.sv
module dut();
endmodule
tb.sv
module tb();
import bigpkg::*;
dut dut();
endmodule
inc1.sv
package incr;
import lowpkg::*;
int om;
endpackage
inc2.sv
package incr;
import lowpkg::*;
int om2;
endpackage