DAI

DAI Signalscan User's Guide

TopNextPreviousHome PageSend Feedback


CHAPTER 7 Using Signalscan and VHDL

Overview 7-3

Model Technology ModelSim VHDL 7-3

Interfacing Signalscan to MTI ModelSim VHDL EE – UNIX 7-3

Interfacing Signalscan to MTI ModelSim VHDL EE – PC 7-5

Signalscan Commands for MTI ModelSim VHDL 7-6

recordsetup 7-7

recordvars 7-9

recordon and recordoff 7-11

recordclose 7-11

recordabort 7-11

signalscan 7-11

Writing a VCD File from a ModelSim VHDL Simulation 7-13

Cadence Leapfrog 7-14

Interfacing Signalscan to Your Simulator 7-14

Dynamically Linking Signalscan PLI 7-14

Statically Linking Signalscan PLI 7-15

Using Multiple C Interfaces 7-16

Signalscan Recording Commands for Cadence Leapfrog 7-17

Calling Signalscan PLI Commands from the Leapfrog Command Line 7-17

Calling Signalscan PLI Commands from a VHDL Subprogram 7-17

More Examples of Signalscan PLI Commands in Leapfrog 7-18

Overview

DAI Signalscan supports Cadence Leapfrog and Model Technology ModelSim VHDL EE.

The VHDL interfaces can save structured data such as records and arrays as well as integers, reals, logic values and other types. For more information on viewing structured data, see "Viewing Multi-Dimensional Objects".

Only Model Technology ModelSim VHDL EE 5.2a or later can be used interactively. See "Model Technology ModelSim VHDL" under "Interactive Debugging".

Model Technology ModelSim VHDL

This section first describes how to interface Signalscan to your simulator so that you can use Signalscan PLI commands to record a Signalscan SST2 Database. Later in this section are instructions for writing a VCD (Value Change Dump) file from a ModelSim simulation. Signalscan can read a VCD file and automatically convert it to an SST2 Database.

Interfacing Signalscan to MTI ModelSim VHDL EE – UNIX

In order to use the DAI Model Technology PLI, you must add the DAI PLI to the simulator. Once it has been added to the simulator, you can use any DAI predefined commands, as described in "Signalscan Commands for MTI ModelSim VHDL".

To include the DAI PLI in the Model Technology ModelSim VHDL EE simulator:

  1. 1. Create a design library (see your ModelSim VHDL documentation for details).
  2. For example, the following command:


% vlib work

    creates a directory named work inside the current working directory. This new directory represents a new design library that contains ModelSim-dependent information.

  1. 2. Compile your VHDL design file and a special DAI VHDL file, daimodeltech.vhdl , that came with your Signalscan distribution.
  2. Use your normal ModelSim commands vlib , vlog , and vcom . This is no different from your regular VHDL design compilation step. See your ModelSim documentation for compilation instructions.

    For example, the following command:


% cp $DAI_HOME/signalscan- version /share/daimodeltech.vhdl .
% vcom ./mydesign.vhdl ./daimodeltech.vhdl

    compiles the VHDL design described in the two source files: mydesign .vhdl and daimodeltech.vhdl . The mydesign .vhdl file represents your VHDL design file.

    The daimodeltech.vhdl file is necessary for ModelSim/Signalscan interactive (see "Model Technology ModelSim VHDL" under "Interactive Debugging"). To use the DAI Signalscan PLI, you must have the DAI PLI code built into your simulator. The DAI Model Technology ModelSim VHDL PLI is contained in a file called mrecord.so . The easiest way to reference this PLI code is to compile the DAI daimodeltech.vhdl into your design.

  1. 3. Add the directory that contains mrecord.so to the environment variable LD_LIBRARY_PATH :

% setenv LD_LIBRARY_PATH ${DAIHOME}/signalscan- version / platform /lib
  1. 4. Run the simulation, referencing the dai module defined in daimodeltech.vhdl .
  2. This is different from your normal simulation run. You must add a reference to a VHDL object named dai in order to automatically link the DAI PLI code into the ModelSim VHDL simulator. If you do not reference the dai object, the DAI PLI code will not be linked into the simulator, and you will get errors if you try to use any DAI PLI commands.


