Commit Graph

70 Commits

Author SHA1 Message Date
Cary R bb58ace6d6 Update __vpiHandle to use class vs struct
The clang compiler does not like mixing class and struct references. This
patch updates all the struct __vpiHandle, etc. to use class since that is
how they are now defined.
2012-01-21 14:50:27 -08:00
Cary R 6a99520fa6 Add string display for vpiEnumTypespec and create hook for UdpDefn iteration.
This patch adds vpiEnumTypespec to the list so that vpi_get_str(vpiType, ...)
returns an appropriate string when an enum type is passed.

It also adds the initial hook to allow iteration (global) over the UDP
definitions. This along with table traversal will be needed to free the
memory allocated when the UDP definition is created. Ultimately this
will all the UDP test to be valgrind clean.
2011-10-14 18:20:23 -07:00
Martin Whitaker 7e66947f2c Fix vpiUserDefn definition in vpi_user.h.
This patch changes the code value for vpiUserDefn to match the IEEE
standard.
2011-10-14 17:48:22 -07:00
Cary R 06447817d3 Add support for tracing procedural statements.
This patch adds support for tracing procedural statement execution in vvp.
This is accomplished by adding a new opcode that is inserted before the
code that represents a procedural statement. These opcodes also trigger
a message whenever time advances. By default these opcodes are not added.
To add them, pass the -pfileline=1 flag to the compiler. In the future we
may add support for turning the debug output on and off once the opcodes
have been added with a system task or from the interactive prompt.
2011-03-01 18:45:29 -08:00
Larry Doolittle 186779c29b fix boring C lint in header
With warnings turned sufficiently high in gcc, I get:
  .../vpi_user.h:568: warning: function declaration isn't a prototype
when building VPI modules.  Patch is trivial.
2010-11-18 16:49:06 -08:00
Larry Doolittle 5d977cac73 Brainless start to const-correct changes
Results of running
cd vpi
for f in *.c *.h; do sed -i \
  -e "s/_calltf(PLI_BYTE8/_calltf(ICARUS_VPI_CONST PLI_BYTE8/" \
  -e "s/_compiletf(PLI_BYTE8/_compiletf(ICARUS_VPI_CONST PLI_BYTE8/" $f; done
and a trivial patch to vpi_user.h to, among other things, make
ICARUS_VPI_CONST blank.

Thus, this patch does absolutely nothing.  Will be followed by a
(much shorter) patch that makes it do something.  :-)
2010-10-06 15:08:54 -07:00
Cary R 128f3d29cc Fix new shadow issues and add -Wshadow to gcc compile.
Some new shadow issues have crept in. This patch fixes these new
issues and adds -Wshadow to the normal warning flags to keep any
new occurrences from happening.
2010-05-13 19:04:13 -07:00
Cary R f2d5acabd5 Add support for vpiUserSystf iteration, etc.
This patch adds support for iterating over the list of vpiUserSystf
tasks/functions that have vpiUserDefn set. The vpiUserDefn property
is true by default, but you can call vpip_make_systf_system_defined()
to set this property false (will hide the vpiUserSystf object). All
the normal system tasks/functions have been modified to call this
procedure to remove them from the list of vpiUserSystf objects. Only
user defined system tasks or functions should appear in the list.

vpi_compare_objects() is just a simple are the two pointers the
same. This works correctly for the vpiUserSystf objects, but the
other handle objects have not been checked.
2010-04-13 20:54:59 -07:00
Cary R aa1cd1646c Add preliminary support for vpiUserSystf, vpi_get_systf_info(), etc.
This patch changes system tasks and functions to use the vpiUserSystf
property and returns this information when vpi_register_systf() is
called. It also adds the vpiUserDefn property for system tasks and
functions which for now always returns 1 (true). System task and
functions can now get a handle to this information using the
vpiUserSystf property. vpi_systf_info() returns pointers to the
real data so the user will need to be careful when using the pointer
fields (e.g. tfname, user_data, etc.). This is a shallow copy. A deep
copy would require the user to free the various fields and I'm not
certain it is even possible or desirable to copy the user_data for
all cases.

