You are on page 1of 6

Incremental Compilation in the VCS Environment

V. Kripa Sundar, Ashish V. Naik, Debashis Roy Chowdhury


Synopsys, Inc.

Abstract styles in making its re-compilation decision for each


Verilog module or user-defined primitive (UDP).
Viewlogic's1 Chronologic VCS TM is an industry
standard simulator for Verilog HDL. This paper describes VCS also takes incremental compilation beyond its
Incremental Compilation in VCS. Incremental compilation traditional role in code-management tools such as
is a general compiler optimization technique that improves Makefiles and dependency checks. These tools simply
turnaround time of the typical develop-test-debug-edit check for file modification times maintained by the
cycle of software development. It provides the user with underlying operating system. In contrast, VCS's
the ability to make small changes to a design, while Incremental Compilation ignores “insignificant” changes
guaranteeing that the re-compilation time will be to modules, and performs automatic inter-module
proportional to the change in the design. dependency analysis. The addition, deletion, or editing of
comments, white space, etc., when this does not affect the
The compiled code simulation environment in Verilog
tokenization of the source code, is a prime example of an
poses unique challenges and opportunities for incremental
insignificant change. The inter-module dependencies
compilation. The paper describes the issues in
introduced in the design by module instantiations,
determining whether a design unit is unchanged since the
hierarchical references, and parameter change
previous compilation, or whether it needs to be
specifications (‘defparam’) are automatically captured
re-compiled. It also addresses the specifics of incremental
by VCS. This dependency analysis is completely
compilation in single-user and multiple-user
transparent to the user. It thus obviates the need for
environments. Finally, results are presented that
creating or editing any explicit dependency specification.
demonstrate the benefits of incremental compilation in
VCS. 1.2. Why is incremental compilation needed?
Incremental compilation allows the user to take
advantage of the considerable simulation time speedup
1. Introduction offered by a compiled code simulator, without sacrificing
1.1. What is incremental compilation? fast compilation turnaround times in a typical design
VCS from Viewlogic Systems, Inc. is the industry development/testing environment. By minimizing
leader in Verilog simulation. The compiled code run-to-run re-compilation time, incremental compilation
simulation approach in VCS allows extremely fast provides the user with the ability to make small changes to
simulation. For a real life design, however, the compilation a design, while guaranteeing that the re-compilation time
time itself can be significant. When a user makes an will be proportional to the change in the design.
incremental change to an existing design, the compilation VCS's Shared Incremental Compilation further
time can be improved appreciably through the use of allows the user to “freeze” portions of the design, and treat
incremental compilation techniques. This paper presents these as pre-compiled modules that will not need
an overview of incremental compilation in the VCS re-compilation from run to run. For example, in a typical
environment, and provides insight into how to reap system design environment a team of designers may work
maximum benefit from this feature. on a shared set of ASIC’s. Each such ASIC can be
Incremental compilation is a technique used to pre-compiled into a library directory. More than one
determine which portions of a design, if any, need to be designer can share these pre-compiled ASIC’s, which
re-compiled since the previous compilation run. VCS facilitates re-use of compiled code. Shared incremental
generates C code, assembly code, or direct object code, compilation also results in significant space savings for the
depending on the platform and user options. The whole team, because it avoids replication of generated
incremental compilation code supports all three generation code.
Figure 1 illustrates a typical design environment for
Shared Incremental Compilation.
1. Viewlogic Systems, Inc. has merged with
Synopsys, Inc.
Incremental Compilation in the VCS Environment

Test Bench 1.1


Design 1 ASIC 1

Test Bench 1.2 ASIC 2

Test Bench 2.1 ASIC 3


Design 2
Test Bench 2.2 ASIC 4

TB1.1.v Design1.v ASIC1.v

module TB1_1; module D1; module asic1


... ... (in1,in2,out);
$monitor(D1.a1.x, // Children. ...
D1.a3.y); asic1 a1(p,q,r); // Declarations.
// Apply stimulus. asic3 #(5) a3(...); wire x;
... ... ...
endmodule // TB1_1 endmodule // D1 endmodule // asic1

Figure 1. Use Model of Shared Incremental Compilation.

2. Incremental compilation use models re-compilation is based on the contents of this single
2.1. Single-user environment directory.

VCS's Incremental Compilation is invoked by the


