Commit Graph

8090 Commits

Author SHA1 Message Date
Purdea Andrei 81cec8ebd8 Fix port-list-less declaration-less functions for SystemVerilog
For functions without a port list in parantheses, declarations are optional in SystemVerilog.
This is true even in IEEE1800-2005, but not in IEEE1364-2005

(cherry picked from commit a4d91c9023)
2020-07-10 23:57:19 +01:00
Cary R fc19d29269 Update copyright 2020-07-03 23:15:59 -07:00
Cary R cf4f1940b2 Update size check in $fread() 2020-07-03 23:15:50 -07:00
Cary R 7aac789d74 Update fstapi.c to latest from GTKWave 2020-06-28 20:14:24 -07:00
Purdea Andrei ff30cb1800 Fix how explicitly unconnected ports are handled in the presence of .*
See this PR: https://github.com/steveicarus/ivtest/pull/15
Which adds test implicit-port7

(cherry picked from commit 01ee6bd5b4)
2020-06-03 11:56:43 +01:00
Cary R a151407ca4 Update the flag count from 256 to 512 2020-05-31 12:51:41 -07:00
Martin Whitaker 1aba4acebe Fix GitHub issue #324 - replace __CYGWIN32__ with __CYGWIN__.
__CYGWIN32__ is not defined when building with the 64-bit Cygwin
toolchain. According to the Cygwin FAQ, __CYGWIN__ has been defined
since 1998, so this should still work for users on 32-bit systems.
2020-05-10 14:29:45 +01:00
Martin Whitaker 7b4e5ffc84 Update vlog95 target to handle buffers/tran_vps used to prevent port collapsing.
(cherry picked from commit 40d2a49b90)
2020-05-07 23:18:05 +01:00
Martin Whitaker b644d86e91 Fix GitHub issue #316 - isolate modpath delays from multi-driven nets.
When module ports are collapsed, we can't tell which of the nexus drivers
are associated with a given module port and should be routed through an
associated modpath delay. Work round this by inserting a transparent
buffer or tran_vp if an output or inout port has a modpath delay. The
target code generator can elide this once it has handled the modpath
delays.

(cherry picked from commit e19109e58f)
2020-05-07 23:17:37 +01:00
Cary R 5fbb98bdbb Update find_scope and vpi_handle_by_name to work with escaped identifiers 2020-05-02 19:49:00 -07:00
Martin Whitaker 6da261cd52 Fix elaboration and evaluation of SV queue push arguments.
These are assignments to a queue element, so need to consider the
element base type when determining the expression width.

(cherry picked from commit 8da7a14800)
2020-05-01 15:37:07 +01:00
Martin Whitaker 205b7f4b6f Fix GitHub issue #315 - support modpath delays on multiply-driven nets.
(cherry picked from commit a44ffe5746)
2020-04-02 12:46:57 +01:00
Cary R d411b7a00d Update to the latest GTKWAve files 2020-03-30 15:49:48 -07:00
Martin Whitaker 76a1aa6fa3 Fix segfault when calling nex_input() for deassign and release statements. 2020-02-09 18:40:03 +00:00
Martin Whitaker e5075c1340 Fix GitHub issue #306 - segfault when synthesising deassign statement.
Synthesis doesn't properly support any of the procedural continuous
assignment statements, so output a "sorry" message and abort synthesis.

