nimble install svvpi
Get Nim installation (which includes nimble
) from
https://nim-lang.org/install.html.
User needs to have access to some Verilog/SystemVerilog simulator supporting VPI, like Cadence Xcelium.
vpiDefine task <sys task>:
setup: # optional
# declarations of consts that you want to be made available to all procs
compiletf: # optional
# body of compiletf proc
calltf:
# body of calltf proc
userdata: # optional
# string
more: # optional
# further code like callback proc definitions and registering those.
At minimum, only the calltf
is needed. Here’s one example:
vpiDefine task hello:
calltf:
vpiEcho "Hello!"
vpiDefine function <sys function>:
setup: # optional
# declarations of consts that you want to be made available to all procs
compiletf: # optional
# body of compiletf proc
calltf:
# body of calltf proc
functype: # optional
# Valid values: vpiIntFunc, vpiRealFunc, vpiTimeFunc, vpiSizedFunc, vpiSizedSignedFunc
# If this is not specified, and sizetf is not specified, it defaults to vpiIntFunc.
# If this is not specified, but sizetf is specified, it defaults to vpiSizedFunc.
sizetf: # optional
# integer
# If this is specified, but functype is not specified, the latter defaults to vpiSizedFunc.
userdata: # optional
# string
more: # optional
# further code like callback proc definitions and registering those.
At minimum, only the calltf
is needed. Here’s one example:
vpiDefine function hello:
calltf:
vpiEcho "Hello!"
Variable | Description |
<100> | |
---|---|
userData | If a vpiDefine has set userdata: <some string> , that string is available as this variable inside compiletf: , calltf: and sizetf: . |
systfHandle | This VpiHandle variable is available inside compiletf: and calltf: . |
tfName | This string const is the task/function identifier with a $ prefix. So if you have vpiDefine task mytask , this variable is set to $mytask . This variable is available anywhere in the vpiDefine scope. |
See my nim-systemverilog-vpi repo for example uses of vpiDefine
.
Calling this template raises a VpiTfError
type exception.
Example usage:
if argIter == nil:
vpiException &"{tfName} requires 1 argument; has none"
- Cadence Xcelium
- 20.09-s09
- OS
- CentOS 7.6
- Nim
- 1.5.1 as of 2021-04-30 Fri.