The Super-FinSim Simulation Environment (Super-FinSim), consists of an OVI-compliant Verilog compiler, a simulation builder, a simulation kernel and a graphical user interface to drive them.
The purpose of the Verilog compiler is to (1) check the design for syntactic and semantic correctness, (2) generate code and elaboration data required to configure and program the simulation kernel according to the design description, and (3) optionally generate an intermediate format representation of the description for processing by other applications.
The purpose of the simulation builder is to compile the generated C code (if any) and link all the files that are necessary to build a simulator, i.e. the C object files corresponding to the Verilog source, the PLI object files and libraries and the simulation kernel library. The host C linker is invoked for this purpose.
The simulation kernel is the code that is common to the simulation of all Verilog designs. Once configured and programmed, the simulation kernel becomes a simulator for a particular Verilog design. The simulator in Super-FinSim can run in compiled, interpreted or a mix of compiled and interpreted modes.
The following subdirectories are created during the installation of Super-FinSim:
The following instructions apply to all UNIX distributions, including Linux. Depending if you received the software on a CD-ROM or you downloaded it from the Internet, follow the next instructions to go to the proper directory. After that, the instructions apply to both cases. The platforms are encoded as follows:
linux_glibc20 for the glibc 2.0 compatible Linux distributions
linux_glibc21 for the glibc 2.1 compatible Linux distributions
linux_glibc22 for the glibc 2.2 compatible Linux distributions
linux_glibc23 for the glibc 2.3 compatible Linux distributions
For Linux, if you are not sure which version of glibc you have, please run the following command on your Linux machine:
If the file is a link to libc-2.0.x.so then you have a glibc 2.0 compatible distribution. If the file is a link to libc-2.1.x.so then you have a glibc 2.1 compatible distribution, if it is a link to libc-2.2.x.so your system is based on glibc2.2, if it is a link to libc-2.3.x.so your system is based on glibc2.3. Most recent Linux distributions are glibc 2.3 compatible.
The CD-ROM provided contains Super-FinSim for all the supported platforms. It is mastered under the ISO-9660 file system. Since the command to mount the CD-ROM varies from one platform to another, consult your system administrator for mounting instructions. The following is an example to mount the CD-ROM under Sun OS 4.1.x:
# mount -r -t hsfs /dev/sr0 /cdrom
Go to the directory on the CD corresponding to your platform. For example, to go to the Solaris distribution:
and run the C-shell installation script install.csh
Installing from the download site
You can download the latest FinSim distribution either from our Web site or from our Ftp site. To download from our Web site, please go to http://www.fintronic.com, click on Support and then follow the link "Download the latest version for your Fintronic product". To download from the Ftp site, please:
login as anonymous and give your email as password
cd pub/products/finsim/<your platform>
After finishing downloading, cd to the directory where you downloaded the files, for example:
Once you are in the distribution directory, run the C-shell installation script install.csh.
After installing the Super-FinSim software, the installation script will attempt to install the GNU gcc compiler if it is not already installed. If you would like to install GCC at a later time, please run the installation script install.csh with the option gcc:
Super-FinSim uses the FLEXlm licensing mechanism. The installation script will attempt to find out if FLEXlm is already running on your machine and if not, it will attempt to install the FLEXlm license daemon and utilities. It will also attempt to install the Fintronic vendor daemon. If you would like to install the license at a later time, please run the installation script install.csh with the option license:
Users with previous FLEXlm licenses experience can skip this step and proceed to install the licenses received from Fintronic USA as appropriate for their organization.
The license keys received from Fintronic should be added to your FLEXlm license file if you already have one. The default is /usr/local/flexlm/licenses/license.lic. The license file can be installed in another directory by setting the environment variable LM_LICENSE_FILE to the appropriate path.
To start the FLEXlm license manager:
# lmgrd -c <full path to license file> -l <full path to log file>
If the license manager is already running, just restart it as follows:
# lmutil lmreread -c <full path to license file>
The FLEXlm software has many different options and allows for a variety of configurations. For more information about the FLEXlm licensing software and for a FAQ please visit out website: http://www.fintronic.com, click on Support and follow the FLEXlm related links.
The following instructions apply to all Windows versions.
To install FinSim for Windows you need to run the installation program (finsim.exe). It can be found either on the CD-ROM you received from Fintronic in the directory FinSim\winnt or you can download it from our website (www.fintronic.com) or from our ftp site (ftp.fintronic.com) using the same instructions as for the UNIX distributions. The installation program will install all the necessary files and modify autoexec.bat and/or environment variables as appropriate for the specific Windows version on your machine.
Installing the Microsoft Visual C++ compiler
To run Super-FinSim in the compiled mode or with a PLI application, you need to have Microsoft's VC++ compiler installed on your system. If you do not have it, please get it and follow the provided instructions on how to install it.
Installing the FLEXlm License for Windows
As a license administrator you are responsible for setting up licensing on your system or network. Generally, installing FLEXlm licensing requires the following steps:
1. Select your license server node(s) and get their hostid(s).
2. Send the hostid(s) to Fintronic USA to receive a license in return.
3. Consider combining the new license file with any existing license files.
4. Check if the FLEXlm utility programs are installed on your computer.
5. Start lmgrd (the license manager daemon) .
1. License Server Node and Hostids
Before running Super-FinSim using floating licenses, you will need to set up your license server node(s). You must select which node(s) to run your license server(s) on and provide the hostid(s) of those machines to Fintronic USA.
To get the hostid of the server machine you can use the following commands:
- for Windows 95/98/ME: WINIPCFG
- for Windows NT: IPCONFIG/ALL
If you don't have an Ethernet card on the computer on which you want to run the simulator, you can obtain a license based on a dongle provided by Fintronic USA.
2. Send the hostid(s) to Fintronic USA to receive a license in return
You can make a request for a license from the Fintronic USA website www.fintronic.com, or by sending an email to license@fintronic.com with information about the platform and hostid(s).
3. Consider combining the new license file with any existing license file(s)
If you run other programs which require Flexlm licenses, you can add the license for the Fintronic simulator to the existing license file. To combine license files, merge all of the compatible license files into one file, then edit out the extra SERVER lines so that only one SERVER line remains. Save this data and you have your combined license file.
4. Check if the FLEXlm utility programs are installed on your computer
If you already use the Flexlm license manager for other products, the Flexlm utility programs should be installed on your computer. However, they've also been installed in %FINTRONIC%\bin\cl, where %FINTRONIC% is the directory you installed the simulator.
5. Start lmgrd (the license manager daemon)
You can start lmgrd manually using:
C:\> lmgrd -c <license_file_path> -l <debug_log_path>
where license_file_path is the full path to your license file and debug_log_path is the full path to the desired log file.
The preferred alternative is to use the supplied applet flexlm.cpl (located in %FINTRONIC%\bin\cl), which has a lot of other features, including setting up lmgrd to start automatically at boot time (check 'Start server at Power-Up'option).
In order for simulator to access your license file, it is necessary to set an environment variable:
C:> set LM_LICENSE_FILE=<license_file_full_path>
You can set this variable at the command prompt before you run the simulator or, better, add to the autoexec.bat.
Go to Control Panel | System | Environment and add the variable there.
For any other information regarding Flexlm License Manager please check the Flexlm User Guide (http://www.globetrotter.com/TOC.htm).
Under the Super-FinSim compiled simulation environment, a host ANSI `C' compiler is used to compile the generated code and the PLI source code. For the HP version of Super-FinSim, HP's cc compiler is required. For the remaining Unix platforms supported by Super-FinSim, GNU's gcc compiler is required. Microsoft's Visual C++ compiler is required for all the Windows versions.
Super-FinSim utilizes several environment variables to define its working environment. They are summarized in the table below as they would appear in a Unix environment. On Windows, the same variables are used with the appropriate modifications (`/' becomes `\' and `.o' becomes `.obj').
The compiler performs the following operations:
The Super-FinSim Verilog compiler has a fast and robust analyzer with an extensive error checking and recovery mechanism. In addition, the analyzer can optionally generate a number of warning messages flagging potential design errors such as accessing an array element out of bounds.
The Super-FinSim Verilog compiler is invoked as follows:
finvc <option or source file> [<option or source file> ...]
Some compiler options from Verilog-XL are supported in the Super-FinSim Verilog compiler, including options that control the library search mechanism. Command files are also supported to facilitate invocation.
The desired simulation mode of Super-FinSim, whether it be compiled, interpreted or a mixture of compiled and interpreted must be specified at compilation time. If no options are specified, Super-FinSim will attempt to simulate the entire design in compiled mode if a license for compiled simulation is found. If not, the design will be simulated in the interpreted mode.
All compiler messages are stored in the log file `finvc.log'.
Library search control options
-ld <dir> : search for undeclared modules in the specified library directory
-lf <file> : search for undeclared modules in the specified library file
-v <file> : same as -lf <file>
-le <str> : use the specified string as the file extension when searching for undeclared modules in library directories
+libext+<str> : same as -le <str>
-lsm <str> : the specified string describes the library search mechanism to use, it must be one of d (default), o (order) or r (rescan)
Include file search control options
-id <dir> : search for include files in the specified include directory
+incdir+<dir> : same as -id <dir>
-cf <file> : take command line information from the specified command file
-f <file> : same as -cf <file>
-dm <name>[=<value>] : define a macro with name <name> and value <value>
+define+<name>[=<value>] : same as -dm <name>[=<value>]
-nowarn <warning number> : suppress warning with the specified number
-imtm : suppress warning messages about inconsistent min:typ:max expressions that can be evaluated at compile time (e.g. 5:4:3)
-rmmo : suppress warning messages about range mismatches in mode and object declarations (e.g. input [0:7] a; wire [1:8] a;)
-fwrv : suppress warning messages about functions without a return value i.e. functions that do not assign to a register that has the same name as the function
-nprc : suppress warning messages about non positive replication counts in replicated concatenation expressions (e.g. {0 {r}}, {-1 {1'b1}})
-sav : suppress warning messages about slicing of supposedly atomic vectors (e.g. integer i; time t; initial i[10:9] = t[5:4];)
-cpd : suppress warning messages about cyclic parameter dependencies that may be created when parameters are overridden
-pot : suppress warning messages about parameters whose value is overridden two or more times
-ucp : suppress warning messages about ports that are left unconnected module/primitive instantiations
-aoi : suppress warning messages about modules that assign to their own input(s)
-mapl : suppress warning messages about ports that appear multiple times in the port list
-ues : suppress warning messages about unknown escape sequences encountered in strings
-rcel : suppress warning messages about case expressions or case labels that are of type real
-bss : suppress warning messages about bad strength specifications (e.g. supply0 (pull0, pull1) vcc = 1'b1;)
-bpsu : suppress warning messages about bad usages of parameters or specparams (e.g. using parameters within specify blocks, using specparams outside specify blocks, overriding of specparams
-swlv : suppress warning messages about specparams with list values (e.g. specparam s = (0, 1, 2, 3, 4, 5);), only the first value (0) is significant
-rdm : suppress warning messages about redefinitions of macros
-umnd : suppress warning messages about undefining of macros that are not defined
-bmn : suppress warning messages bad macro names in the command line (e.g +define+@#!!!++)
-icd : suppress warning messages about incorrect usage of the `celldefine directive (e.g. nested `celldefines, unmatched `celldefines/`endcelldefines)
-ip : suppress warning messages about incorrect usage of the `protect directive (e.g. unmatched `protect/`endprotects)
-eti : suppress warning messages about extraneous tokens placed after a `include "<file>" directive
-cee : suppress warning messages about constant event expressions (e.g. always @(25) a = b;)
-nseee : suppress warning messages about non scalar event expressions with edge specifiers (e.g. @(posedge a[0:7]))
-tne : suppress warning messages about triggered objects that are not events (e.g. real r; initial -> r;)
-tmpi : suppress warning messages about primitives with too many inputs
-bpte : suppress warning messages about bad entries in a primitive table (e.g. ? ? : 0)
-dreni : suppress warning messages about data or reference events in timing checks that are not module inputs
-wmiopp : suppress warning messages about width mismatches between inputs and outputs in a parallel path specification (e.g. i[0] => b[0:100] = 10;)
-wmodsep : suppress warning messages about width mismatches between the output and data source in an edge sensitive path specification (e.g. (posedge i[0] => (o[0] : c[0:2])) = 10;)
-nnsr : suppress warning messages about notify expressions in timing checks that are not scalar registers
-ustf : suppress warning messages about unknown system tasks/functions
-stfap : suppress warning messages about system tasks/function arguments that may cause problems
-ind : suppress warning messages about implicit net declarations
-bcwts : suppress warning messages about width specifications in based constants that are too small to hold the value of the constant (e.g. 2'hff)
-scw32 : suppress warning messages about shift count expressions whose width is greater than 32
-aiw32 : suppress warning messages about array index expressions whose width is greater than 32
-rcw32 : suppress warning messages about repeat count expressions in repeat statements whose width is greater than 32
-mccw32 : suppress warning messages about multiple concatenation expressions in which the width of the sub expression representing the replication count is greater than 32
-mcdw32 : suppress warning messages about expressions representing multi channel descriptors whose width is greater than 32
-dw64 : suppress warning messages about delay expressions whose width is greater than 64
-ncd : suppress warning messages about non constant delay expressions
-rd : suppress warning messages about delay expressions of type real
-nd : suppress warning messages about negative delay expressions
-xzd : suppress warning messages about delay expressions that contain x's or z's
-tmarg : suppress warning messages about type mismatches between actual and formal arguments of tasks/functions
-wmarg : suppress warning messages about width mismatches between actual and formal arguments of tasks/functions
-twmarg : same as "-tmarg -wmarg"
-tmass : suppress warning messages about type mismatches between the lhs and rhs of assignments
-wmass : suppress warning messages about width mismatches between the lhs and rhs of assignments
-twmass : same as "-tmass -wmass"
-tmgate : suppress warning messages about type mismatches between gate terminals and the expressions connected to them
-wmgate : suppress warning messages about width mismatches between gate terminals and the expressions connected to them
-twmgate : same as "-tmgate -wmgate"
-tmport : suppress warning messages about type mismatches between module/primitive ports and the expressions connected to them
-wmport : suppress warning messages about width mismatches between module/primitive ports and the expressions connected to them
-twmport : same as "-tmport -wmport"
-tmcel : suppress warning messages about type mismatches between case expressions and case labels
-wmcel : suppress warning messages about width mismatches between case expressions and case labels
-twmcel : same as "-tmcel -wmcel"
-tmexp : suppress warning messages about type mismatches (leading to type conversions) between operands of the following expressions (+, -, *, /, , <, <=, >, >=, ==, != , ===, !==, &, !, ^, ^~, ?:
-wmexp : suppress warning messages about width mismatches between operands of the following expressions (+, -, *, /, , <, <=, >, >=, ==, !=, ===, !==, &, !, ^, ^~, ?:
-twmexp : same as "-tmexp -wmexp"
-tm : same as "-tmarg -twmass -tmgate -tmport -tmcel -tmexp"
-wm : same as "-wmarg -wmass -wmgate -wmport -wmcel -wmexp"
-twm : same as "-twmarg -twmass -twmgate -twmport -twmcel -twmexp"
-eswis : generate warning messages about event statements with incomplete sensitivities e.g (@(a or b) d = a + b + c;), these messages are suppressed by default
-a : suppress all warning messages
-encrypt : encrypt all code within `protect and `endprotect directives, an auto encryption option will also be added soon
Delay component selection options
-min : use the min component in min:typ:max expressions
-typ : use the typ component in min:typ:max expressions, this is also the default
-max : use the max component in min:typ:max expressions
+delay_mode_zero : use zero delay mode
+delay_mode_unit : use unit delay mode
+delay_mode_path : use path delay mode
+delay_mode_distributed : use distributed delay mode
-lic <file> : read license keys from the specified file rather than the one specified in the environment variable FIN_LICENSE_PATH or LM_LICENSE_FILE
-lic_verbose : run the license manager in verbose mode, useful for debugging license problems
-lic_type <100K|50K|25K|2K> : if you have licenses for different types of simulators and want to get a specific one
Interpretation/Compilation options
-comm <mod> : compile the specified module
-intm <mod> : interpret the specified module
-comf <file> : compile modules read from the specified file
-intf <file> : interpret modules read from the specified file
-comd <dir> : compile modules read from any file in the specified directory
-intd <dir> : interpret modules read from any file in the specified directory
-dsm <mode> : sets the default simulation mode to compile (-dsm com) or interpret (-dsm int), -dsm com is the default
-sysc <file> : considers that file contains SystemC modules. Some of these modules may be instantiated in Verilog modules. Multiple such options may be used in the same finvc invocation.
-tp<module_name> : specifies a top-level module. If one top-level module is specified usually it is better to specify all top-level modules. Multiple such options may be used in the same finvc invocation.This option is mandatory in case generate statements occur in the Verilog code.
-irc : incrementally recompile the design, this option should be used when small changes are made to a design in which most or all modules are compiled, finvc determines the modules affected by the changes and interprets them to bypass the C compiler and linker
-td <dir> : place generated files required for simulation in the specified directory, the default is ./fintemp
-pp : pretty print (decompile) the source (in file pp.out)
-stb : print the symbol table (in file stb.out)
-ifb : print the intermediate format in binary (in file ifb.out)
-ifa : print the intermediate format in ascii (in file ifa.out)
+finvcc : generate information for Fintronic's code coverage tool
+vtdbg : generate information for Veritool's source level debugger
-ol <0-11> : use the specified integer as the optimization level, a higher level indicates that more optimizations will be performed, the default is 1 (many optimizations are performed at level 1)
-acc : use the acceleration algorithm in the simulator
-noacc : do not use the acceleration algorithm in the simulator
+caxl : accelerate continuous assignments
+notimingchecks : ignore timing checks
+no_notifier : ignore notify registers in timing checks
+fin_no_ecs : do not use Fintronic's Enhanced Cycle Simulation, usage of this option will increase simulation time
+fullaccess : keep detailed information on all declared signals; this option might increase simulation time and memory consumption
-fastgate : use the fast gate algorithm in the simulator
+no_plusargs_substitution : does not optimize calls to $test$plusargs with constant string arguments at compile time allowing users to run the simulator multiple times with different plus args without having to recompile and build the simulator for each run, usage of this option will increase simulation time
-pli : generate pli information even if the user's source code does not have pli calls (needed for instance when used with Intergraph's Veriscope tool)
-des <str> : use the specified string as the name of the design
-ao : perform syntax and semantic analysis only, do not generate code and data for simulation
-uc : convert all identifiers to upper case
-ptab <file> : get information about pli tasks/functions from the specified ascii file instead of having to link user's pli object files to obtain this information
-nttfsm : reject constructs not supported by NTT's FSM tool
-log <file> : use the specified file as log file instead of the default finvc.log
-silent : suppress messages about whic source/library files are currently processed
The Verilog compiler determines the simulation mode of a module (compiled or interpreted) based on the invocation options `-comm <mod>', `-intm <mod>', `-comf <file>', `-intf <file>', `-comd <dir>', `-intd <dir>' and `-dsm <mode>'. The precedence order of these options are:
For example, if the user types the following:
and the module `test' is defined in the file `test.v', then all modules in file `test.v' will be interpreted except `test' which will be compiled.
The Verilog compiler generates `C' code files, interpretation data files and elaboration data files for each design. The `C' code, interpretation data and elaboration data files have the extension `.c', `.i' and `.edf' respectively. The compiler also generates some other files needed at run time.
All files generated by the Verilog compiler are stored in the working directory defined in the environment variable FINTEMPDIR, the directory specified with the -td option or the directory fintemp created in the local directory.
Incremental recompilation can be used when small changes are made to a design in which most of the modules are compiled. The compiler determines the modules affected by the changes and interprets them to bypass the C compiler and linker. The first time around, finvc should be invoked in the usual way. For subsequent runs, the option `-irc' should be added to the other finvc options to take advantage of the incremental recompilation feature.
Super-FinSim provides the facility of separately compiling parts of the Verilog hierarchy. This pre-compiled hierarchy can then be mixed with other Verilog sources to build a new design. This facility is extremely helpful for users who want to ship their IP to their customers but do not want them to access the Verilog source. Not only will the access to the source be denied using the regular `protect/`endprotect mechanism but the IP provider will only have to ship binary files which would make it virtually impossible to re-create the original Verilog code. Another useful application of separately compiled code is for users who add legacy code to their designs which has been tested and will not need to be modified.
A Verilog description can be separately compiled for later reuse by invoking the compiler, called finvc, with the special option +sepgen, followed by an invocation of finbuild, as follows:
#finvc +sepgen+<mymodel> <other options>
where <mymodel> is a name given by the user to this design. One of the uses of <mymodel> is to make any symbols in the separately compiled design not clash with similar symbols in the final design (which instantiates the separately compiled design). After running these two steps, the temporary directory (fintemp by default) will contain the compiled `C' files, the interpretation data files, the elaboration data files as well as all other files needed for simulating this hierarchy. In addition it will contain a Verilog interface file called interface.v. This file contains the shell for the exported modules in the separately compiled design. Any of these modules can be instantiated in the final design.
finvc also assumes that everything in the separately compiled design except the interface for the top level module is protected. This assumption can be relaxed with the option (+fin_sep_unprotect).
In order to use a separately compiled Verilog design hierarchy as part of a new Verilog design hierarchy one must invoke finvc with the special option +sepuse, followed by finbuild and the invocation of the executable simulator, as follows:
# finvc +sepuse+<directory name> <other options>
The directory name is the directory where all the files were generated in the compilation step. More than one such +sepuse options can be specified. In this case finvc treats the file interface.v in the separately compiled directory as a library file, so that any module that is used in the final design and cannot be found is searched in this file.
Restrictions on the separately compiled code
A module in the separately compiled design can be instantiated outside of the separately compiled design only if:
a) there are no external references anywhere in the the separately compiled design (things like a.b.c)
b) none of its parameters or the parameters of the modules instantiated in the hierarchy below it are overwritten with more than one value
Restrictions on the code instantiating a separately compiled module
A design can instantiate modules from the separately compiled design if:
a) it does not overwrite the parameters of the separately compiled module
b) it doesn't make external references into the separately compiled design
c) its time precision is not finer than the time precision of the separately compiled design.
Super-FinSim allows the user to call functions written in the C language directly from within the Verilog code. The user only has to provide one or more C header files with the prototypes of the C functions.
The arguments of these C functions can be characters (8 bits), short integers (16 bits) integers (32 bits), long long integers (64 bits) and pointers to them. Super-FinSim assumes that all pointers in the interface correspond to outputs that are going to be written inside the C functions. All other arguments are assumed to be inputs to the C functions. The semantics for calling C user functions and tasks are similar to the semantics for calling Verilog or PLI functions and tasks.
The header files providing the prototypes of the C functions are passed to finvc with the -ch <name of header file> option. This option can be specified any number of times if more than one header file is required. Note that the header files must be self sufficient (as all well written header files ought to be), i.e. if a header file uses things defined in another header file then the 2nd header file should be included in the 1st header file. If any of the header files is in a different directory, the user can specify the include directory by using the +incdir option the same way as for verilog header files.
The object files containing the user C functions can be specified either in the file finpli.mak in the variable FINUSERCOBJ:
or via the environment variable with the same name:
More than one object files can be specified. If used, the file finpli.mak has to be in the local directory where finbuild is called.
If the specified object file does not exist, finbuild will attempt to compile it using a default compilation rule that calls the C compiler on the corresponding .c file.
This facility is currently supported on Linux glibc2.2, glibc2.1, Solaris 32 and 64.
Super FinSim is integrated with the SystemC simulator owned by OSCI. Please note that no representation is being hereby made with regards to the functionality or the quality of this simulator governed by the Open Source License Agreement provided by OSCI on its WEB site.
Supported platforms: Linux 32 bit (glibc2.1, glibc2.2, glibc2.3) and Solaris 32 bit.
Supported versions of SystemC: SystemC-2.0.1 only
The option -sysc <file> must be provided to finvc, where <file> contains the SystemC description of all SystemC modules instantiated in the current Verilog simulation.
i) The size and order of the ports of the Verilog prototype (description of ports) must match the size and order of the SystemC ports. The name of the ports in the Verilog prototype do not matter, but it is preferable for documentaion purposes to have them being the same.
ii) SystemC modules shall have one bit ports of class sc_logic only. Class sc_bit is not supported at this time and class sc_lv shall not be used for vectors of one bit.
iii) SystemC modules shall have ports that are vectors of strictly more than one bit of class sc_lv only. Class sc_bv is not supported at this time.
iv) The size of SystemC port vectors shall not be more than 80,000 bits per port.
v) The Verilog prototype of SystemC modules shall have vectors declared in ascending order only.
All the options available can be passed to the simulator. They will affect only Verilog modules. One can provide tracing information to the SystemC simulator by editing the file fintemp/mixed_sc_gen.cpp and inserting tracing-related calls in sc_main.
Note: An example of a simulation involving Verilog modules that instatiate SystemC modules is provided in the distribution under demo/demo_systemc.
Once the design has compiled successfully, a simulator can be built by invoking the simulation builder, finbuild. Simulators can be built to run stand-alone or integrated into a waveform display interface.
The process of building the simulator includes the compilation of the generated `C' file(s), linking the object file(s) with the simulation kernel, appropriate waveform interface and PLI object files if any. Compilation of `C' files can be performed on a single machine (default) or across a network of homogenous machines.
Compilation on a single machine can be performed sequentially or concurrently. In the latter case, the user has the option to specify how many compilation tasks can be launched at a time. This can speed up compilation time dramatically. However, more memory is utilized since there are more processes running. Concurrent compilation may not be faster than sequential compilation when the system does not have enough memory and/or there are too many processes running which overload the system and increase disk swapping activity.
Network compilation allows the simulation builder to spawn compilation tasks across many homogenous machines on the network. It is important that all machines specified have the same architecture. In the default mode, the simulation builder does not attempt to check whether the specified machine is valid or whether it has the same architecture as the others. To enable checking of the specified machines used for network compilation, one must specify the option `-hostchk'. This option must be specified before any machine name is specified.
Once the simulator is built, it is stored under the name:
<design name>.exe (for Windows)
The simulation builder obtains the design name from either the default name "TOP" or from the user invocation option `-des <name>'. Its name is then compared with the design name stored in the design file. If they are the same, the simulator can be built. If one changes the default design name when invoking the Verilog compiler, it is also necessary to specify that design name when invoking the simulation builder. If the default design name is always used when invoking the compiler, then it is not necessary to specify the design name when invoking the simulation builder.
All messages generated by the simulation builder are stored in the log file `finbuild.log'.
All messages generated by the host C compiler are stored in the log file `compile.log'.
The Super-FinSim simulation builder, finbuild, is invoked as follows:
-help : Display invocation options.
-pch : Use precompiled header files.
-static : Use the static library of FinSim.
-verbose : Display compilation command string.
-clean : Remove generated `C' and object files.
-des <name> : Specify the name of the design.
-td <dir> : Specify the working directory.
-relpath : Use relative paths for include directories, object files etc.
-lic <file> : Process the licensing from a specified license file.
-lic_type <100K|50K|25K|2K> : Use the license for the specified product.
-driver : Generate driver file.
-vt : Link simulator with Veritool's PLI interface.
-H<host> : Add remote host for network compilation.
-C<compiler> : Specify the name of the compiler.
-L<linker> : Specify the name of the linker.
-O<level> : Specify optimization level for C compilation.
-hostchk : Check the validity of the hosts entered.
-concurrent <num> : Compile all modules concurrently (Unix only)
-seq : Compile all modules sequentially.
+<option> : Specify additional compilation option.
-um <name> : Use specified name instead of main(). For users who supply their own main() function.
Once the simulator is built, one can remove all the `C' and object files by specifying the invocation option `-clean'. These files are not needed to run the simulation but are required if the incremental recompilation feature will be used subsequently.One must never delete the elaboration data files prior to simulation because they are required by the simulator.
In order to support PLI, the compiler needs to obtain information about the user tasks and functions. Since this information is provided in the standard PLI table veriusertfs, a mechanism is required to link it into the compiler.
Super-FinSim provides two methods of doing this. The first method is the use of a Fintronic PLI table. This is an ASCII text file containing information about the user PLI tasks and functions. This table can be created manually or it can be generated automatically. The second method is to build a custom compiler. This is achieved by linking all the user PLI object files with a custom compiler library.
A sample `C' interface file, `veriuser.c' is provided in the directory $FINTRONIC/include.
The Fintronic PLI table can be created manually or automatically. The table consists of one entry for each PLI task or function. Each entry has the following format:
`NAME' is the name of the routine used in the Verilog source, e.g. $myplifunc
`TYPE' can be one of the following
task: Specify a user defined task.
func_real: Specify a user defined function returning a type real.
func_sized_[dd]: Specify a user defined function returning a value whose width is [dd], e.g. func_sized_32
Verilog style comments may be inserted anywhere within the table.
To construct the Fintronic PLI table manually from a standard PLI table, veriusertfs, perform the following steps:
userfunction -> func_sized_[dd]
io_printf("$my_func is called\n");
io_printf("mytask is invoked.\n");
******************* Entry definition ************************
*************************************************************
{type, data, checktf, sizetf, calltf, misctf, tfname, forwref},
{usertask, 0, 0, 0, mytask, 0, "$mytask", 0},
{userfunction, 0, 0, myfuncsize, myfunc, 0, "$myfunc", 0},
/* all entry must be entered before this line */
{0, 0, 0, 0, 0, 0, 0, 0} /* this must be the last entry */
The Fintronic PLI table can be built automatically by performing the following steps:
setenv FINUSERPLIOBJ "veriuser.o mypli.o"
make -f $FINTRONIC/include/MakeTAB
If the PLI definition file, finpli.mak is used, step 4 must be run as follows:
The custom compiler can be built in 2 ways. The first method is the use of environment variables FINUSERPLIOBJ, FINUSERPLILIB, and FINUSERPLIDLL as shown below:
setenv FINUSERPLIOBJ "veriuser.o mypli.o"
make -f $FINTRONIC/include/MakePLI
The second method uses a PLI definition file named `finpli.mak'. This file contains the definitions of FINUSERPLIOBJ, FINUSERPLILIB, and FINUSERPLIDLL similar to method 1. In addition, dependencies among the PLI source code and header files can be specified.
The custom compiler can then be built as follows:
make -f $FINTRONIC/include/MakePLII
The only difference between the makefile, `MakePLI' and `MakePLII' is that the latter includes the PLI definition file. The default rule to compile the PLI source code is defined in the makefile itself. If the PLI definition file is used, it is possible for one to override the default compilation rule.
The custom compiler is named `vc' by default. This name can be changed by either modifying the makefile itself or by overriding the default compiler name on the command line as shown below:
make -f $FINTRONIC/include/MakePLI FINVC=<compiler name>
Note: It is not necessary to rebuild the custom compiler if only the body of the PLI code is changed. However, it is necessary to rebuild the custom compiler if the functional interface is changed such as the width of the value returned by a PLI function.
Whenever PLI is utilized in the design, the simulation builder will obtain the information of all the PLI object files from either the PLI definition file or the environment variables FINUSERPLIOBJ, FINUSERPLILIB and FINUSERPLIDLL. If the PLI definition file is found in the current path, the simulation builder will always use it first even if the PLI environment variables are also defined.
For an example on how to link in a PLI application, run the example in the demo_pli directory in the Super-FinSim distribution.
Super-FinSim allows the user to link in multiple PLI applications eachwith its own veriusertfs table without having to manually merge the tables. To do so, please follow these steps:
1. Link your PLI application into a shared library.
For gcc, you can do this by passing the -shared option:
gcc -shared pli1.o <other pli objects/libraries> -o pli.so
2. Call finvc with as many tab files as needed. Please note that you may choose to create only one tab file if you want but this is not necessary:
finvc -ptab pli1.tab -ptab pli2.tab <other -ptab options> ...
3. Set the variable FINUSERPLIDLL to include all the shared PLI libraries.
If you are setting this variable via the enviroment:
setenv FINUSERPLIDLL "pli1.so pli2.so <other shared PLI libraries>"
If you are using the finpli.mak file:
FINUSERPLIDLL = pli1.so pli2.so <other shared PLI libraries>
4. Run finbuild with your regular options:
5. On Unix/Linux systems set the environment variable LD_LIBRARY_PATH to the paths where your shared PLI libraries reside:
setenv LD_LIBRARY_PATH <path to pli1.so>:<path to pli2.so>:<path to other shared PLI libraries>:$LD_LIBRARY_PATH
6. Run TOP.sim (or whatever the name for the simulator you chose) with the extra +veriuser+<name of shared PLI library> options:
TOP.sim +veriuser+pli1.so +veriuser+pli2.so <+veriuser+other shared PLI libraries> <other simulation options>
The simulator is invoked as follows:
# <design name>.sim <simulator options>
The simulator invocation options can be specified in any order. A few examples of simulator invocations are:
# FDC.sim -r 5000 -script scriptfile
-b : Build the simulation data structure only.
-r <time> : Run simulator for a specified time.
-i : Run simulator in interactive mode.
-delta <value> : Specify the maximum delta during a time cycle.
-deltastop : Interrupt the simulation if delta reached its maximum value.
-t <traceFile> : Trace signal specified in Fintronic Trace File.
-wave : Invoke real time waveform display.
-log <logFile> : Create simulation log file.
-key <keyFile> : Create simulation key file.
-script <scriptFile> : Read interactive command from a file instead of standard input.
-nolibcell : Disable cell instance from library.
-notimechk : Disable timing check.
-notimechkm <module> : Disable timing check on a specified module.
-notimechki <instance> : Disable timing check on a specified instance.
-nowarning : Suppress warning messages.
-nofillmemwarning : Suppress warning messages regarding over or underfilled user memories
-noannotate : Disable back-annotation through PLI or SDF.
-nopath_cond : Ignore the SDPD condition.
-path_edge : Enable the edge condition.
-nopulsemsg : Disable warning messages about pulse control errors.
-pulse_reject : Global path pulse control (0 - 100) : reject limit.
-pulse_error : Global path pulse control (0 - 100) : error limit.
-path_cond_edge : Do not ignore the edge condition if both SDPD and edge conditions are provided.
-fastgate : Speed up gate level simulation.
-fastca : Speed up continuous assignment.
-nodriverchk : Disable check for net having no driver to it
-ncols <num> : Specify the number of columns, <num> per line to be printed in waveform.
-sdfmsglevel <level> : Specify the level of sdf error message. The default value is 0.
-vectored_net : By default, do not expand a vector net.
-scalared_net : By default, always expand a vector net.
-verbose : Display debugging information about the simulator.
-msgx : Display simulation messages in the compatibility mode.
-c : OVIsim compatibility mode.
-acc : Simulate in accelerated mode.
-td <directory> : Specify the working directory of the simulator.
-lic <file> : Process the licensing from the specified license file.
-lic_type <100K|50K|25K|2K> : Use the license for the specified product.
-vmemd : Specify the directory in which the virtual memory file should be created.
-dumpd : Specify the directory in which the dump file should be created.
The simulator can be executed in either batch or interactive mode. If both simulation modes are specified, the interactive mode will be selected.
The simulator must never be invoked using the UNIX input redirection such as below:
Doing so will cause the simulator prompt to be printed in an infinite loop. Instead, input can be specified using a script file as described in the next section.
Batch simulation allows one to simulate a design without user interaction. The maximum duration of the simulation may be specified with the invocation option `-r <time>'. If the batch simulation time and the interactive mode option `-i' are not specified, the simulator will also run in batch mode. When this occurs, the simulator will run until the design has stabilized.
Interactive simulation allows the user to interact with the simulator under a command shell. The interface consists of a set of interactive commands which perform various functions such as running the simulator, setting breakpoints, displaying or modifying signal's value, etc. All the available interactive commands are described in Chapter 7 on page 34.
The simulator is started in the interactive mode only if the invocation option `-i' is specified. It has higher precedence over batch mode.
For convenience, script files are supported to provide an alternate method of entering interactive commands. A script file can be specified whenever the simulator is invoked in the interactive mode. Since all interactive commands are saved in a simulation key file, `finsim.key', it is possible to reproduce the last simulation run very easily.
Super FinSim can save the state of the simulator and restart thesimulator later on. Both save and restart operations are performed atvery high speed (e.g. 5-6 seconds for saving and 2-3 seconds forrestarting simulation images of 256MB). This feature can be used both to recover after a hardware failure, or to bring the simulation in a certain state, save it and then restart it on many machines simultaneously in order to perform various tests with different stimuli starting from the desired state. This way one does not need to repeat the part where the simulation is brought in the desired state. As an example, one may wish to save the state after the boot cycle is completed and then restart it in order to perform the various tests.
FinSim allows the user to save the state of a simulation in one of two ways. For both cases the user first edits a command file with all the command line options for the simulator and runs the simulation using "-cf <file>"
a. Using the $save("suffix") system task.
The user inserts in the Verilog design at the desired time(s) calls to the system task $save. The simulation is saved in the file(s) finstate.<suffix> on Linux and <name of original simulator>.<suffix> on Solaris.
b. Using the interactive command save <suffix>
In the interactive mode the user issues the command save <suffix>. The simulation is saved in the file(s) finstate.<suffix> on Linux and <name of original simulator>.<suffix> on Solaris. To get to the interactive mode, one can either start the simulation in the interactive mode from the beginning with the "-i" option (specified in the command file), or can insert a $stop in the Verilog source code or can type a CTRL-C while a batch simulation is running.
The following notes apply to saved simulations regardless of how they were saved except where noted.
The simulation state is always saved at the end of the current simulation time. If the design has PLI all misctf routines are invoked with reason 'reason_save'. All of the user's PLI data structures in memory are saved and restored automatically by FinSim however, the user is responsible for saving the state of any file/socket opened using PLI when the misctf routine is called with reason 'reason_save'.
In the interactive mode, if the <suffix> is omitted, the state will be saved in finstate.sav on Linux and <name of original simulator>.sav on Solaris. The system task $save requires a string as its only argument.
To restart a saved simulation, the user has to set the environment variable FIN_RESTART_ARGS to "+fin_restart+<suffix> -cf <file>" and call TOP.sim:
#setenv FIN_RESTART_ARGS "+fin_restart+<suffix> -cf <file>"
#set FIN_RESTART_ARGS="+fin_restart+<suffix> -cf <file>"
<suffix> is the suffix of the saved simulation and <file> contains all command line options for TOP.sim. FinSim allows the user to provide extra plus arguments when the simulation is restarted. This is useful for instance when the design is written such that it generates/applies different test vectors based on one or more plusargs provided at runtime. The user can save the state of the simulation when the initialization sequence is complete and restart the same saved simulation multiple times each with different plus arguments causing the test bench to generate/apply different testvectors for each run. Please note that in order for plus arguments to be evaluated at runtime, the design must be compiled with the option +no_plusargs_substitution to finvc. All plus arguments should be specified in <file>. All other arguments specified when the simulation is restarted will be ignored since the ones in the original run have already been evaluated and are therefore part of the saved image.
If the design has PLI all misctf routines are invoked with reason 'reason_restart'. All of the user's PLI data structures in memory are restored automatically by finsim, however the user is responsible for restoring the state of any file/socket opened using PLI in the initial run when his misctf routine is called with reason 'reason_restart'.
IMPORTANT: Please note that in order to run a new simulation, one has to unsetenv FIN_RESTART_ARGS to avoid restarting a saved one.
Super-FinSim's simulator can be interfaced directly to a real time waveform display through a procedural waveform interface. While the simulator is running, value changes on traced signals are registered directly to the waveform display using inter-process communication.
In addition to the standard output, simulation results are stored in a log file whose default name is `finsim.log'. The log file can be renamed with the option `-log <filename>' or by using the Verilog system task $log.
All interactive commands entered during the simulation are saved in a simulation key file whose default name is `finsim.key'. The key file can be renamed with the option `-key <filename>' or by using the Verilog system task $key.
If the design uses SDF, a log file `finsdf.log' is created to store the messages produced by the SDF compiler.
The simulator can be interrupted with `Ctrl-C' or `Ctrl-Z'. Once interrupted, the simulator enters the interrupted interactive mode. Most interactive commands can be executed in this mode except for `run', `monitor', `force' and `release'. The interactive command `cont' can then be used to continue the simulator.
The simulator also enters the interrupted interactive mode whenever the Verilog system task $stop is executed.
To distinguish between the interactive mode and the interrupted interactive mode caused by Ctrl-C/Ctrl-Z or with the Verilog system task $stop, the simulation kernel displays the interactive prompt using the following convention:
The simulator terminates when one of the following occurs:
If the simulator is started in the interactive mode, a shell prompt is provided for entering interactive commands. All interactive commands must be entered in lower case. Arguments describing signal names must be entered using the appropriate case as specified in the source code. Other arguments can be entered in either lower or upper case.
An on-line help facility is available by entering `help' at the interactive prompt.
Build the simulation data structures.
Build and initialize the simulation data structures.
Simulate for the specified amount of time.
Execute interactive commands from the specified script file.
Display the simulation data structures.
Read binary data from a file into memory.
Read hexadecimal data from a file into memory.
Display information about a signal.
Display the value of a signal.
display(<format string>, signal)
display the value of a signal similar to $display.
Force a signal permanently to a value
Deactivate a signal that was forced.
Set the value of system environment variables.
Display the value of all system environment variables and the status of the simulator.
Display the current simulation time.
Display the version of the simulation kernel.
Display an on-line help message for the specified interactive command.
Change the current interactive scope.
Display objects declared in the current scope.
Display all the registered user defined PLI functions/tasks
Create a new log file or enable writing to an already open log file.
Disable writing to the log file.
Create a new key file or enable writing to an already open key file.
Disable writing to the key file.
Create a break point on a signal value change. A signal transition can be one of the following: posedge, negedge, tox, toz, change.
Create a time break point. Time break points can be either absolute or relative to the current time and they occur either at the beginning (abstimebf, reltimebf) or at the end of the time (abstimeaf or reltimeaf) cycle.
Display list of current break points.
breakon [<break_point_number>...]
Enable the specified break points. If no argument is specified, all break points will be enabled.
breakoff [<break_point_number>...]
Disable the specified break points. If no argument is specified, all break points will be disabled.
breakclr [<break_point_number>...]
Remove the specified break points. If no argument is specified, all break points will be removed.
Monitor the specified signals on the waveform display.
Monitor all signals on the waveform display.
Terminate monitoring of specified signals on the waveform display.
Terminate monitoring of all signals on the waveform display.
Enable monitoring of all monitored signals on the waveform display
Disable monitoring of all monitored signals on the waveform display.
Create or display command aliases.
readmem[bh] <file> <memory> [start_address [finish_address]]
Read values from the specified file into the specified memory. Start address and finish address are optional.
Execute a task defined in the Verilog source code
$<user PLI name>[("argument string")]
Execute a user PLI. The only argument allowed is a string.
Saves the simulation state at the end of the current simulation time. The state is saved in one or more files each of which end with .<suffix>. If the suffix is not specified the string 'sav' is used as the suffix. If the design has PLI all misctf routines are invoked with reason 'reason_save'. All of the user's PLI data structures in memory are saved and restored automatically by finsim, however the user is responsible for saving the state of any file/socket opened using PLI when his misctf routine is called with reason 'reason_save'. Finsim permits the user to provide extra plus arguments when the simulation is restarted. This is useful because the design can be written so that it generates different test vectors based on one or more plus args provided at runtime. The user can save the state of the simulation when the initialization sequence is complete and restart the same saved simulation multiple times each with different plus arguments causing the test bench to generate different test vectors in each run.
This section describes the interactive commands that are used to process the simulation data structures.
This section covers the interactive commands to run the simulator.
When the simulator is interrupted, it displays the current scope.The default current scope when the simulation begins is the scope of the first root module.
The scope in the design hierarchy can be changed with the interactive command `cd'. Like its Unix counterpart, the symbol `.' represents the current path. The symbol `..' represents the parent path. The symbol `/' when used by itself represents the root path. Otherwise, it is used as the hierarchy separator.
Currently, Super-FinSim only allows the scope to be changed one level up at a time. Thus the commands below are invalid:
Object names in Super-FinSim are case-sensitive. Therefore, `abc' and `ABC' are considered to be two different objects. Super-FinSim allows the user to specify the name of a scope to commands that require signal names. Once located, the command is applied to all the signals declared in that scope.
For example, if an instance named `top.U00' has two ports `A' and `B', one can display the value of these two ports as follows:
This is equivalent as entering the following:
The interactive command `info' is used to display information about a signal, including its name, type, range, value, fanout etc.
The interactive command `value' is used to display the value of a signal. If the signal is not of type real, the value will be displayed in binary format. One can change the display format with the command `setenv'.
The interactive command `force' is used to permanently set a signal to a value during the simulation. The force command can be deactivated by executing the `release' command.
The signal value entered in the interactive mode has the following DBOH format:
The first argument is a positive integer representing the width of the DBOH string. The second argument represents the base of the DBOH string. Valid DBOH bases are D, B, O, and H. The last argument represents the value of the DBOH string.
The simulation kernel maintains a few simulation environment variables during the simulation. They are:
The simulation environment variable DBOH is used to specify the format used to display the value of a signal. The default format is binary (B|b). The user can specify other display formats including decimal (D|d), octal (O|o) or hexadecimal (H|h).
The simulation environment variable ECHO is used to determine whether the simulation output is displayed on the console or not. The possible values for ECHO are: {ON |OFF|on|off}, with ON being the default value.
The interactive command `script' is used to read and execute interactive commands from an ascii text file. There should be only one command per line in the script file. Since it is possible for one to invoke a script file within a script file, care must be taken to prevent recursive invocations.
The interactive command `time' displays the current simulation time.
The interactive command `$finish' is used to terminate the simulation. The user can also quit the simulation using the keystrokes `Ctrl-\' or `Ctrl-D'.
Same as the interactive command `$finish'.
The interactive command `log' is used to create a new log file or enable writing to an already open log file. If a log file is currently open and the argument is not specified, that log file will be enabled for writing. Otherwise, the current log file is closed and a new log file will be created.
If there is no open log file and the argument is not specified, a new log file is created using the default name `finsim.log'. Otherwise, a new log file is created using the specified name.
The interactive command `nolog' is used to disable writing to the log file.
The interactive command `key' is used to create a new key file or enable writing to an already open key file. If a key file is currently open and the argument is not specified, that key file will be enabled for writing. Otherwise, the current key file is closed and a new key file will be created. If there is no open key file and the argument is not specified, a new key file is created using the default name `finsim.key'. Otherwise, a new key file is created using the specified name.
The interactive command `nokey' is use to disable writing to the key file.
The interactive command `pd' is used to display simulation data structures.
Super-FinSim provides an on-line help facility similar to Unix man pages. This facility is provided through the interactive command `help'.
The interactive command `help' is used to display an on-line help message about an interactive command. The syntax is follows:
If <command> is not specified, the list of all interactive commands will be displayed.
The interactive command `history' is used to display the history of interactive commands. To execute the last command, enter the command `!!'. To execute the nth command, enter `!<n>'. When executing the command history, one can pass additional arguments if needed.
Command aliases are used to create abbreviations of commonly used interactive commands. The interactive command `alias' is used as follows:
alias Display the list of command aliases
alias <name> Display the value of the command alias <name>
alias <name> <value> Create an alias <name> with the value <value>.
When executing aliases, one can pass additional arguments if needed.
FinSimMath's creation was motivated by the need for having mathematical modeling within the Verilog language. This language was designed with the intent that (1) no explicit conversion functions are necessary, (2) runtime changes of formats including the number of bits of the various fields are supported, and (3) data in multi-dimensional arrays are easy to access globally.
FinSimMath suports a large number of mathematical system tasks, and provides access to information regarding the occurrence of overflow, underflow, maximum number of bits needed, and cummulative error.
FinSimMath is an extension of the IEEE std 1364 Verilog language which supports also the types VpDescriptor, VpReg (for variable precision objects), VpComplex, VpPolar, VpFComplex, and VpFPolar types. Logical, Arithmetic and assignment operators are defined to operate on all combination of these types including on arrays and matrixes.
Objects of the variable precison types VpReg, VpComplex, and VpPolar can have their formats (fixed or floating) and the sizes of the format fields modifiable at runtime. This allows for a tight loop in finding optimal formats and sizes of sub-fields, given various costs based on computation accuracy, overflow avoidance, quantization noise, power consumption (switching activity), or other resource constraints.
Global writing to and reading from multi-dimensional arrays are supported using positional system tasks for each range within the system tasks $InitM and $PrintM.
A general form of aliasing using positional system tasks for each dimension of a multi-dimensional array is introduced with the View as construct, enabling to separate data from its location.
A rich mathematical environment is available based on a number of system functions and tasks, including: $VpSin, $VpCos, $VpTan, $VpCtan, $VpAsin, $VpAcos, $VpAtan, $VpActan, VpSinh, $VpCosh, $VpTanh, $VpCtanh, $VpAsinh, $VpAcosh, $VpAtanh, $VpActanh,$VpPow, $VpPow2, $VpLog, $VpLn, $VpAbs, $VpFloor, $VpHypot, $Fft, $Ifft, $Dct, $Idct, etc.
where both p and k are integers.
The value p is allways encoded using some or all the bit values of the VP register.
The encoding scheme for p is present in a descriptor that is associated to the VP register. That descriptor also contains all or part of the information about the value of the exponent k, whose value is in general given the difference between two terms k_fix and k_float. The value of k_fix depends only on information provided in the descriptor, it is not encoded in the bits of the VP register, and can be modified only by changing the descriptor. The value of k_float is encoded using the bits of the VP register and it is often changed during VP register manipulation.
If the descriptor contains all the information about the exponent k (meaning that k_float=0 at all times) the associated values are fixed point values, and the format is a fixed point format. Otherwise, if there is a field in the VP register which encodes k_float using the VP register bit values, the associated values are floating point values, and the format is a floating point format. Under special circumstances, some combination of bit values in the VP register represent special values that are not numeric values. Hereafter, when there is no possible confusion we will refer to the "VP register associated numeric value" as the "numeric value of the VP register". A VP register can also be used as a regular Verilog register and assigned to registers and nets.
The conventions used to declare a VP register, specify the encoding of p, the value of k_fix, the encoding of k_float, the special values and other restrictions are presented in See Specifying VP objects.. The set of available functions and overloaded operations are presented in detail in See VP register manipulation.. Conventions about evaluation of expressions containing VP register elements are presented inSee I/O is not supported in FinSim 8.x for VP registers. However, by using assignments to and from Verilog registers and using Verilog 2001 I/O for Verilog registers, I/O can be performed for VP registers, albeit in an indirect way... See I/O is not supported in FinSim 8.x for VP registers. However, by using assignments to and from Verilog registers and using Verilog 2001 I/O for Verilog registers, I/O can be performed for VP registers, albeit in an indirect way.. contains useful examples uisng the VP register features.
There two kinds of VP data containers: registers and wires. VP registers contain values and have associated to them information regarding the format, number of bits used to by the various parts corresponding to the given format (e.g. exponent and mantisa), as well as information regarding rounding and overflow options. VP wires contain values but do not contain any information regarding format, rounding or overflow.
The following four steps are required before using a VP register:
Step 1: Declare a VP descriptor
Step 2: Declare a VP register as data holder
Step 3: Set the descriptor information
Step 4: Associate descriptor to data.
The only order constraints between the steps above are that step 4 should be performed after step 1 and step 2, and step 3 has to be performed after step 1 was performed.
Registers are declared as VP register using the Verilog IEEE std 1364-2001 attribute construct. The attribute varprec is used, having 2 possible values: data and descriptor.
(* varprec = data *) reg [0:511] in1;
(* varprec = descriptor *) reg d1[0:1] d1;
Objects marked with the varprec attribute set to data or declared of type VpReg contain numerical values. The information regarding the format in which the numerical value is represented (i.e. the relation between the numerical value and the bit values of the VP register), as well as the the information regarding the action to be taken in case overflow, or underflow occurs in an operation that assigns to the given VP register is stored in the descriptor that must be associated to any VP register.
VP wires do not have a descriptor associated to them. A VP wire cannot appear in an expression involving more than its name. VP wires are used in order to pass VP values through ports of modules. Wires that are not VP wires are treated as integers when participating in expressions that are assigned to a VP object or that contains a VP object. Therefore, in an assignment to a VP register such as
myWire will be considered an integer, whereas if ti were a VP wire it would be considered to be of the same format and size as myVPreg as in the following example:
It is illegal to have myVPwire declared with a size that is smaller than the necessary number of bits indicated by the descriptor of myVPreg.
i) The size of the register must be chosen such that during the entire simulation it exceeds the number of bits that are necessary to represent the VP register value.
ii) The size of the descriptor register has no particular meaning, however SuperFinsim requires a size of at least two bits.
A descriptor can be associated to any number of VP registers using the system task
$VpAssociateDescriptorToData(myVPreg, myVPregDescriptor);
For each VP register there must be exactly one call associating to it a descriptor. This call must occur in the module in which the VP register is declared.
The various fields of a descriptor are integers which can be can be modified at runtime any number of times using the system task $VpSetDescriptorInfo(<myVPdescriptor>,<size1>, <size2>, <format>, <roundingOpt>, <overflowOpt>, <miscOpt>).
8.3.2.1 Setting Format and Sizes
The format field can have the following values:
1 - indicates two's complement
4 - indicates floating with no denormals
In case the format is two's complement size1 and size2, if they are both positive, represent the number of bits of the integer part and the number of bits of the fractional part (refered to also as decimal part) respectively. It is illegal for both sizes to be negative. If one is negative the part to which it corresponds (integer or fractional) has zero bits representing it and the other part is represented by a number of bits equal to the sum of the absolute values of the two sizes, with the restriction that no information can be stored in the bits corresponding to the negative size which are located at the border to the other part (i.e. if the integer size is negative the most significative -size1 bits of the fractional part will not be used to store information even if an overflow must be reported. Similarly, in case size2 < 0 the least significative -size2 bits of the integer part will not contain any information even if an underflow must be reported.
In case the format is either floating or floating with no denormals the two sizes must be positive, with size1 representing the number of bits of the sign and the exponent and size2 representing the number of bits of