2.2. Multi-user environment
-M option, and is designed to be used both in single-user In a multi-user environment, different users will
and multi-user environments. The user’s working share libraries of pre-generated code. These libraries
directory is called ‘csrc’ by default. This default can function as shared repositories, where pre-compiled
be over-ridden through the -Mdir command-line models have been frozen for common use by a team of
option. designers. The pre-generated code is distributed across
In a single-user environment, the user will typically several independent directories. Each designer has
be working in a develop-test-debug-edit cycle. The access to their own csrc and to the shared libraries.
entire generated code is at one location, in the user's The compilation history in a multi-user environment is
csrc. The “history” of successive compilations is kept the sum total of compilation runs for each of the
track of in the csrc by incremental compilation. It libraries as well as for the current csrc. It consequently
compares the history against the current design to make requires more sophisticated analysis to determine the
its re-compilation decisions. modules which need re-compilation.
The code generated by VCS as well as the Let us consider a typical design environment for
incremental-specific data written out by incremental shared incremental compilation, as illustrated in
compilation are placed in csrc. All analysis for Figure 1. Here, a set of four ASIC's have been
Incremental Compilation in the VCS Environment

developed for use by a team of designers. The ASIC's modules in a design are detected and catalogued by
are used in two designs. Each design is tested VCS.
independently by a suite of test benches. The Figure 2 gives an overview of the VCS
pre-compiled code for the library modules gets architecture, with focus on incremental compilation.
generated into the respective libraries through the VCS first performs a preliminary compilation on the
following command sequence: Verilog source. Based on this, a Global Analysis (GA)
$ vcs -Mdir=lib1 Asic1.v of the design is conducted to resolve inter-module
$ vcs -Mdir=lib2 Asic2.v dependencies, and to perform global optimizations. At
$ vcs -Mdir=lib3 Asic3.v the end of GA, the Incremental Compilation phase
analyzes incremental-specific data from the previous
$ vcs -Mdir=lib4 Asic4.v
run. First, relevant token changes in the Verilog source
The libraries can then be shared through are detected. Next, inter-module dependencies
commands such as: (determined through GA) are used to propagate the
$ vcs -Mlib=lib1:lib2:lib3:lib4 \ effect of the changes to other modules in the design
Asic1.v Asic3.v Design1.v TB1.1.v hierarchy. This results in exact determination of the
$ vcs -Mlib=lib1:lib2:lib3:lib4 \ modules for which code needs to be re-generated in the
Asic1.v Asic3.v Design1.v TB1.2.v current run.
The -Mlib option tells VCS to look in the The three code generation styles (C code, assembly
colon-separated list of libraries for pre-compiled code. code, and object code) are taken into account in making
In the first -Mlib command above, the code for the two re-compilation decisions. Incremental compilation then
ASIC’s get picked up from lib1 and lib3 issues directives to the code generator, to generate code
respectively. The other two libraries, though specified, for the appropriate modules. No new code is generated
remain unused. The code for Design1.v and for modules that do not need re-compilation.
TB1.1.v get compiled into csrc, since they are not Incremental compilation also writes out new
available in any of the libraries. incremental data, for use in subsequent runs.
In the second -Mlib command, the code for Section 3.2 discusses the exact nature of
Design1.v is picked up from the current csrc, inter-module dependencies in Verilog HDL. The global
where it was generated during the previous run. The dependencies which simultaneously affect multiple
ASIC's are picked up from their appropriate libraries, as modules are described in Section 3.3.
before. The test bench TB1.2.v needs to be compiled,
because it was not compiled before. But none of the
other modules in the overall design need to be
re-compiled (except as necessitated by certain
inter-module dependencies -- see Section 3.2).

3. Approach
3.1. Architecture
As defined by the Verilog HDL, VCS treats each
Verilog module or UDP as an independent design unit,
with well-defined communication to other design units
through ports. The exception to this communication
scheme is when the design contains hierarchical
references from one module to another, which needs
special treatment. These inter-dependencies between the
Incremental Compilation in the VCS Environment

Verilog Design Old Incremental Data


(from csrc and libraries)

Compilation

Global Analysis

Incremental
Compilation

Directives to
Code Generator

Code Generation

Generated Code (in csrc) New Incremental Data


and Executable (simv) (in csrc)

Figure 2. The Architecture of Incremental Compilation in VCS.

3.2. Inter-module dependencies named Verilog object can be referenced uniquely in


its full form by concatenating the names of the mod-
When a module is modified, it naturally gets
ules, tasks, functions, or blocks that contain it.”
re-compiled. Certain changes to modules can also cause
[LRM; p. 147]. Hierarchical references allows any
other modules in the design to be re-compiled. The
module in the design to refer to objects in other mod-
following three types of inter-module interactions can
ules without having any explicit port connection for
cause this:
them. Such objects include signals, parameters, tasks,
1. Parent-child port relationships: A change in the port functions, etc. Because of their global reach, adding
specification can cause re-compilation of both the or modifying hierarchical references can impact the
parent and child modules. Such a change can be due re-compilation decisions of modules that are seem-
to addition/deletion of port definition or port connec- ingly unrelated to the modified module. For example,
tion, change in the type of the port (input/output/ a new hierarchical reference in a module will cause
inout), certain changes in the drivers/loads connected both the referer and referee modules to be re-com-
to the ports, etc. piled.
2. Hierarchical references: The IEEE Standard 3. Module inlining: In certain situations, VCS performs
describes hierarchical references as follows: “Any an optimization that inlines child instantiations into
Incremental Compilation in the VCS Environment

