Commit Graph

211 Commits

Author SHA1 Message Date
Cary R 08c8ee081a More cppcheck updates 2025-10-20 23:54:15 -07:00
Cary R 94dcd658c8 Update exe and manual pages to report @(C) 2025 2025-10-12 19:13:30 -07:00
Cary R dc047799d6 Update displayed Copyright 2024-01-20 17:52:04 -08:00
mole99 6d3e2bf344 Improve SDF interconnect support, add -ginterconnect flag 2023-08-23 12:56:11 +02:00
Lars-Peter Clausen c1c4c28313 Handle implicit task/function imports in the unit scope
SystemVerilog requires that functions and tasks are not implicitly imported
if a symbol with the same name appears in the scope, even if it the symbol
is declared after its usage.

To support this a list of potential imports is collected while parsing a
scope and only when the end of the scope is reached it is evaluated whether
the symbol should be imported or not based on whether it already exists in
the scope.

This currently works fine for all scopes except for the unit scope. Since
the unit scope might span multiple files it is never explicitly closed and
the potential imports are never checked.

Make sure that after parsing all files is done the potential imports for
the unit scope are checked.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2023-06-11 09:20:51 -07:00
Cary R ee14cb0eb0 Update displayed Copyright dates 2023-06-10 20:33:08 -07:00
Cary R dc8b7d0184 Cleanup some cppcheck warnings 2022-12-28 00:00:31 -08:00
Lars-Peter Clausen 4a87bee3c0 Support parameters without default value
SystemVerilog allows to omit the default value of a parameter declared in a
parameter port list. In this case the parameter must be overridden for
every module instance. This is defined in section 6.20.1 ("Parameter
declaration syntax") of the LRM (1800-2017).

In addition a module that has a parameter without a default value does not
qualify for automatic toplevel module selection.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-02-13 18:21:56 +01:00
Martin Whitaker ecbbb60fb6 Remove "using namespace std" from compiler header files and fix the fallout. 2021-11-04 16:55:03 +00:00
Cary R 5f281d5f21 Pass fail information from the preprocessor to the compiler 2021-01-10 18:27:31 -08:00
Cary R c978d28c09 Update main component Copyright to 2021 2021-01-10 14:32:30 -08:00
Cary R 1bffc649cb Fix some cleanup code in the compiler 2021-01-07 23:53:53 -08:00
Martin Whitaker ba25b55f53 Elaborate package scopes in textual order (fix for issue #461)
When elaborating a subclass, the base class scope needs to be elaborated
before the subclass scope. If the base class and subclass are defined in
different packages, this requires the package scopes to be elaborated in
the correct order. SystemVerilog reqires packages to be defined before
they are used, so that is the order we should elaborate them in.
2021-01-03 18:45:08 +00:00
martinwhitaker ed7734c795
Merge pull request #328 from purdeaandrei/f_allow_libext_and_y_commands_to_be_given_in_any_order
Allow +libext+ and -y commands to be given in any order (and small fix in manpage)
2020-06-03 14:57:09 +01:00
Purdea Andrei c217d7d759 fix compilation issues on older gcc5 2020-06-03 15:58:27 +03:00
Purdea Andrei 859341273e Don't use C++11 feature std::tuple, instead use std::pair 2020-06-03 14:47:11 +03:00
Cary R fb237fb006 Update the user visible copyright to be 2020 2020-05-31 13:41:38 -07:00
Purdea Andrei 37da3c530c Allow +libext+ and -y .f command file options to be given in any order. 2020-05-19 22:49:35 +03:00
Martin Whitaker cf44f05cd3 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:06:53 +01:00
Stephen Williams 7cf8bb9875 Put some buffer overflow checks in.
Also, do a minor rework of StringHeap, and have it check its
assumptions more thoroughly.
2019-11-21 18:35:43 -08:00
Martin Whitaker 9f93989944 Extract system function return types from VPI modules, not SFT files. 2019-10-21 13:40:40 +01:00
Martin Whitaker 05641f386f Add -g option to only enable supported assertion statements. 2019-10-05 13:37:03 +01:00
Martin Whitaker abd63e80e1 With '-i', don't return an error when there are no top-level modules.
The '-i' option is there to allow the compiler to be used to check an
incomplete design for errors. With no top-level modules, nothing will
be elaborated, but at least will be checked for syntax errors.
2019-09-23 20:05:03 +01:00
Martin Whitaker f1608e163f Fix implicit fallthrough warnings when building with recent GCC. 2018-10-06 20:15:42 +01:00
Martin Whitaker 0f95770418 Include compilation units in pform dump. 2018-02-18 12:53:29 +00:00
Martin Whitaker fd807a7700 Rework handling of timescales in parser.
This implements and enforces the full set of rules for determining
timescales in SystemVerilog. The previous relaxation of the rules
that allowed timescales to be redefined within the compilation unit
scope has been removed. Time unit and precision redeclarations are
now recognised after a nested module declaration.
2017-11-05 17:50:05 +00:00
Martin Whitaker 988816c0b1 Support separate compilation units in SystemVerilog.
The compilation unit scope is now treated as a specialised form of
package (with an automatically generated name). All items declared
outside a design element are added to the current compilation unit
package. Apart from when searching for a symbol, once we get into
elaboration we can treat these just like any other package.
2017-10-31 20:38:59 +00:00
Martin Whitaker dfddbea26b First step towards supporting separate compilation units in SV.
This adds a -u option to the driver to allow the user to specify that
they want each source file to be treated as a separate compilation
unit, and modifies the compiler to accept a list of files (either on
the command line or via a file specified by a new -F option). This
list of files is then preprocessed and parsed separately, causing all
compiler directives (including macro definitions) to only apply to the
file containing them, as required by the SystemVerilog standard.
2017-10-31 20:36:27 +00:00
Martin Whitaker 87cddf33dc Fix for GitHub issue #98 and #167
Two fixes needed:
  - when searching for a base class, we need to look in the root scope
    if the base class isn't found in the scope hierarchy
  - the classes in the root scope need to be stored in an ordered
    list, not a map, to ensure they are elaborated in the order they
    were declared. Without this, the compiler may try elaborating an
    extended class before its base class is known about.
2017-10-08 21:15:11 +01:00
Mikael Tuomisalo c967ed238c Added option for ignoring errors about missing modules 2017-03-21 17:34:44 +02:00
Martin Whitaker 3c9b39846c Use gn_system_verilog() where appropriate.
Replace explicit comparisons against generation_flag with calls to
the gn_system_verilog helper function, both for code clarity and
to fix a couple of bugs. Also simplify the implementation of the
function, as we already rely on the generation_flag enumeration
being an ordered list.
2016-09-08 23:00:48 +01:00
Martin Whitaker b4d5248c67 Fix for br1000 - avoid infinite loop when processes share a for-loop index. 2016-03-05 17:43:25 +00:00
Martin Whitaker f84f0535cf Renamed synthsplit to exposenodes.
This was needed to avoid automatically setting the synth flag in the
compiler.
2016-02-27 20:24:28 +00:00
Martin Whitaker 9d5f4ad048 Add new synthsplit functor.
This provides support for handling synthesis constructs in the vlog95
target.
2016-02-27 16:40:55 +00:00
Stephen Williams f3647578d4 Add the -Wimplicit-dimensions warning. 2016-02-06 16:07:50 -08:00
Maciej Suminski b414733f34 vhdlpp: std.textio & ieee.std_logic_textio functions implemented using VPI. 2015-11-24 17:16:51 +01:00
Stephen Williams 8f095f12de Add -Wfloating-nets warnings. 2015-10-01 15:17:03 -07:00
Martin Whitaker 9f4b485c1c Updated copyright dates displayed for main programs and targets. 2015-08-17 22:05:08 +01:00
Martin Whitaker 71c4ea36e8 Pass -v compiler option to vvp in the output file shebang line.
Slightly modified version of the patch contributed by Stephan
Böttcheron iverilog-devel.
2014-12-16 21:22:19 +00:00
Stephen Williams c5fee8bdb9 Elaborate root tasks/functions. 2014-09-30 16:06:32 -07:00
Maciej Suminski a67f18f8ef ivl: Do not delete range objects right after setting range for a net. 2014-08-28 10:02:56 +02:00
Martin Whitaker 5dcd2e8957 Added width cap for unsized expressions.
Unsized expressions can expand to extremely large widths. Usually this
is actually a mistake in the source code, but it can lead to the compiler
temporarily using extremely large amounts of memory, or in the worst
case, crashing. This adds a cap on the width of unsized expressions (by
default 65536 bits, but overridable by the user), and causes a warning
message to be output when the cap is reached.
2014-02-27 19:20:20 +00:00
Stephen Williams 7669a42cfb Handle some assertion syntax in the parser.
Implement some yacc rules for assertion syntax.

Add the -gassertions/-gno-assertions command-line flags to
enable or disable assertions.
2013-12-07 12:20:28 -08:00
Cary R bdfd5b9b55 Add -g2012 flag and keywords for IEEE 1800-2012. 2013-04-02 14:41:44 -07:00
Stephen Williams fb23493a98 Class methods down to the code generator
Emit the elaborated class methods. Also generate root scopes to
represent the classes in order to hold the methods. These scopes
can also in the future be used to implement static properties.
2013-03-24 15:12:35 -07:00
Martin Whitaker 09f90ab4e1 Add control to enable function evaluation at compile time.
Pure functions with constant operands can be evaluated at compile
time rather than at run time. This patch provides a global control
to enable this optimisation. Until constant function support is
complete, by default it is disabled.
2013-03-24 14:42:05 -07:00
Stephen Williams 99b8086ad2 Import parameters from packages. 2013-02-17 16:59:21 -08:00
Cary R 28bc333cba vlog95: block generating a concat-Z LPM device in the compiler.
Since the vlog95 code generator needs the strength information we do
not want to hide it behind a concat-Z optimization. For now we abort
the optimization, but in the future we could add parts of this back
in (e.g. all the drivers have matching strength then replace with a
normal concat and a buf-Z if the strength are not both strong. The
original buf-Z should be removed to reduce the number of LPM devices).
2013-02-13 19:19:21 -08:00
Arun Persaud f5aafc32f9 updated FSF-address 2012-08-29 10:12:10 -07:00
Cary R f36faa8ab3 Mingw needs to use Sleep vs sleep (also seconds go to ms) 2012-06-07 10:01:12 -07:00