A stub for vpi_compare_objects() was also added since I will need
that when testing the second half of the patch (add iteration over
all the vpiUserSystf objects and add a method to control vpiUserDefn).
2010-04-13 20:54:43 -07:00
Cary R 07bedc4e35 Add support for passing the delay selection to the VPI interface.
This patch adds support for passing the delay selection to the
VPI interface. It adds a new property to both the vpi_get and
vpi_get_str calls to return the current delay selection. It also
defines three constants for minimum, typical and maximum
delay selections.
2010-03-16 15:43:14 -07:00
Stephen Williams 711365521d Fix vpi_control operation codes to be standard
Apparently, the vpi_user.h definitions for vpiStop et al were added
before they were standardized by 1364-2000, and never corrected.
Change the values to be standard. (Submitted by Matt Trostel.)

I also added some binary compatibility for existing .vpi modules
that were compiled with the older constant values.
2009-10-29 11:16:26 -07:00
Cary R 7e3a7b87ff Add basic support for events and cleanup VCD dumper.
This patch adds support for dumping named events to the VCD
dumper only. The LXT and LXT2 will be added once this has
been tested more. It also reworks the $dumpvars routine
to be more consistent concerning warning messages for duplicate
signal dump requests and fixes some bugs.

For events you will get extra events at T0 and at $dumpon. I
plan to fix this, but that is much more involved.

For duplicate signal warnings. Implicit duplicates loaded
automatically from a scope will not display a warning. Only
an explicit signal request will print a warning if it was
already included. All other will be silently ignored. This
should limit the warning to only what the user cares about.

For example:

  $dumpvars(0, var, scope_that_includes_var);

Will work without a warning message.

  $dumpvars(0, scope_that_includes_var, var);

Will generate a warning since the var was already included
by the scope request.

Other enhancements include the start of including type
information in the output. For now integer is added, the
other type information will require changes to the code
generator and hence will only be done in development.
2009-07-03 19:38:15 -07:00
Cary R 636758f66d Add support for `celldefine, vpiCellInstance
This patch adds real functionality for `celldefine and pushes this
property to the run time which can access this with vpiCellInstance.
This is technically only available for a module, but all scopes
have the property and only modules should return true when the
'endmodule' is between a `celldefine and `endcelldefine directive.
2009-05-23 14:13:47 -07:00
Cary R 82805b9351 Add compiletf routines for the scanf functions.
This patch adds compiletf routines for the $sscanf/$fscanf
functions. It does not enhance the conversion routines it
only adds better error/warning messages.

It also removed the redundant IS_MCD in some of the fileio
calltf routines. This is already checked in vpi_get_file().

I also added the vpiNetArray type to allow us to distinguish
arrays of nets from other arrays (memories). Much more is
needed here, but this solved the problem of the day. The
problem was that we needed to make sure we could assign to
the word of a variable array, but not the word of a net array.
It's actually probably not needed since Icarus converts the
net array word reference to just the net, but I thought it
prudent to make sure things didn't slip by.
2009-02-27 18:00:59 -08:00
Cary R c8cb024cb2 Move the vvp private properties to vvp/vpi_priv.h
This patch moves the vvp private properties from vpi_user.h to
vvp/vpi_priv.h.
2009-02-01 06:55:51 -08:00
Cary R 7b1905b997 Add memory freeing and pool management for valgrind.
This patch adds code to free most of the memory when vvp
finishes. It also adds valgrind hooks to manage the various
memory pools. The functionality is enabled by passing
--with-valgrind to configure. It requires that the
valgrind/memcheck.h header from a recent version of
valgrind be available. It check for the existence of this
file, but not that it is new enough (version 3.1.3 is known
to not work and version 3.4.0 is known to work).

