Requirements for Separate Compilation In SystemVerilog

Last updated: May 12, 2003

 

Abstract: Verilog has had some issues exposed by implementations that support separate compilation for a number of years. The addition of $root to SystemVerilog has exacerbated the issue by providing the ability to declare globally visible objects outside of modules. This document explores the issues that supporting separate compilation raise in the language, even beyond those raised by $root, and offers pointers to a number of proposals that have been made to date as to how to address those issues.

 

History of $root

$root was added to SystemVerilog to simplify the declaration and use of global objects. The table below describes the features that can be instantiated in $root, when they were added to the language, and how the language approached that functionality prior to the introduction of $root if necessary.

Feature in $root

When added

Prior usage

Compiler directives (‘define, etc)

Verilog 1995

 

Tasks and functions

SystemVerilog

‘include in every using module or hierarchical reference to a global "library" module

Variables and wire declarations

SystemVerilog

Hierarchical reference to a global "root" module (often used for clocks)

Module instantiations

SystemVerilog

Creation of an explicit top-level module

Type declarations

SystemVerilog

No complex types existed. Parameterization of modules achieved the only supported type specialization

At this point, $root is unlikely to be removed from the language because of two factors. One is the requirement that complex types be able to appear on ports, (and, hence, be visible outside of a module scope). Another is that it has been ratified in the 3.0 standard, and, as such, will not be removed from the language.

That being said, there are still several issues that exist with $root today, especially in the context of separately compiled modules.

Issues in Supporting Separate Compilation

The desire for separate compilation comes from several different objectives. One is allowing design elements to be provided from a language external to Verilog. The DPI and VPI are attempts at addressing this issue. Another is to decrease compile time in a design by pre-compiling portions of a design that do not change frequently. Another comes from synthesis where individual designers are expected to provide a synthesized netlist for their portion of a design independent of the instantiating or instantiated designs associated with their piece.

To support separate compilation, the primary constraint is that there exist units of compilation that are independent of other units of compilation. Hierarchical reference and compilation directives are two features of Verilog 2001 that create issues for separate compilation. Historically, the issues for compilation directives have been solved by limiting their effect to a compilation unit as opposed to an entire design, or by reparsing the entire simulation unit each time and calculating which of the underlying compilation units have changed. Hierarchical reference has been handled by reparsing the entire design, in which case full information is available, by writing code that can deal with a variety of types, or by disallowing hierarchical reference.

$root complicates the picture because of the presence of data and module declarations within $root. The primary issues associated with this are listed above.

An additional issue that arises in SystemVerilog is the presence of implicitly connected .* ports on a module. The module ports in the instantiating module cannot be known unless the instantiated module is available.

 

Characteristics of a Successful Solution

Given the description of the problem environment above, there are several issues a solution should address:

Proposed Solutions to Date

Several proposals have been made to address the issues described above: