Commit Graph

5609 Commits

Author SHA1 Message Date
Cary R 2fbe7434f2 Use UINT_MAX instead of -1 to set unsigned to maximum value.
The Sun C compiler warns when -1 is used to initialize an unsigned.
(cherry picked from commit 7d588d699b)
2011-10-31 17:23:15 -07:00
Cary R 85faab8a08 V0.9: Reduce the error when scaling a real time value.
When scaling a time value we would often use the power operator to
create constants 10**-N that were then multiplied with the original
value. The problem with this is that there is some errors in the
representation of the fractional number. It is better to create a
integer value 10**N and then divide the original value by this
exact constant. You still have the calculation error, but the scale
value is now an exactly real value.
2011-10-31 10:44:43 -07:00
Cary R e160f5c562 Remove old comment. 2011-10-31 10:40:33 -07:00
Cary R 9481262c06 V0.9: Major rework of the $sscanf()/$fscanf() code.
Add support for %m, suppression '*' and a maximum field width along with
a number of other fixes/enhancements. There is still no support for
%u, %v or %z.
2011-10-31 10:40:27 -07:00
Cary R 3d99bb13c4 Make some messages consistent.
This patch makes some of the VPI messages consistent with the rest.
2011-10-31 10:36:46 -07:00
Martin Whitaker af07b87419 Restore ability to supply LDFLAGS to MinGW configure.
The fix to get a C99 compliant strtod() in MinGW mistakenly set the
LDFLAGS value rather than appending to it. This meant that a LDFLAGS
supplied by the user on the configure command line would be ignored.
(cherry picked from commit c4433e47c1)
2011-10-31 10:30:57 -07:00
Martin Whitaker f4dec1710d Fix for tf_getlongsimtime link error on MinGW/Cygwin.
MinGW and Cygwin don't currently support weak function definitions.
For these platforms, make tf_getlongsimtime a strong symbol.
(cherry picked from commit 7f62579524)
2011-10-26 18:50:02 -07:00
Martin Whitaker fa88ac03dd Workaround for MinGW non-standard strtod.
MinGW has reverted to using the Microsoft msvcrt0 implementation
of the strtod() function. This implementation doesn't accept "INF"
"NaN". MinGW does provide a C99 compliant implementation of this
function called __strtod(). We need to force the linker to replace
all references to strtod() with references to __strtod().
(cherry picked from commit b6cb065404)
2011-10-26 18:49:05 -07:00
Cary R c6bc46b9a4 Update fstapi.c to latest from GTkWave
There was a change in how the FST data was flushed.
(cherry picked from commit 0b978dac48)
2011-10-26 18:48:13 -07:00
Cary R eb5a385433 v0.9: Report that forcing a word to/from a variable array in not supported.
This patch adds error messages that forcing a word to/from a variable
array is not currently supported. This is because variable arrays no
longer are fully populated and don't have an access functor for each
word. Forcing a word from/to a net array does work as expected since
each word in a net array is created.

Technically forcing a variable array word is not supported in 1364-2005.
Reading from an array word, which is supported,  will be fixed in
development once the expression rework is finished.

The error message printed when forcing a bit/part select l-value was
also improved.
2011-10-25 19:43:01 -07:00
Cary R 0ad589eaca V0.9: Improve the out of range check in tgt-vhdl/stmt.cc
Promote the unsigned values to long to get a good comparison and on a
machine where an unsigned is the same size as a long (32 bit) assert
that the unsigned values are constrained to fit into a long. It's unlikely
the values needed to create invalid results would ever happen, but this
patch makes sure it doesn't go undetected.
2011-10-25 19:05:21 -07:00
Cary R 17344563a8 V0.9: Remove some scan-build warnings.
One of these is a real bug, the others are just minor optimizations.
2011-10-20 16:54:50 -07:00
Cary R 617243f298 Update various dumper files from GTKWave SVN
Update some of the files we get from GTKWave to match the latest from SVN.
(cherry picked from commit b9af189229)
2011-10-20 16:51:15 -07:00
Cary R aa1bfafbc2 V0.9: Fix autoconf warning.
This just copies the same change that was done for development over to V0.9.
2011-10-19 18:17:19 -07:00
Cary R 4dae0471de V0.9: Remove some gcc/g++ (4.6.1) warnings.
This patch remove some unused variable warnings found with gcc/g++ 4.6.1
on Ubuntu 11.10.
2011-10-19 18:16:06 -07:00
Martin Whitaker f8bc2b6198 V0.9 Fix for pr3420994.
The VPI object data model diagrams show a one to many relationship
between the "mod path" and "path term" objects. This means that the
correct way to obtain handles to "path term" objects is to use the
vpi_iterate and vpi_scan functions.