You can still use valgrind when this option is not given,
but you will have memory that is not released and the
memory pools show as a single block.

With this vvp is 100% clean for many of the tests in the
test suite. There are still a few things that need to be
cleaned up, but it should be much easier to find any real
leaks now.

Enabling this causes a negligible increase in run time and
memory. The memory could be a problem for very large
simulations. The increase in run time is only noticeable on
very short simulations where it should not matter.
2009-02-01 06:55:28 -08:00
Martin Whitaker 18edf2f15f Rework of automatic task/function support.
This patch splits any VVP net functor that needs to access both
statically and automatically allocated state into two sub-classes,
one for handling operations on statically allocated state, the
other for handling operations on automatically allocated state.
This undoes the increase in run-time memory use introduced when
automatic task/function support was first introduced.

This patch also fixes various issues with event handling in automatic
scopes. Event expressions in automatic scopes may now reference either
statically or automatically allocated variables or arrays, or part
selects or word selects thereof. More complex expressions (e.g.
containing arithmetic or logical operators, function calls, etc.) are
not currently supported.

This patch introduces some error checking for language constructs
that may not reference automatically allocated variables. Further
error checking will follow in a subsequent patch.
2008-10-29 20:43:00 -07:00
Larry Doolittle 66949122cf Non-controversial whitespace cleanup
Nothing to do with tab width!  Eliminates useless
trailing spaces and tabs, and nearly all <space><tab>
pairings.  No change to derived files (e.g., .vvp),
non-master files (e.g., lxt2_write.c) or the new tgt-vhdl
directory.

Low priority, simple entropy reduction.  Please apply
unless it deletes some steganographic content you want
to keep.
2008-09-04 21:31:30 -07:00
Cary R 5e512e6570 Finish $clog2 function.
This patch fixes problems in the initial $clog2 implementation
and adds correct functionality to the runtime.
2008-08-20 09:01:21 -07:00
Larry Doolittle d90ce68f5d Spelling fixes
No code changes.
2008-06-10 15:02:18 -07:00
Cary R 2fab3159dd Add smart part select for system functions &PV<>.
This patch adds a smart part select that allows system functions
to have full access to the real bits of the part select.
2008-05-29 09:40:12 -07:00
Cary R 608c2574bd Add $finish_and_return.
This new system task can be used to set the vvp return value
and finish the simulation.
2008-05-22 20:34:38 -07:00
Cary R 86a4025b58 Push file and line information for scopes to the runtime.
This patch adds code to push the file and line information
for scope objects (modules, functions, tasks, etc.) to the
runtime. For modules, this includes the definition fields.
2008-04-29 21:51:34 -07:00
Cary R ef3aacfe36 Make %v print all the bits of a vector.
This patch reworks the %v code to print the strength information
for all the bits of a vector. The code previously only printed
the LSB information.
2008-04-15 17:23:58 -07:00
Stephen Williams e0fbc15bd4 Support vpiForceFlag and vpiReleaseFlag for nets.
vpi_put_value can mimic force and release with vpiForceFlag and
vpiReleaseFlag flags to the vpi_put_value call. With this patch,
the infrastructure is added to allow the flags argument to be passed
to the dispatched put_value function, and for signals handle those
flags as force/release of a net.
2008-03-10 21:54:58 -07:00
Larry Doolittle 39dd22ace4 Adjust unusual spacing
minimal changes, nearly eliminates oddball/inconsistent
source code use of whitespace
2008-02-19 09:15:03 -08:00
Cary R 77061faa5c Add vpiFile and vpiLineNo for system functions.
Add the vpiFile and vpiLineNo properties to system functions.
Most other objects have stubs that return "N/A"/0. Interactive
functions (called from the debugger) use <interactive> for the
file name.
2008-01-01 17:27:03 -08:00
Stephen Williams a14d836be3 Support annotation of edge paths
Parse SDF file annotations of edge sensitive delay paths.
Add vpi support for getting the specified edge sensitivity of
an edge sensitive path, and annotate paths with proper attention
to the edge that is specified for the path.
2007-12-13 20:42:06 -08:00
Cary R 1782175c52 Add vpiArray, vpiParent, vpiIndex to VPI
Add the array related VPI calls. These will be used to generate
the array word name only as needed to conserve space. This patch
also makes scanmem3 from the vpi test work correctly after a
slight gold file update.
2007-12-05 18:37:58 -08:00
Cary R 77ed103682 Add vpiTopModule
This patch adds functionality for vpiTopModule.
2007-11-10 12:09:00 -08:00
Stephen Williams 68cf5baba5 Out path term for modpaths
Add vvp support for modpath path term outputs. This also introduces
the concept of path terms and moves towards the path term in general
for getting at the endpoits of a modpath.
2007-11-02 19:59:08 -07:00
yang yun ju 9d39b3a514 Access to modpaths via VPI
Add support for accessing the modpath nodes via PLI,
and add support for the vpi_set_delays and vpi_put_delays
functions to set the delays on those paths.