% vsim mydesign dai
  1. 5. Use recordvars as a command to the simulator in the vsim command window:

VSIM1> recordvars

    See also "Signalscan Commands for MTI ModelSim VHDL".

  1. 6. View the database:

% signalscan dai.trn

    The name dai.trn is the default name given to the Signalscan database if you did not use recordsetup to specify a different name.

    See "Model Technology ModelSim VHDL" under "Interactive Debugging" for a description of how to run Modelsim VHDL and Signalscan interactively to debug your source.

Interfacing Signalscan to MTI ModelSim VHDL EE – PC

In order to use the DAI Model Technology PLI, you must add the DAI PLI to the simulator. Once it has been added to the simulator, you can use any DAI predefined commands, as described in "Signalscan Commands for MTI ModelSim VHDL".

To include the DAI PLI in the Model Technology ModelSim VHDL EE simulator:

  1. 1. Locate the following two files in the Signalscan distribution:
signalscan- version \share\daimodeltech.vhdl
signalscan- version \x86-win32\lib\mrecord.dll
  1. 2. Copy both mrecord.dll and daimodeltech.vhdl to your current working directory (assumed here to be C:\work> ).
  2. 3. Edit daimodeltech.vhdl , and change " mrecord.so " to " mrecord.dll ".
  3. 4. Compile your VHDL design normally:
C:\work> vlib work
C:\work> vcom asic.vhdl
  1. 5. Compile daimodeltech.vhdl :
C:\work> vcom daimodeltech.vhdl
  1. 6. Run the simulation, referencing the dai module defined in daimodeltech.vhdl :
C:\work> vsim asic dai
  1. 7. Use recordvars as a command to the simulator in the vsim command window. For example:
VSIM1> recordvars
VSIM2> run 200 ns
VSIM3> exit

    Upon the completion of the simulation, your current directory contains a .trn file and a .dsn file.

  1. 8. Start Signalscan, click the OpenSimFile button in the Signalscan Control Window, and open the .trn file to view waveforms.

Signalscan Commands for MTI ModelSim VHDL

Invoke the Signalscan PLI commands by entering them at the simulator command line.

Creating an SST2 Database is controlled primarily by two commands: recordsetup and recordvars . Using these commands, you can record specific regions and signals, limit recording to a specified depth, and name the database.

The commands that are available are described in this section. These commands are:

recordsetup

The recordsetup command records basic design information and sets up the recording options for variables recorded with the recordvars command. This command is optional, but if used it should be placed before the first recordvars command.

When the recordsetup command is called, the scope hierarchy is recorded in the design file immediately. However, variables are not recorded until the recordvars command is called.

Syntax

recordsetup [ options ...]

Options

-filename file

Specifies the name of the SST2 Database. Although not required, the extension .trn is recommended to identify the transition database. A .dsn file is created with the same base name as the .trn file. If -filename is specified, -design , -version , and -run are ignored. If -filename is not specified, the default design file name is dai.dsn , and the default transition file name is dai.trn .

-design designname

Specifies the design name for file names of the form:

DesignName - VersionName .dsn

and

DesignName - VersionName - RunName .trn

-version version

Specifies the version number in the database name. If the version number is not specified, 1 is used.

-run run

Specifies the run number in the database name. If the run number is not specified, 1 is used.

-directory dir

Specifies the directory where the files will be saved.

-compress

Turns on compression of the transition file when recording. Note that sequence information is not compressed. See also the nocompress option below.

-nocompress

Turns off compression of the transition file when recording. This is the default.

-sequence

Save sequence information (record the sequence in which events occurred) in the SST2 Database. This information is used to view Sequence Time in Signalscan For more information, see "Viewing Sequence Time and Multivalue Indication".

-nosequence

Do not save sequence information in the SST2 Database. This is the default.

-wrapsize file_size

The transition data in the SST2 Database wraps when it reaches the specified size : Only size amount of data is kept in the .trn file, where size is a number of megabytes. This option limits the size of the transition data and does not affect the space used by other information such as scope and variable names. When the transition data begins to occupy more than its allotted maximum, the oldest transitions are overwritten by newer transitions. However, transitions are written to the file in blocks of about 4-5 Mb, when possible, and the maximum size may be increased if it is below this amount. It is recommended that the maximum size be at least 10 Mb, if specified.