Support for the old method of obtaining handles to "path term" objects
using the vpi_handle function is retained for backwards compatibility.
2011-10-19 14:41:42 -07:00
Martin Whitaker 88d845a612 Corrected tf_getlongsimtime() to match behaviour of other simulators.
The PLI tf_getlongsimtime() function is a non-standard function provided
for compatibility with some commercial simulators. To match the behaviour
of those simulators, it should return the raw simulation time, not a
scaled time.
(cherry picked from commit a3813c006d)
2011-10-16 16:36:44 -07:00
Cary R e47f18f79f When printing a Dec numeric value use the string size and the minimum size.
The vpiDecStrVal case for the get_numeric() function needs to use the
existing string width as the minimum result size. -1 can be represented as
a signed value with a width of 1. This gives a display width of -1 which
is too small for the -1 string value. This was creating valgrind issues.
In general the string value should be the minimum so this is a safe change.
(cherry picked from commit 5a9e4aaec7)
2011-10-16 16:34:52 -07:00
Cary R b7b2d710b1 V0.9: Free the iterator if there are extra arguments.
To avoid extra memory usage on error free the iterator if there are
extra arguments.
2011-10-16 16:33:09 -07:00
Cary R f874e81606 Remove two unused argument warnings
(cherry picked from commit dc2c67e25f)
2011-10-16 16:25:38 -07:00
Cary R 78d5b3f278 Update lxt_write and lxt2_write files from GTKWave
Update the lxt_write.[ch] and lxt2_write.[ch] files to the latest from
GTKWave. This is just comment changes.
(cherry picked from commit cff0deeacc)
2011-10-01 09:49:54 -07:00
Martin Whitaker fc8195fd61 V0.9 Remove more clang warnings.
clang warns that the yyinput function generated by flex is never used.
2011-09-25 10:23:41 -07:00
Cary R 4f2a41f186 V0.9: Remove clang/clang++ warnings.
This patch makes the code consistently use struct/class in the C++ files,
it removes a couple shadow warnings and where a class pointer is passed to
the C routines it defines the pointer as a class for C++ and as struct for C.
2011-09-25 10:23:34 -07:00
Alexander Klimov 5c6c8deba3 Fix long division.
On a 64-bit machine the following module shows incorrect division
results:

`define X {4'b 1000, `N'b 0}
`define Y {1'b  1, `N'b 0}
module b;
   reg [`N:0] y = `Y;
   reg [3:0] z1, z2;
   initial begin
      z1 = `X / `Y;
      z2 = `X /  y;
      $display("%3d %b %b", `N, z1, z2);
   end
endmodule // b

$ for N in {60..65}; do /usr/bin/iverilog -DN=$N -oa b.v && /usr/bin/vvp a; done
 60 1000 1000
 61 1000 1000
 62 1000 0111
 63 1000 0101
 64 1000 1000
 65 1000 1000

The first chunk of the patch (result -> tmp_result) fixes this:

$ for N in {60..65}; do iverilog -DN=$N -oa b.v && vvp a; done
 60 1000 1000
 61 1000 1000
 62 1000 1000
 63 1000 1000
 64 1000 1000
 65 1000 1000

The second chunk fixes

`define X 264'h 800000000000000000000000000000000000000000000000000000000000000000
`define Y 192'h c6df998d06b97b0db1f056638484d609c0895e8112153524
module c;
   reg [191:0] y = `Y;
   reg [72:0] z1, z2;
   initial begin
      z1 = `X / `Y;
      z2 = `X /  y;
      $display("%x %x %b", z1, z2, z1 == z2);
   end
endmodule // c

$ /usr/bin/iverilog -oa c.v && /usr/bin/vvp a
0a4c4a2c1dacd76220c 0809033397ca3427927 0

$ iverilog -oa c.v && vvp a
0a4c4a2c1dacd76220c 0a4c4a2c1dacd76220c 1
(cherry picked from commit 766bf45dcf)
2011-09-17 18:57:00 -07:00
Cary R 354abcc9bd V0.9: For MinGW driver report an error if the two \\ are not found in the exe path
We need to print a message and fail if the two \\ characters are not found
in the executable path.
2011-09-11 11:30:21 -07:00
Cary R 662e765dc5 V0.9: For MinGW report an error if the two \\ are not found in the exe path
We need to print a message and fail if the two \\ characters are not found
in the executable path.
2011-09-06 19:31:15 -07:00
Cary R 0af5b0b16e V0.9: Fix verinum negative comparisons.
For mixed sized negative operands the verinum comparisons were sometimes
returning the wrong value.
2011-07-19 20:22:50 -07:00
Cary R bfb1678dee V0.9: Fix incorrect function in tgt-stub/expression.c.
This fixes a bug where the unary expression code was using the incorrect
function to check to see if the data type was real.
2011-06-26 11:28:11 -07:00
Cary R a7645b2191 V0.9: Fix spacing issues. 2011-06-26 11:26:27 -07:00
Martin Whitaker ebfe869067 v0.9 fix for pr3296466.
The compiler was handling bi-directional pass switches using the default
case for primitive gates, where the first port is treated as an output
and the remaining ports are treated as inputs. This patch adds a special
case for pass switches, so that the first two ports are treated as
bi-directional.

