Commit Graph

19 Commits

Author SHA1 Message Date
Stephen Williams 6a0cbc5fa8 VPI access to atom2 types.
Create the .var/2u and .var/2s variable records and give them
basic implementations. Make available to VPI the proper types
for the SystemVerilog types that these variables represent.
2010-10-10 10:06:27 -07:00
Larry Doolittle eaccf4d64f Add possibility of const-correctness
Follow-up to "Brainless start to const-correct changes"
Still actually does nothing, but now if the #define ICARUS_VPI_CONST
in vpi_user.h is changed to const, Icarus is almost const-correct,
as checked with gcc flags -Wcast-qual -Wwrite-strings.

Choosing when to #define ICARUS_VPI_CONST const is left as an
exercise for the reader.

With these two patches applied, and the const define, there are
still about a dozen const problems left.
2010-10-06 15:12:28 -07: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
Larry Doolittle 6388430661 Down payment on const-correctness
Clears out the unambiguous and easy-to-fix const faults,
so we can focus better on the fundamental ones.
2010-09-29 17:15:40 -07:00
Cary R 15a0cf4256 Fix shadow warnings found on OpenBSD.
gcc on OpenBSD reported shadow warnings for variables, arguments named
log, time and exp. This patch renanes those variables to logic, timerec
and expr.
2010-05-28 07:03:02 -07:00
Cary R ddea64445c More compiletf cleanup and refactoring.
This patch adds compiletf routines for the mti random functions
and adds a common routine to check for extra arguments. It also
adds file and line information to the rest of the compiletf
routines that were missing them.
2009-02-26 21:42:32 -08:00
Cary R fa1160c4ab Fix/enhance readmem/writemem routines, etc.
This patch adds compilef routines for the readmemb/h and
writememb/h system tasks. It also fixes some errors related
to arrays with negative range values. You can not specify a
negative address in the file, but arrays with negative range
values or negative start/finish argument to the tasks are
supported. It also generates an error when reading invalid
character from the input file.

A significant amount of the code is common between the two
styles of tasks so this has been grouped into common
routines.

It also adds a common routine for getting a string that will
be used as a file name. This routine is used by any task
that requires a file name value. If a filename has a
non-printable character it will be displayed as a \octal
constant to show what the character is.

Updates the dumping routines to match each other better,
improves some error messages and fixes a bug in the LXT2
dumper when dumping greater than 32 bit delays.
2009-02-26 20:46:02 -08:00
Cary R ebdf4e478a Rework more compiletf and calltf routines in the vpi directory.
This is a major rework on the sys_fileio routines. They now have
improved compiletf routines and the calltf routines are now
standardized. Along the way a few bug were fixed as well. Some
updates to other vpi files as well.

I changed the order of the $fputc() arguments to match C and the
rest of the system functions like it ($fungetc, etc.). I recently
fixed $fungetc() so I'm assuming the $fputc() needs the same fix.
It's an Icarus specific function.
2008-06-14 20:13:52 -07:00
Cary R 7c152685dc Clean up more compiletf routines, etc.
This patch cleans up some of the code to use common compiletf
routines where appropriate. It also adds code to print the
number of extra arguments and cleans up the messages a bit.
2008-06-06 20:44:21 -07:00
Cary R 4010f6e710 Add $simparam and other fixes.
This patch adds $simparam and $simparam$str from Verilog-A.
The analog simulator parameters return 0.0 or N/A. The
vvp_cpu_wordsize system function has been moved into the
$simparam call and is now named CPUWordSize.

This patch also starts the factoring of common code in the
vpi directory. Some routines were renamed.

The priv.c file was renamed to sys_priv.c to match the
include file.

System functions can now have strings put to their output.
2008-06-03 20:56:37 -07:00
Cary R d3880d02c7 Cleanup dumper code (VCD/LXT/LXT2/none)
This patch fixes a number of problems associated with the various dumpers.

1. It catches the problem uncovered in pr1809904 and prevents the core
   dumps from happening. It prints a warning message if you try to change
   the file after the program has started dumping data to the file.

2. It makes all the dumpers work in the same manner. Before the VCD
   $dumpfile was processed at compile time, but the LXT/LXT2 versions
   did this at run time. The correct place for this is the run time so
   that you can pass the task a calculated name.

3. All the dumpers use common compiletf routines located in vcd_priv.c

4. Make the LXT/LXT2 $dumpfile commands only get the file name and
   let $dumpvars actually open the file. This matches the VCD code.

5. Fix the $dumpfile code to allow calculated file names.

6. Make dumpvars without a scope/variable match all toplevel modules
   not just the toplevel module the $dumpvars was located in. This
   now matches the standard (2001).

7. Simplify the no dumper code (vcdoff.c) and add missing functions.

8. Cleanup the code and messages.

9. vvp can take -none for no dumper.
2007-12-13 20:48:16 -08:00
steve 72ec3a2c09 VPI tasks take PLI_BYTE* by the standard. 2007-03-14 04:05:51 +00:00
steve 841378426f Updates for Cygwin portability (pr1585922) 2006-10-30 22:45:36 +00:00
steve 2c7e96caec scanf support for real values. 2006-08-12 03:38:12 +00:00
steve 4987970af4 Give the vip directory its own configure and vpi_config.h 2004-01-21 01:22:51 +00:00
steve 02ec36806c Rearrange fileio functions, and add ungetc. 2003-10-30 03:43:19 +00:00
steve 40daff0aed dumpers must be aware of 64bit time. 2003-09-30 01:33:39 +00:00
steve 889b9bfe07 Use seed to store random number context. 2003-05-14 04:18:16 +00:00
steve dd564ab321 add dumpvars_compiletf to check first argument. 2002-08-15 02:12:20 +00:00