Examples

Example 1

Specify database file names:

VSIM1> recordsetup -filename adder.trn

A design file named adder.dsn and a transition file named adder.trn are created.

Example 2

Specify path and design file name:

VSIM1> recordsetup -directory data -design adder

A design file named data/adder-1.dsn is created, and a transition file named data/adder-1-1.trn is created.

Example 3

Specify database path, design file name, and version name:

VSIM1> recordsetup -directory data -design adder -version algo1

A design file named data/adder-algo1.dsn is created, or replaced if it exists.

Example 4

Specify database file names, compression, sequence time, and file size limit:

recordsetup -filename test -compress -sequence -wrapsize 15

A design file named adder.dsn and a transition file named adder.trn are created. The transition file is compressed (note that sequence information is not compressed), sequence information is saved, and the transition file size is limited to 15Mb.

recordvars

The recordvars command is used to record variables to the SST2 Database. Only one SST2 Database may be written at a time, but additional variables may be recorded to the database at any time by using recordvars again.

Syntax

recordvars [ options ...]

Options

NOTE: Options apply to all following variables and scopes in the call, or to the default scopes if none are specified.

-depth n

When a scope is specified (see the -scope option below), by default all scopes within the specified scope are recursively recorded. This depth option sets a limit, n , to the depth of this recursion. For example, if n is 1 , no child scopes are included. The default is -depth 0 . Zero is a special value indicating no recursion limit.

-drivers

-var varlist

Variables listed in varlist are recorded in the SST2 Database. A variable may be a net, register, integer, time, real, or named event. The varlist can be either the name of a variable or a list of space-separated variables enclosed by curly braces: { and } .

- scope scopelist

All variables within the scopes listed in scopelist are recorded in the SST2 Database. In addition, variables in all child scopes are included recursively (see the description of the depth option above). A scope may be a module, task, function, or named block. The scopelist can be either the name of a scope or a list of space-separated scopes enclosed by curly braces: { and } .

If no variables or scopes are specified in a recordvars command, all variables in the design are recorded unless the depth option is used.

-record

Turns on recording. See also "recordon and recordoff".

-norecord

Turns off recording. See also "recordon and recordoff".

If neither -record nor -norecord is specified, recording status does not change.

-cancel

Stops recording and closes the database file. See also "recordclose".

Limitations

The DAI Signalscan Model Technology PLI code does not have access to certain parts of your VHDL design. Specifically, this means that Signalscan cannot save record information into the SST2 Database.

Refer to page 458 in the ModelSim EE/PLUS Reference Manual: "VSIM does not allow you to read RECORD signals or RECORD generics through the foreign language interface."

Examples

Example 1

Record all signals into a default database ( dai.trn ).

VSIM1> recordvars

Example 2

Record all signals into files named mydatabase.trn and mydatabase.dsn .

VSIM1> recordsetup -file mydatabase
VSIM2> recordvars

Example 3

Record only certain scopes or regions:

VSIM1> recordvars -scope /dlx_test/controller1

Example 4

Record to a specified depth:

VSIM1> recordvars -depth 2 -scope /dlx_test/controller1

Example 5

Record top_level.mul down three levels, and everything under analog .

recordvars -depth 3 -scope top_level.mul -depth 0 analog

Example 6

Turn recording off for everything under top_level.mul.a0 .

recordvars -norecord top_level.mul.a0

Example 7

Turn recording on for everything under top_level.mul.a0 and off for everything under top_level.mul.a1 .

recordvars -record top_level.mul.a0 -norecord top_level.mul.a1

recordon and recordoff

The recordon and recordoff commands are used to turn recording on or off, respectively. These commands do not have any options. At the beginning of the simulation, recording is on for the first SST2 Database opened. In addition, when an SST2 Database is closed or aborted, recording is reset to on for the next SST2 Database. Recording may be turned off for uninteresting periods of time during a simulation. The recordoff command does not close the database file.

Variable transitions are not recorded during the period where recording is off. This allows these parts of the simulation to be run at maximum speed, and can also save on disk space. All recorded variables are updated to their current values when recording is turned back on. Recording may be turned off and on any number of times during the simulation.

