Integration by Encapsulation

To encapsulate a tool:
For example, if your design flow includes the invocation of yacc as in:
% yacc -d -t cc.y
You would activate tracing by prefixing the above command with vw as in:
% vw yacc -d -t cc.y
The encapsulation script is a Tcl script whose name is derived from the name of the encapsulated tool by prepending vov_ and appending .tcl. For example, the encapsulation script for the tool yacc is called vov_yacc.tcl and looks like this:
set FILEPREFIX "y"
while { [arglength] > 1 }  {
    set arg [shift]
    switch -- $arg {
        "-d" { VovOutput "$FILEPREFIX.tab.h"  }
        "-t" {}
        "-b" { set FILEPREFIX [shift] }
        default {
            VovFatalError "Unknown option $arg" 
        }
    }
}
VovInput  [shift]
VovOutput "$FILEPREFIX.tab.c"

For compatibility with Windows NT, in calculating the "name of a tool" we drop the suffixes .bat.exe and .cmd. Therefore, if the tool is called mytool.exe, its capsule is called vov_mytool.tcl.

The FlowTracer wrapper vw looks for the encapsulation script in the following directories:
  • In the property "CAPSULE" attached to the job (see Capsule On-the-Fly)
  • In the current working directory
  • In the directories indicated by the environment variable VOV_CAPSULE_DIR, if it exists; the directory names are separated by a colon on UNIX and by a semicolon on Windows NT
  • In the directory $VOVDIR/local/capsules
  • In the directory $VOVDIR/tcl/vtcl/capsules

This search order for the capsules facilitates the development of new capsules and the management of a set of site specific capsules.

Simple Capsules

Encapsulation is a simple and effective method to integrate any tool. While the encapsulation of some tools may be extremely complex, the majority of the capsules consists of very few lines of Tcl code. For example, say we are interested in encapsulating a tool called simulator that has the following command line:
simulator INPUT_FILE OUTPUT_FILE
The capsule for such tool may look like this:
# This is vov_simulator.tcl
VovInput [shift]
VovOutput [shift]

This is a good starting point. You can build interesting flows using the tool simulator and the simple capsule shown above. As you become more familiar with FlowTracer, you will learn how to increase the accuracy of the encapsulation, by looking at real capsules for real tools.

Capsule Template

When you need a new capsule, start from the standard template, which can be found in $VOVDIR/tcl/vtcl/capsules/vov_capsule_template.tcl

The template illustrates all the procedures that may be useful to write capsules.