5.13 Simxlib: Compiled Library Utility

<< Click to Display Table of Contents >>

Navigation:  Chapter 5: VeriLogger Command Line Tools >

5.13 Simxlib: Compiled Library Utility

Previous pageReturn to chapter overviewNext page

Simxlib is a command-line utility program that enables viewing and editing the contents of symbolic libraries (compiled libraries). Either Simxlib or BugHunter must be used to create any symbolic library other than the work library. For example, if you wish to write a batch script that creates a common symbolic library to store compiled source code that is used by multiple design projects, you can use simxlib to create the physical library and specify the symbolic name for that library. An example script called make_xilinx_libs.pl that compiles Xilinx's Verilog libraries using simxlib and simx is documented at the end of this section.

Simxlib can perform the following library operations:

•Create physical libraries (physical representation of a compiled HDL library on disk)
•Delete physical libraries
•Map an existing physical library to one or more symbolic library names
•Unmap symbolic libraries
•List all symbolic to physical library mappings defined in a mapping file

Library Mapping Files

Simxlib reads/modifies a 'mapping file' (text file) as it performs the above operations. Mapping files are text files used by simx to map from the logical names of libraries to their physical path locations during design elaboration. Library mappings and include statements can also be manually added to mapping files using a text editor.

Simxlib operates only on a mapping file explicitly-specified using the --map_file option or the implicitly-specified scd.lib file located in the current working directory. If the specified mapping file doesn't exist, it is created when any option is passed to simxlib that requires writing to the mapping file. Only a mapping file directly passed via the command line (or the implicit scd.lib file if no mapping file is specified) can be potentially modified. Mapping files referenced by INCLUDE/SOFTINCLUDE statements are always opened in real-only mode by simxlib.

Simxlib has the following command line options:

-f <filename>

This allows options to be passed to simxlib from inside a text file (like in simx and simxloader).

--map_file <path>

Specifies a path to a mapping file to be read/modified by simxlib. If the specified mapping file doesn't already exist, simxlib will create it. If this option is omitted, simxlib will use scd.lib as the name of the mapping file.

--map (-m) <symbolicName> <path>

Creates a symbolic library name that maps to a physical library located at 'path'. Any existing library mapping having the same symbolic library name will be replaced by the new mapping. If there is no physical library at the given path location, a warning will be printed and the mapping will be skipped.

--unmap (-u) <symbolicName>

Removes the library mapping associated with the specified symbolic library. If no mapping exists, a warning is printed.

--create (-c) <path>

Creates a new physical library and creates a library mapping with the symbolic library name taken from the last part of the physical library path.

--delete (-d) <path>

Physically removes (erases from disk) the specified physical library. All library mappings leading to the physical library are removed too.

--list

Prints all mappings defined in the specified mapping file (and in files included by this mapping file).

--dump [library_name]

Dump library_name contents to the console. If no symbolic library name is specified, the contents of the default work library will be displayed. To work properly, make sure this is the last option passed to simxlib.

-l [logfile]

Log the results of simxlib operations to a logfile.

+append_log

Append the log results to the end of the logfile specified by -l option.

--help (-h)

Displays command-line options for simxlib.

Simxlib's Global Mapping File

By default, Simx and Simxlib will always try to read a special library map file called global_mappings.lib in %LOCALAPPDATA%\SynaptiCAD. This map file is primarily intended to be used for storing mappings to 3rd party ASIC/FPGA libraries that should not be modified by the user. For example, the script discussed below uses this map file by default to store the locations of the Xilinx Verilog libraries it compiles.

Pre-compiling Xilinx's Verilog libraries (using Simxlib and Simx)

BugHunter ships with a perl script for compiling Xilinx's verilog libraries into compiled libraries that can be used across multiple designs, saving the step of recompiling these libraries for each new design. Note: This script is for Verilogger Extreme users, so if you are using a different simulator with BugHunter, you will need to follow that simulator's instructions for creating/using a compiled library.

Before you run the script, you must install Xilinx's ISE tools which contain the Verilog source files to compile. Next, to build the compiled library, open a DOS command prompt and type the following commands:

cd synapticad\bin\win32

perl make_xilinx_libs.pl c:\xilinx\14.4\ise_ds\ise\verilog\src

 

Note that the argument to the script needs to reflect the actual location where you installed Xilinx ISE on your system (the example above assumes the default location where ISE 14.4 installs the Verilog source libraries). The compiled libraries will be stored in %LOCALAPPDATA%\SynaptiCAD\xilinx and the mappings will be put in the global_mappings.lib file.

With minor modifications, this script could also be used to compile libraries from other ASIC/FPGA vendors.

Pre-Compiling the Xilinx libraries to a non-default location

If you would prefer to build the compiled libraries in a different location such as c:\xlibs, you can pass an additional argument to make_xilinx_libs.pl to specify where to store the compiled libraries and where to place the map file that points to the compiled libraries. For example:

perl make_xilinx_libs.pl c:\xilinx\14.4\ise_ds\ise\verilog\src c:\xlibs

 

In this case, c:\xlibs will contain each physical library (e.g. unisim, simprims, XilinxCoreLib, etc.) and a map file (c:\xlibs\scd.lib) will be created (instead of using the default global_mappings.lib as the previous example did).

Using a Xilinx Compiled Library in your Design

To use a Xilinx compiled library in your design, simply add an appropriate -L option for the library. For example, to compile a design that instantiates Xilinx's unisim primitives when you built the Xilinx libraries to their default location, compile the file like this:

simx -L unisim mydesign.v

 

Note: If you built the libraries to a non-default location, you will also need to tell the simulator where the map file is located (since the mappings are not stored in the global_mappings.lib file in this case). For example, if you built the libraries to c:\xlibs, use a command like:

simx --scd_global_libmap_file c:\xlibs\scd.lib -L unisim mydesign.v

 

Simx will add new mappings to the local map file when the --work option is specified with a logical library name that is not defined in either the global or local lib map file. In the example above, we used the option --scd_global_libmap_file so that the map file is "read-only" and any new mappings required will be written to the local default map file (./scd.lib) in the current working directory instead. However, we could also have used the option --scd_libmap_file c:\xlibs\scd.lib, in which case simx would treat the map file as a local map file, so any new mappings would be added to it and ./scd.lib would not be accessed).

Using Xilinx Compiled Library with the BugHunter GUI

When using the BugHunter GUI, the -L option needs to be added to the Project Simulation Properties dialog:

•Select the Project> Project Simulation Options menu to open the Project Simulation Properties dialog.
•In this dialog, select the Verilog tab.
•Add the following option to the Elaborator option list:

-L unisim

•This tells the simulator to search the symbolic library called unisim for xilinx library primitives.