recordclose

The recordclose command is used to close a currently open SST2 Database. It stops all recording, flushes any buffered information to the database file, and closes the database file. This command does not have any options. Any open SST2 Database is closed automatically on exit, so this command is necessary only if you are generating multiple SST2 Databases. The recordclose command can also be used as an alternative to the recordoff command, to stop recording at some point before the end of the simulation.

recordabort

The recordabort command is used to abort recording to an SST2 Database that is no longer wanted. This command does not have any options. Any buffered information not yet written to the SST2 Database is discarded, and the incomplete file is deleted. Any current interactive connection to Signalscan is also aborted.

signalscan

The signalscan command is used to interactively view simulation results in Signalscan while the simulation is running. Although this command can be executed at any time, it is most often used near recordvars to execute Signalscan at the beginning of the simulation.

When the signalscan command is called, Signalscan is executed on the system where the simulator is running. If the -path option is given, the pathname is taken to be the absolute path to the desired Signalscan executable. Otherwise, the PATH environment variable is used to find the Signalscan executable, which must be named signalscan . The DISPLAY environment variable is used to determine where to display Signalscan windows.

All variables being recorded to the SST2 Database are available for viewing. Conversely, a variable must be recorded in the SST2 Database in order to view it with Signalscan. This means that there must be at least one call to recordvars in order for signalscan to be useful. See the example below.

There may only be one interactive Signalscan connection at a time for each simulation. If you exit Signalscan or the simulator, or use the recordclose or recordabort commands, the interactive connection is closed. The signalscan command can then be used again to start a new interactive connection.

Syntax

$signalscan [ option ] [ argument ] ...

Option

path= pathname

The path to the Signalscan executable, including the file name component. If this option is not specified, the PATH environment variable is used as before to find the executable, which must be named signalscan .

Argument

Arguments may be passed to the Signalscan program by specifying them as a single parameter to the signalscan command. For example, this can be used to load a Do-File or another SST2 Database to be used with the data from the simulation. See the example below.

Example

VSIM1> recordsetup -file mydatabase
VSIM2> recordvars
VSIM3> signalscan -path /usr/tools/signalscan-6.2/signalscan -do mydesign.do

Writing a VCD File from a ModelSim VHDL Simulation

Signalscan can read a VCD file and automatically convert it to an SST2 Database. Writing a VCD file is a little simpler than using the Signalscan PLI commands as described above. However, DAI recommends that you follow the above instructions to record data directly into an SST2 Database instead of converting a VCD file to an SST2 Database. See "Advantages of the DAI Signalscan SST2 Database".

To record data from a ModelSim VHDL simulation by writing a VCD file:

  1. 1. At the ModelSim prompt, enter the command:

Modelsim1> vlib work

    to establish a work folder. This opens a standard File Selection dialog box.

  1. 2. Double-click on your VHDL source file, and click the Compile button. When the compile operation is complete, click the Done button to close the dialog box.
  2. 3. In the ModelSim Applications window, click the Simulate button to display a dialog box that contains the list of design modules.
  3. 4. Select your design module in the dialog box, and click the Load button to load the module and dismiss the dialog box.
  4. 5. The prompt in the Applications window changes to VSIM> . At the VSIM> prompt, issue the two VCD commands vcd file and vcd add , as shown in the following example:

VSIM1> vcd file namethisfile.vcd
VSIM2> vcd add -r /*
VSIM3> run 10000
VSIM4> vcd checkpoint
VSIM5> quit

    This creates the VCD file called namethisfile.vcd in the directory above your current directory.

When you read this VCD file into Signalscan, it is automatically converted to an SST2 Database.

Cadence Leapfrog

Interfacing Signalscan to Your Simulator

Signalscan displays your simulation data by reading an SST2 Database. To write out a SST2 Database from your Leapfrog simulator, you must link the Signalscan PLI routines into your simulator dynamically or statically. The DAI Signalscan PLI is simply a set of C routines that are linked into your simulator before you simulate.

NOTE: Leapfrog is very easy to use with one set of fmi or cfc libraries linked in. If you are using more than one set of libraries, you need to do some additional work. Please contact Cadence for more information.

Dynamically Linking Signalscan PLI

The advantage of linking the Signalscan PLI dynamically is that you do not need to link your simulator, or run any configuration program.

  1. 1. Locate the files record-xl-PIC.a , cfcuser.c , and fmiuser.c , included in the Signalscan distribution.
  2. 2. Compile the cfcuser.c and fmiuser.c source files you located in Step 1 using any C compiler installed on your system.
  3. For example if cfcuser.c and fmiuser.c are in $DAI_HOME/signalscan- version /share . you could use the following commands:


gcc -fPIC -o cfcuser-pic.o -I${CDS_INST_DIR}/tools/leapfrog/include -c \
${DAI_HOME}/signalscan- version /share/cfcuser.c
gcc -fPIC -o fmiuser-pic.o -I${CDS_INST_DIR}/tools/leapfrog/include -c \
${DAI_HOME}/signalscan- version /share/fmiuser.c
  1. 3. Link the record-xl-PIC.a library you located in Step 1 with the object files you created in Step 2 to create the libfmi.so and libcfc.so shared libraries.
  2. For example, if record-xl-PIC.a is in $DAI_HOME/signalscan- version / platform /lib , type the following:

    • · On SunOS/Solaris:

ld -s -shared -o libfmi.so fmiuser-pic.o \
${DAI_HOME}/signalscan- version /sparc-solaris/lib/record-xl-PIC.a
ld -s -shared -o libcfc.so cfcuser-pic.o
    • · On HP:

ld -b -o libfmi.sl fmiuser-pic.o \
${DAI_HOME}/signalscan- version /hp-hpux/lib/record-xl-PIC.a
ld -b -o libcfc.sl cfcuser-pic.o

    If you have other FMI foreign objects, include them when you use ld to make the shared library libfmi.so . If you have other CFC objects, include them when you use ld to make the shared library libcfc.so .

  1. 4. Set your shared library search path to include the directory that contains the shared libraries you have just created before you run the simulator.
    • · On SunOS/Solaris:

setenv LD_LIBRARY_PATH \
directory-that-contains-libfmi.so-and-libcfc.so :${LD_LIBRARY_PATH}
    • · On HP:

setenv SHLIB_PATH \
directory-that-contains-libfmi.sl-and-libcfc.sl ${SHLIB_PATH}

Statically Linking Signalscan PLI

  1. 1. Locate the files record-xl.a , cfcuser.c , fmiuser.c , included in the Signalscan distribution.
  2. 2. Run the Leapfrog simulation build script lfconfig . For example:

lfconfig -t standalone
  1. 3. When asked for the objects/archives to link, enter the path for record-xl.a , cfcuser.c , and fmiuser.c that you located in Step 1. After the configuration, a file called cr_sv is created. To compile cfcuser.o and fmiuser.o , you can use any C compiler available on your system. You also may get an error message such as the following:

unix% gcc -o cfcuser.o -I$CDS_INST_DIR/tools/leapfrog/include -c cfcuser.c
unix% gcc -o fmiuser.o -I$CDS_INST_DIR/tools/leapfrog/include -c fmiuser.c
unix% lfconfig -t standalone
lfconfig 2.50-p001: (c) Copyright 1992-1997, Cadence Design Systems, Inc.
Enter name of script file (cr_sv):
Enter objects/archives to link; terminated by a line beginning with a `.': cfcuser.o
Enter objects/archives to link; terminated by a line beginning with a `.': fmiuser.o
Enter objects/archives to link; terminated by a line beginning with a `.': /product/idist/signalscan-5.2/sparc-solaris/lib/record-xl.a
Enter objects/archives to link; terminated by a line beginning with a `.': .
Wrote script file cr_sv.
Executing command: ./cr_sv
./cr_sv: acc: not found
  1. 4. If you get an error message such as the one shown above, you may not have the acc compiler installed on your system. In this case, edit the cr_sv file and change acc to the name of another compiler that is installed on your system. For example, acc may be changed to gcc to use the gcc compiler.
  2. 5. Create the files sv.exe and svnovlog.exe by typing cr_sv . Make sure these two files are in the same directory, and that directory is in your path. Make sure that when you invoke sv.exe , you are invoking the sv.exe in that directory.

NOTE: Due to a bug in the Leapfrog notebook interface, your sv.exe must be in the current directory in order for it to be used by the notebook interface. If you execute sv from the UNIX shell, or from a shell script outside of the notebook interface, your sv.exe will be correctly executed as long as it is in your search path.

Using Multiple C Interfaces

Leapfrog can only use C interfaces that are provided in either libfmi.so or libcfc.so .

In order to use multiple C interfaces, all of the interfaces must be combined together into one libfmi or libcfc . This involves:

  1. 1. Unpack the PIC object files from a .a archive for each interface.
  2. 2. Create a new table, and compile that table using a C compiler.
  3. 3. Use ld to recombine the PIC objects from the two interfaces with the newly compiled table.
  4. This creates a new libcfc or libfmi .

    For example, on Solaris, using gcc , enter:

% mkdir objs
% cp lrecord-PIC.a objs
% cp other-PIC.a objs
% cd objs
% ar x lrecord-PIC.a
% ar x other-PIC.a
% vi newtable.c
% gcc -fPIC -c newtable.c
% ld -shared libfmi.so newtable.o *.o

Signalscan Recording Commands for Cadence Leapfrog

You can invoke the Signalscan PLI commands by calling the dai function from the simulator command line or the DAI procedure from your VHDL subprograms.

Creating an SST2 Database is controlled by two commands: recordsetup and recordvars . Using these commands, you can record specific regions and signals, limit recording to a specified depth, and name the database.

For more information on the Signalscan PLI commands and options shown in the examples in this section, see .

NOTE: Only the commands and options shown in the examples below are known to work with Leapfrog.

Calling Signalscan PLI Commands from the Leapfrog Command Line

To call Signalscan PLI commands directly from the simulator command line, call the dai function as follows:

call dai {recordsetup -file addr.trn -compress}
call dai {recordvars}

Calling Signalscan PLI Commands from a VHDL Subprogram

To call Signalscan PLI commands from your VHDL subprograms, declare a procedure DAI in the design as follows:

procedure DAI(command: string);
attribute foreign of DAI: procedure is "DAI:command";

Then you can invoke it by calling DAI( string ) in your source code. For example:

DAI("recordsetup -file addr.trn -compress");
DAI("recordvars");

More Examples of Signalscan PLI Commands in Leapfrog

The Signalscan PLI does not accept Verilog's or VHDL's escape mechanism. To escape a string, put the whole string between curly braces: { and } . Curly braces in the middle of a string have no meaning. Use the backslash character, \ , to escape the opening and closing curly brace characters.

Example 1

Record four levels of scope Top.b.c .

From the command line, type:

call dai {recordvars -depth 4 -var Top.b.c}

In VHDL source code, enter:

DAI("recordvars -depth 4 -var Top.b.c");

Example 2

Record a variable in the scope insta which is in the scope a/b .

From the command line, type:

call dai {recordvars -var {a/b}.insta.e}

In VHDL source code, enter:

DAI("recordvars -var {a/b}.insta.e");

Example 3

Create a design file named adder.dsn and a transition file named adder.trn .

From the command line, type:

call dai {recordsetup -file adder.trn}

In VHDL source code, enter:

DAI("recordsetup -file adder.trn");

Example 4

Specify both a directory and a design name for the database files.

From the command line, type:

call dai {recordsetup -dir data -design adder}

In VHDL source code, enter:

DAI("recordsetup -dir data -design adder");

A design file named data/adder-1.dsn is created, if no other files with a name matching adder-*.dsn exist in the data directory. Otherwise, the 1 is replaced with the next available number. If adder-1-1.trn currently exists in the data directory, a transition file named data/adder-1-2.trn is created. Otherwise, a transition file named data/adder-1-1.trn is created.

Example 5

Specify a directory, design name, and version name for the database files.

From the command line, type:

call dai {recordsetup -dir data -design adder -version algo1}

In VHDL source code, enter:

DAI("recordsetup -dir data -design adder -version algo1");

A design file named data/adder-algo1.dsn is created, or replaced if it exists.


DAI
TopNextPreviousHome PageSend Feedback
© Copyright 1999 Design Acceleration, Inc. All rights reserved.