- GSoC 2007
2007-09-10 15:30:00 -07:00
Cary R e546a9d5c8 Update the files to use vpi_control vs vpi_sim_control.
vpi_sim_control is no longer part of the standard, so update the code to
use the standard function (vpi_control).
2007-07-19 17:29:05 -07:00
steve 72ec3a2c09 VPI tasks take PLI_BYTE* by the standard. 2007-03-14 04:05:51 +00:00
steve e4ae832153 Clean up spurious trailing white space. 2004-10-04 01:10:51 +00:00
steve 4148a2a44c Better type safety. 2004-09-05 21:29:07 +00:00
steve 20b7a23bde Define function types. 2004-03-09 04:29:26 +00:00
steve 65f09337f6 Add sysfunctype to calltf structure. 2004-02-19 21:32:46 +00:00
steve 1970e41041 Get value for vpoiConstType correct. 2004-01-13 02:55:50 +00:00
steve 1bd1d287e4 tfname can be constant. 2003-12-07 20:06:24 +00:00
steve e88c3a20a2 Details on the vpi_get_file function. 2003-10-30 03:42:51 +00:00
steve cadf4cfdef Spelling fixes. 2003-07-15 03:49:22 +00:00
steve 1c65ea08e8 1) Adds configure logic to clean up compiler warnings
2) adds acc_compare_handle, acc_fetch_range, acc_next_scope and
   tf_isetrealdelay, acc_handle_scope
3) makes acc_next reentrant
4) adds basic vpiWire type support
5) fills in some acc_object_of_type() and acc_fetch_{full}type()
6) add vpiLeftRange/RigthRange to signals
2003-06-04 01:56:20 +00:00
steve 8cfef65bd8 Implement acc_fetch_defname and its infrastructure in vvp. 2003-05-29 02:21:45 +00:00
steve e3e4e648d7 Add vpi_fopen and vpi_get_file. 2003-05-23 04:04:02 +00:00
steve 2e3ce49400 Arrange for mcd id=00_00_00_01 to go to stdout
as well as a user specified log file, set log
 file to buffer lines.

 Add vpi_flush function, and clear up some cunfused
 return codes from other vpi functions.

 Adjust $display and vcd/lxt messages to use the
 standard output/log file.
2003-05-15 16:51:08 +00:00
steve 299f6f8551 acc_fetch_value support for %v format. 2003-04-20 02:49:07 +00:00
steve c37153b604 Verilog 2001 standart types. 2003-03-13 18:26:12 +00:00
steve c2ce8bb26b Add VPI_TRACE tracing of VPI calls.
vpi_handle_by_name takes a const char*.
2003-03-13 04:34:18 +00:00
steve e3dc9ca70b Move _vpiNexisId safely out of the way. 2003-03-12 02:49:38 +00:00