the parent's body. This introduces a special type of and to re-use the generated code for shared portions of
inter-module interaction that affects incremental the design.
compilation. This optimization is transparent to the
user. But since such inlining alters the design hierar- 5. Future scope
chy for code generation, re-compilation decisions for Incremental compilation is an area of continuous
an inlined child module affect those of the improvement in VCS. Enhancements are made to
non-inlined ancestor module. handle evolving user requirements, and to support new
3.3. Global dependencies capabilities in VCS. We also identify design
methodologies that are able to take full advantage of
Several global dependencies also come into play VCS's architecture.
in influencing the re-compilation decisions of
For instance, if disk space is not a scarce resource,
incremental compilation.
it is possible to keep architecture-specific copies of
1. Command-line options: Changes in command-line generated code around, and move back and forth
options can result in changes to generated code. For between architectures without the need to re-compile
instance, global flags such as ‘+nospecify’ will the design from scratch. As another example, in the
affect a whole suite of modules sharing the relevant -Mlib context, when an ASIC is used within multiple
property (the occurrence of ‘specify’ blocks, in test benches, the latter may make hierarchical references
this case). into portions of the ASIC. These references serve to
2. Compiler directives: Altering a compiler directive either probe signals or to modify their values during
can affect the code generated for several modules. For simulation. In this situation, one can introduce the
instance, changing the timescale/precision for the notion of an ASIC Shell, which will in effect provide a
design will affect all modules within the scope of that one-module interface to all the test benches, for all of
change. Incremental compilation has to handle such their hierarchical references. The Shell “insulates” the
changes. rest of the ASIC from the chain reaction in
3. Platform dependence: VCS supports Verilog simula- re-compilation that is inherent to changes in hierarchical
tion on many platforms (such SunOS, Solaris, HP, references. Sometimes, existing designs can be modified
NT, etc.). Moving between platforms will naturally to replace hierarchical references with port references,
result in re-compilation of the entire design. to provide similar benefits.

4. PLI/ACC/Debug specifications: VCS allows the PLI/


ACC capabilities of individual modules to be speci-
fied through a ‘.tab’ file. If these capabilities are
altered from run to run, this will necessitate re-com-
pilation of the concerned modules.

4. Performance results
The performance figures in Table 1 were obtained
from running an internal benchmark design.They
illustrate the speed-ups and space savings that can be
derived through the use of incremental compilation.
The design consists of 563 modules. It has 372337
lines of Verilog source (8.2 megabytes). The first VCS
run was a full compilation, which took 12 minutes and
19 seconds to compile. Subsequent runs involved
changes to a portion of the design. The table
demonstrates the significant savings in re-compilation
time through incremental compilation.
The use of Shared Incremental Compilation
augments these savings, by its ability to share modules
Incremental Compilation in the VCS Environment

Table 1: Performance Figures

Number of modules in design: 563


(372K lines of Verilog; 8.2 MB)

VCS Run Modules Modules Compilation time Fraction of full


Number changed affected (MM:SS) compilation (%)

1 (563) (563) 12:19 100%

2 0 0 01:04 08.66%

3 5 7 02:12 17.86%

4 11 17 02:26 21.11%

5 177 295 10:29 85.12%

6. Summary References
VCS's approach to Incremental Compilation offers [LRM] “IEEE Standard Hardware Description Language
the user the advantages of minimal compilation time Based on the Verilog(R) Hardware Description Language”,
during design development while providing fast IEEE Standard 1364-1995.
simulation performance. VCS's Incremental [VCS] “VCS/VCSi & XVCS/XPOST, Version 4.0”, July,
Compilation has been fine-tuned to provide optimal 1997. Copyright, Viewlogic Systems, Inc.
performance for designs specified in Verilog HDL. Our
results quantify the impact of incremental compilation
in typical development scenarios, and demonstrate the
superiority of this approach in Verilog compiled code
simulation.

Acknowledgments
Several members of Viewlogic's engineering and
customer support teams have been instrumental in
testing and improving this capability, during its
development. We are grateful to one and all of them. We
would especially like to thank Eric Zhao, Raghu
Srigiriraju, and Riyaz Puthiyapurayil for their help with
the Incremental Compilation design and development.
Our special thanks go to Phil McGee for his help in
preparing the final draft of this paper.

You might also like