BugHunter Pro and the VeriLogger Simulators

5.5 Simx: Compiler/Elaborator

5.5 Simx: Compiler/Elaborator

Previous topic Next topic  

5.5 Simx: Compiler/Elaborator

Previous topic Next topic  

By default, simx compiles, elaborates, and runs a simulation snapshot in one step. In this mode, the options for each of these stages can be passed together to simx. But simx can be run as a two-step tool, compiling source files into a library in one step and elaborating a simulation snapshot in a separate step.

Running Simx in "Compile-Only" Mode to Compile Cells

Skipping the elaboration stage can be useful if you just want to use the simulator to check the files for correct syntax. To compile files into a compiled library without creating a simulation snapshot (i.e. to run simx in "compile-only" mode), use the +compile option.

For example, to compile two files test1.v and test2.v which contain the definitions of models named mod1 and mod2, type:

simx --work mylib +compile test1.v test2.v

The cells mod1 and mod2 inside files test1.v and test2.v will be added to the library mylib, but mod1 and mod2 will not be elaborated and no snapshot will be created in mylib.

By comparison, if you had typed:

simx --work mylib test1.v test2.v

the compile and elaboration of the design would both be performed, so mod1 and mod2 would be elaborated and a snapshot named after the first top-level module found in these files (mod1) would also be created in mylib. Next, simxloader would be launched to run the snapshot. So with this command, the design would be compiled, elaborated, and simulated in one step.

Running Simx in "Elaborate-Only" Mode to Create a Snapshot

Running Simx in elaborate-only mode can be useful if you have previously compiled source code files into a compiled library with multiple top-level models, some of which you want to now elaborate to create one or more snapshots. Since the source files have already been compiled into cells, there's no need to compile them again.

To run simx in elaborate-only mode, simply specify the desired top-level models for the snapshot, without specifying any source code files to compile.

For example, to elaborate mod2 from the example discussed above and create a snapshot called mod2, type:

simx --work mylib --scd_top mod2 --scd_nosim

The --scd_nosim option prevents the elaborator from launching simxloader to run the newly built mod2 snapshot. To run the mod2 snapshot later, the simxloader command-line tool can be executed as a separate command:

simxloader -r mylib.mod2

Simx Elaboration-Specific Command-Line Options

Below is a list of the mostly commonly-used elaboration options to simx.

--scd_top [unitname]

Specifies a top-level instance to elaborate. This is equivalent to right clicking on a module in the Project window and choosing Set as Top Level Instance from the context menu menu (see Chapter 1: Step 6: Build the Project and Set the Top ). This command can be used multiple times to select multiple components to elaborate as top-level instances in a snapshot. By default, all uncontained modules in a regular source file are elaborated as top-level modules. The following example will elaborate exactly two top-level instances, one called mytop1 and one called mytop2, into a snapshot called mytop1 in the work library:

    simx64 --scd_top mytop1 --scd_top mytop2

+name+<snapshot_name>

Use the specified name when creating the simulation snapshot. If this option is not specified, the snapshot will be named after the first top-level module elaborated.

--scd_nosim

Generate a simulation snapshot, but do not start the simulation. The simulation can later be started by running simxloader from the command line.

--work [worklib]

Specify the working library where the elaboration will be performed. This is the first place cell definitions will be searched during elaboration and the newly created snapshot will be placed in this library. If this option is not used, the default library called work will be used for elaboration.

Simx C++ Compilation-Specific Options:

Near the end of design elaboration, the elaborator will launch a C++ compiler to compile the snapshot. The options below affect how this C++ compilation is performed:

--scd_cleanup_objs

This performs a cleanup of the C++ object generated files from a simulation build. This is primarily useful for reclaiming space when finished working with a simulation.

--scd_jobs=n

Compile simulation executable with n jobs. Default value is 0 which sets the number of jobs to the number of processor cores. For example, on a dual core both processors will be used by default to compile the simulation executable as quickly as possible. To reduce the load on a dual core machine, n could be set to 1 to keep one processor free.

--scd_usemake

Use make as the build tool. By default, simx uses Scons as the build tool, as Scons will typically reduce the amount of files that need to be recompiled after edits of the HDL source code.