This patch also reworks the tran island code to allow it to handle cases
where tran primitives cross-connect different bits of the same vector.
2011-06-12 17:50:15 -07:00
Cary R a59b778d75 V0.9: Always process specparams since they can be used outside a specify block.
The -gno-specify flag should only control the delay and timing checks.
It should not also remove the specparams since they can be used outside
of a specify block.
2011-06-04 10:58:34 -07:00
Martin Whitaker 9ac9f36e3c (V0.9) Modified rules for primitive gate port expression widths.
The IEEE standard states that the port expressions used for arrays
of primitive gates must be the exact width required, but is silent
about the requirements for single instances. The consensus among
other simulators is that for input ports of single instances, the
expression is silently truncated to a single bit.

This patch also fixes a compiler crash if an error is found when
elaborating a primitive gate port expression.
2011-06-04 10:54:23 -07:00
Cary R 409898eb3b Update fstapi.c to match the latest from GTKWave
(cherry picked from commit feba73119a)
2011-05-29 09:14:38 -07:00
Cary R 134bd22e0b V0.9: Report the correct gate port number.
The error message was reporting the error message as zero based
instead of one based.
2011-05-29 09:13:00 -07:00
Cary R 9e853b4c04 Fix bug in queue average with a very large number of entries.
Icarus is not actually fast enough to run into this issue in a
reasonable amount of time. I discovered this by thinking about
the algorithm and verified the fix with custom code.
(cherry picked from commit 35488ac254)
2011-05-29 09:11:28 -07:00
Cary R 95eec63579 V0.9: Fix spelling problem reported in pr3301924 2011-05-29 09:08:06 -07:00
Martin Whitaker 16db50bed6 Fix for pr3301924.
If a relative path name is passed to the Windows LoadModule function,
it is applied in turn to each path in the DLL search path. For the
ivl_dlopen function, we actually want to mimic the Unix behaviour,
where a relative path is relative to the current working directory.
On systems where the KB2264107 security fix has been applied, the
CWD is excluded from the DLL search path, so we no longer get the
required behaviour. This patch reworks the ivl_dlopen function to
give the correct behaviour under Windows.

This patch also adds a flush of the stderr stream after reporting
VPI call errors. This fixes a race between the stdout and stderr
streams when running the regression tests in a MinGW shell.
(cherry picked from commit 767bb87ee2)
2011-05-29 09:07:20 -07:00
Cary R 88bf49d692 V0.9: Properly terminate a snprintf() call.
snprintf() copies at most N characters, but the string may not be
terminated correctly. This patch uses sizeof() so that the snprintf()
call matches the size of the buffer and adds code to insert a NULL as
the last character of the string.
2011-05-07 11:49:51 -07:00
Stephen Williams 735a789f20 cfparse.y needs stdio.h
Based on patch subbmitted to sourceforge tracker by
Greg Steuck (gnezdo)
(cherry picked from commit c02d6953ef)
2011-04-27 11:18:55 -07:00
Stephen Williams dbbe27ebce fix bad declarations from previous patch. 2011-04-27 11:16:47 -07:00
Cary R d3f7e4f1e6 V0.9: Back port the down payment on const-correctness patch from Larry
This patch is a back port of the applicable changes made in the patch
originally submitted by Larry for development on (9/27/2010).
2011-04-27 11:11:08 -07:00
Cary R dfedd3dda1 Remove some OpenBSD time variable warnings.
Since time is a function OpenBSD does not like us using a variable
named time. This patch fixes that in the sys_queue.c file.
2011-04-27 11:09:37 -07:00
Cary R 8e4008ae19 $q_full should return x for an invalid id.
After some more thought I believe it is better for $q_full to return
'bx instead of 2 when $q_full is given an invalid id. This will make
the typical full/not full checks both return false. We still return
an error code in the status variable.
(cherry picked from commit 10b2310c52)
2011-04-20 18:21:23 -07:00
Cary R 323f12ebfd V0.9: Convert a single % at the end of a format string to %%.
If there is a single % at the end of a format string then automatically
convert this to %% so that we get a single % in the output.
2011-04-20 18:16:54 -07:00
Cary R a51ea8f3b2 V0.9: Add (back-port) the stochastic (queue) tasks/function.
This patch back-ports the stochastic tasks/function from
development. See the development branch patches for more
information.
2011-04-20 17:43:46 -07:00
Cary R 6f2fd4e169 V0.9: Fix a few problems with the power operator.
The power operator defines 2**-1 and -2**-1 to be zero. This patch fixes
both the procedural and continuous assignments to work correctly. It also
fixes a problem in the compiler power code so that the one constant value
always has at least two bits.
2011-04-20 17:40:09 -07:00
Stephen Williams 4c9853551c flex and bison handled in makefiles with variables
Greg Steuck submitted this patch.
2011-03-29 08:54:58 -07:00
Cary R 524544da2d Update the FST dumper to include the vpiDefName if it's unique.
This patch adds the vpiDefName for a module if it is different than
the vpiName. This will be used in a future version of GTKWave.
(cherry picked from commit 085a5c8d02)
2011-03-23 12:01:54 -07:00
Stephen Williams 90bad1a36c Prepare for 0.9.4 release. 2011-03-17 12:26:38 -07:00
Cary R 28ca2a42de v0.9: Remove the last version.h references 2011-03-17 11:53:38 -07:00