(cherry picked from commit 387d18d222)
2020-02-09 18:27:19 +00:00
Martin Whitaker cce08337c6 Fix for GitHub issue #309 - allow braced expressions as macro arguments.
As for parentheses, we need to ignore commas within a pair of braces
when parsing a macro argument, e.g. `MACRO({a,b}) has one argument.

This fix is a little crude in that it doesn't distinguish between
parentheses and braces, e.g. it will accept {a,b). But any errors
like that will be caught by the compiler proper.

(cherry picked from commit fb29da0bd8)
2020-02-08 20:55:36 +00:00
Greg Steuck b7c9df2fd5 Fix bad bounds check in for loop
(cherry picked from commit 398d0cb82f)
2020-02-08 20:18:03 +00:00
Huang Rui 2c0995caca Fix fails to build with -fno-common or gcc-10
See also: https://bugs.gentoo.org/706366

gcc-10 and above flipped a default from -fcommon to -fno-common:
https://gcc.gnu.org/PR85678

Usually all it takes is to add a few 'extern' declarations and
move definitions from header files to modules. I've port iverilog
to gcc-10 accroding to this guide:
https://wiki.gentoo.org/wiki/Gcc_10_porting_notes/fno_common

To fix this, I analyzed the code, and found ``pli_trace`` has been
defined at here:
https://github.com/steveicarus/iverilog/blob/v10_3/libveriuser/priv.c#L24

So I changed ``FILE* pli_trace;`` to ``extern FILE* pli_trace;``.

The var ``current_file`` only in ``cfparse_misc.h``, I changed it
from ``char *current_file;`` to ``extern char *current_file;`` and
declaring it in cflexor.lex

And then it works.

Signed-off-by: Huang Rui <vowstar@gmail.com>
(cherry picked from commit d49d26a5c5)
2020-01-30 18:43:24 +00:00
Cary R fc7d604eec Update to the latest fstapi files from GTKWave 2020-01-01 19:59:41 -08:00
Stephen Williams a056623936 Fix possible buffer overflow.
(cherry picked from commit b25df08c99)
2019-11-21 18:55:17 -08:00
Martin Whitaker 21ca8360fe Improve vvp handling of excessively large shift distances.
(cherry picked from commit 351a4e5f5e)
2019-11-16 12:28:45 +00:00
Martin Whitaker b13b608744 Fix vvp %shift instructions to treat right operand as unsigned.
1364-2005 section 5.1.12 says "The right operand is always treated
as an unsigned number".

This fixes GitHub issue #283.

(cherry picked from commit 0a4cae2644)
2019-11-16 12:28:37 +00:00
Martin Whitaker fbe423305e Fix for issue #280 - the condition operator may return a valid enum type.
If the condition expression is 2-state, the result won't be blended, so
the result will be a valid enum value if both true and false expressions
return the same enum type.

(cherry picked from commit 82c8a49573)
2019-11-09 13:43:39 +00:00
Stephen Williams f1990caf6f Handle case that strings are arguments of functions/tasks.
When strings are arguments to functions/tasks, that doesn't suddenly
make them implicitly scalar. Strings are vectors and should be treated
that was, even if they are IMPLICIT_REG.

Ported from git master.
2019-10-30 09:36:49 -07:00
Cary R 055dcf60cb Update fstapi.c to latest from GTKWave 2019-10-20 16:35:47 -07:00
Martin Whitaker daf6b7a132 Add error recovery for invalid cast expressions.
(cherry picked from commit 9f7dc732ab)
2019-10-11 19:07:24 +01:00
Martin Whitaker c965e14cd7 Fix casts to integer types.
Casting from signed to unsigned types and vice versa is legal in SV,
as is casting from a larger to a smaller size. Obey Verilog rules
for expression bit width and signedness.

(cherry picked from commit d56e90c3f4)
(modified to handle differences between devel and v10)
2019-10-11 18:52:53 +01:00
Stephen Williams 756674aa5b Replace an assert with an internal error message.
(cherry picked from commit 2ced291d33)
2019-10-03 08:40:27 -07:00
Stephen Williams c2bd35d277 Fix assertion in error recovery.
(cherry picked from commit 4f48a7ed41)
2019-10-02 19:43:10 -07:00
Stephen Williams c5e65b5cc8 Merge branch 'v10-branch' of github.com:steveicarus/iverilog into v10-branch 2019-10-02 18:34:48 -07:00
Stephen Williams 9554c32f42 Don't allow nil bytes in string literals.
(cherry picked from commit 30fbc020e6)
2019-10-02 18:32:04 -07:00
Cary R adfabf34bf Update error message generation to match devel 2019-10-01 19:01:47 -07:00
Stephen Williams 7dfdd344e0 Handle breakage in nested module parsing. 2019-10-01 15:35:59 -07:00
Stephen Williams 8a24adf858 Detect errors elaborating delay expressions. 2019-10-01 09:34:12 -07:00
Stephen Williams c02f22732d More robust handling of identifiers out of scope.
Handle the (otherwise and error) case of an identifier
used or accessed outside any scope.
2019-09-30 18:46:26 -07:00
Cary R ab0c4bb8c7 Update to latest GTKWave files 2019-09-29 10:00:06 -07:00
Martin Whitaker ea9b8408f5 Improve handling of invalid packed and unpacked dimensions.
As reported on iverilog-devel on 2018-10-12, a dimension size of zero
could case the compiler to go into an infinite loop. Further tests
showed that unsized or queue dimensions entered as packed dimensions
would cause the compiler to crash.

(cherry picked from commit 832adc5c74)
2019-09-14 09:42:52 +01:00
Stephen Williams 453c546589 Prepare for 10.3 release. 2019-08-15 08:31:11 -07:00
Martin Whitaker 4914f83ae3 Schedule UDP initial 0/1 assignments to occur during time 0.
This allows any always processes that are sensitive to the UDP output
to start first. This fixes a time 0 race that was found in a Lattice
Semiconductor simulation library (reported on iverilog-devel).

If the initial value is 'x', propagate the value to the UDP output
before the start of simulation, to avoid unwanted update events on
the z -> x transition on downstream nets.

(cherry picked from commit 3bdb50da29)
2019-08-09 21:09:44 +01:00
Martin Whitaker b7b22660e5 Fix assertion failure when top level module has array ports.
Reported by Kustaa Nyholm on iverilog-devel, 2017-10-17.

(cherry picked from commit a8318db21c)
2019-08-03 19:26:16 +01:00
Martin Whitaker a6eb59192e Add note that bison 2.3 is known to generate bad code (br1028).
(cherry picked from commit 326945329e)
2019-08-02 17:03:53 +01:00
Martin Whitaker dbcb7e5fb6 Fix for br1015 : assertion failure when task/function port is an array.
This is an error for Verilog and not yet supported for SystemVerilog.

(cherry picked from commit e97883b1db)
2019-08-02 17:03:42 +01:00
Martin Whitaker 2546631874 Fix for GitHub issue #256 - don't use V as Makefile variable name.
Some build systems override V on the make command line, wrongly assuming
it is the automake verbose option.

(cherry picked from commit 866cc46915)
2019-08-02 10:32:51 +01:00
StefanBruens 8e54e31bd8 Fix redefinition of YYLTYPE struct caused by wrong include order
cfparse.h defines the YYLTYPE struct in case it has not been defined, and
also declares an extern YYLTYPE cflloc which is used in cflexor.

As cfparse_misc.h defines an extended YYLTYPE, the cflloc instance in
cfparse.c has this extended type, i.e. there is a type mismatch.

Changing the include order in cflexor causes both cflexor.c and
cfparse.c to use the definition from cfparse_misc.h.

This has been uncovered by GCC when using LTO:
---
gcc -flto=8 main.o substit.o cflexor.o cfparse.o -o iverilog 
cfparse.h:105:16: warning: type of 'cflloc' does not match original declaration [-Wlto-type-mismatch]
  105 | extern YYLTYPE cflloc;
      |                ^
cfparse.c:1162:9: note: type 'struct cfltype' should match type 'struct YYLTYPE'
 1162 | YYLTYPE yylloc
      |         ^
cfparse.c:1162:9: note: 'cflloc' was previously declared here
cfparse.c:1162:9: note: code may be misoptimized unless '-fno-strict-aliasing' is used
---

(cherry picked from commit d58fde6f36)
2019-08-02 10:15:55 +01:00
Martin Whitaker 9a81d5dd65 Change minimum gperf version to 3.0.
vhdlpp uses the --ignore-case option, which isn't supported in 2.7.

(cherry picked from commit 10168d542c)
2019-08-02 10:15:47 +01:00
Martin Whitaker 564c7404a6 Fix initialisation of vvp symbol table values.
In 64-bit Windows, an unsigned long is 32 bits, so initialising the num
member of the union did not properly initialise the ptr member. The num
member isn't actually needed, so eliminate it.

(cherry picked from commit c383d2048c)
2019-08-01 13:00:26 +01:00
Martin Whitaker a01b7054fc Fix GitHub issue #231 - support packed array indexing in foreach statement.
(cherry picked from commit 6309674a8d)
2019-07-25 11:14:21 +01:00
Martin Whitaker e834302875 Fix VPI interface to APV objects.
- type is vpiPartSelect, not vpiMemoryWord
- left/right range is for part, not full word
- index is not valid for a part select

The user will now get a sensible error message if they pass part of an
array word to $dumpvars (GitHub issue #230).

(cherry picked from commit 8402696676)
2019-07-25 09:03:04 +01:00
Martin Whitaker 7f418af98a Fix for GitHub issue #239 - segfault when library file has syntax errors.
If there are errors when parsing a file, it is not safe to elaborate any
modules that have been found in that file.

(cherry picked from commit 0cb1ebddf1)
2019-07-24 10:32:44 +01:00
Martin Whitaker 5b5c0f5c69 Fix GitHub issue #243 - support arbitrary width static bit arrays in vvp.
(cherry picked from commit 8cd8bed22e)
2019-07-24 09:17:08 +01:00