Merge branch 'master' into split_var0

This commit is contained in:
Yutetsu TAKATSUKASA 2020-01-30 21:00:11 +09:00
commit 3abd3cb648
169 changed files with 4111 additions and 3027 deletions

1
.gitignore vendored
View File

@ -17,6 +17,7 @@
README
TAGS
autom4te.cache
compile_commands.json
config.cache
config.status
configure

View File

@ -27,6 +27,7 @@ before_install:
# Perl modules needed for testing
- yes yes | sudo cpan -fi Unix::Processors Parallel::Forker Bit::Vector
- sudo apt-get install gdb gtkwave
- sudo apt-get install libgoogle-perftools-dev
before_script:
- bash -x ci/build_vcddiff.sh
- bash -x ci/build_verilator.sh

26
Changes
View File

@ -9,14 +9,36 @@ The contributors that suggested a given feature are shown in []. Thanks!
** Add -match to lint_off to waive warnings. [Philipp Wagner]
*** Support $readmem/$writemem with assoc arrarys. Closes #2100. [agrobman]
*** Verilation speed improvements, #2133, #2138. [Geza Lore]
**** Support left justified $display. Closes #2101. [Pieter Kapsenberg]
*** Support libgoogle-perftools-dev's libtcmalloc if available, #2137. [Geza Lore]
*** Support $readmem/$writemem with assoc arrarys, #2100. [agrobman]
**** Support type(expression) operator and $typename, #1650.
**** Support left justified $display, #2101. [Pieter Kapsenberg]
**** Support string character access via indexing.
**** Support enum.next(k) with constant k > 1, #2125. [Tobias Rosenkranz]
**** Add parameter values in XML. #2110. [Pieter Kapsenberg]
**** Add loc column location in XML (replaces fl), #2122. [Pieter Kapsenberg]
**** Add error on misused define. [Topa Tota]
**** Add parameter to set maximum signal width, #2082. [Øyvind Harboe]
**** Add warning on genvar in normal for loop, #2143. [yurivict]
**** Fix VPI scope naming for public modules. [Nandu Raj]
**** Fix FST tracing of enums inside structs. [fsiegle]
**** Fix WIDTH warning on </<= of narrower value, #2141. [agrobman]
* Verilator 4.026 2020-01-11

View File

@ -148,6 +148,7 @@ DISTFILES_INC = $(INFOS) .gitignore \
docs/install.adoc \
docs/internals.adoc \
docs/verilator_logo.png \
docs/xml.adoc \
install-sh configure *.pod \
include/*.[chv]* \
include/*.in \

View File

@ -323,6 +323,7 @@ detailed descriptions in L</"VERILATION ARGUMENTS"> for more information.
--language <lang> Default language standard to parse
+libext+<ext>+[ext]... Extensions for finding modules
--lint-only Lint, but do not make output
--max-num-width <value> Maximum number width (default: 64K)
--MMD Create .d dependency files
--MP Create phony dependency targets
--Mdir <directory> Name of output object directory
@ -968,6 +969,11 @@ stylistic and not enabled by default.
If the design is not to be completely Verilated see also the --bbox-sys and
--bbox-unsup options.
=item --max-num-width I<value>
Set the maximum number literal width (e.g. in 1024'd22 this it the 1024).
Defaults to 64K.
=item --MMD
=item --no-MMD
@ -3144,7 +3150,7 @@ analysis.) For example:
The clock_enable attribute will cause the clock gate to be ignored in the
scheduling algorithm, sometimes required for correct clock behavior, and
always improving performance. It's also a good idea to enable the
IMPERFECTSCH warning, to insure all clock enables are properly recognized.
IMPERFECTSCH warning, to ensure all clock enables are properly recognized.
Same as C<clock_enable> in configuration files, see L</"CONFIGURATION
FILES"> for more information.
@ -4694,6 +4700,37 @@ that is not yet supported in Verilator. See the Limitations chapter.
=back
=head1 DEPRECATIONS
The following deprecated items are scheduled for future removal:
=over 4
=item Pre-C++11 compiler support
Verilator supports pre-C++11 compilers for non-threaded models when
configured with --enable-prec11. This flag will be removed and C++11
compilers will be required for both compiling Verilator and compiling
Verilated models no sooner than September 2020.
=item SystemC 2.1 and earlier support
Support for SystemC versions 2.1 and earlier and the related sc_clock
variable attribute will be removed no sooner than July 2020.
=item Configuration File -msg
The -msg argument to lint_off has been replaced with -rule. -msg is
planned for removal no sooner than January 2021.
=item XML locations
The XML C<fl> attribute has been replaced with C<loc>. C<fl> is planned
for removal no sooner than January 2021.
=back
=head1 FAQ/FREQUENTLY ASKED QUESTIONS
=over 4
@ -4925,7 +4962,7 @@ Most synthesis tools similarly define SYNTHESIS for you.
=item Why do I get "unexpected `do'" or "unexpected `bit'" errors?
Do, bit, ref, return, and other words are now SystemVerilog keywords. You
should change your code to not use them to insure it works with newer
should change your code to not use them to ensure it works with newer
tools. Alternatively, surround them by the Verilog 2005/SystemVerilog
begin_keywords pragma to indicate Verilog 2001 code.

12
ci/docker/run/hooks/post_push Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
# DESCRIPTION: Docker hub hook to tag the latest release (stable)
#
# Copyright 2020 by Stefan Wallentowitz. This program is free
# software; you can redistribute it and/or modify it under the terms
# of either the GNU Lesser General Public License Version 3 or the
# Perl Artistic License Version 2.0.FROM ubuntu:18.04
if [ "$SOURCE_BRANCH"="stable" ]; then
docker tag $IMAGE_NAME $DOCKER_REPO:latest
docker push $DOCKER_REPO:latest
fi

View File

@ -25,6 +25,18 @@ AC_ARG_ENABLE([maintainer-mode],
AC_ARG_ENABLE([silent-rules],
[AS_HELP_STRING([--disable-silent-rules], [ignored])])
# Flag to enable linking Verilator with tcmalloc if available
AC_ARG_ENABLE([tcmalloc],
[AS_HELP_STRING([--enable-tcmalloc],
[Use libtcmalloc for faster dynamic memory
management @<:@default=check@:>@])],
[case "${enableval}" in
yes) CFG_WITH_TCMALLOC=yes ;;
no) CFG_WITH_TCMALLOC=no ;;
*) AC_MSG_ERROR([bad value '${enableval}' for --enable-tcmalloc]) ;;
esac],
[CFG_WITH_TCMALLOC=check;])
# Special Substitutions - CFG_WITH_DEFENV
AC_MSG_CHECKING(whether to use hardcoded paths)
AC_ARG_ENABLE([defenv],
@ -209,15 +221,26 @@ AC_DEFUN([_MY_LDLIBS_CHECK_FLAG],
LIBS="$ACO_SAVE_LIBS"
])
AC_DEFUN([_MY_LDLIBS_CHECK_OPT],
[# _MY_LDLIBS_CHECK_OPT(flag) -- Check if linker supports specific options
# If it does, append flag to variable
_MY_LDLIBS_CHECK_FLAG($2)
AC_DEFUN([_MY_LDLIBS_CHECK_IFELSE],
[# _MY_LDLIBS_CHECK_IFELSE(flag,action-if-supported,action-if-not-supported)
# Check if linker supports specific flag, if it does do action-if-supported
# otherwise do action-if-not-supported
_MY_LDLIBS_CHECK_FLAG($1)
if test "$_my_result" = "yes" ; then
$1="$$1 $2"
true
$2
else
true
$3
fi
])
AC_DEFUN([_MY_LDLIBS_CHECK_OPT],
[# _MY_LDLIBS_CHECK_OPT(variable, flag) -- Check if linker supports specific
# options. If it does, append flag to variable.
_MY_LDLIBS_CHECK_IFELSE($2, $1="$$1 $2")
])
# Flag to select newest language standard supported
# Macros work such that first option that passes is the one we take
# gnu++17 code is clean, but SystemC in 2018 doesn't link with it (bug1339)
@ -258,7 +281,6 @@ _MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-faligned-new)
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-Wno-unused-parameter)
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-Wno-undefined-bool-conversion)
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-Wno-shadow)
AC_SUBST(CFG_CXXFLAGS_SRC)
# Flags for compiling Verilator parser always (in addition to above CFG_CXXFLAGS_SRC)
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_PARSER,-Wno-char-subscripts)
@ -310,6 +332,24 @@ m4_foreach([ldflag], [
AC_SUBST(CFG_LDLIBS_THREADS)
AC_SUBST(CFG_LDFLAGS_THREADS_CMAKE)
# Check if tcmalloc is available based on --enable-tcmalloc
_MY_LDLIBS_CHECK_IFELSE(
-ltcmalloc,
[if test "$CFG_WITH_TCMALLOC" != "no"; then
CFG_LIBS="$CFG_LIBS -ltcmalloc";
# If using tcmalloc, add some extra options to make the compiler not assume
# it is using it's own versions of the standard library functions
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-fno-builtin-malloc)
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-fno-builtin-calloc)
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-fno-builtin-realloc)
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-fno-builtin-free)
AC_SUBST(CFG_CXXFLAGS_SRC)
fi],
[if test "$CFG_WITH_TCMALLOC" = "yes"; then
AC_MSG_ERROR([--enable-tcmalloc was given but test for -ltcmalloc failed])
fi])
AC_SUBST(CFG_LIBS)
# Set CFG_WITH_THREADED if can support threading
AC_MSG_CHECKING(whether $CXX supports Verilated threads)
ACO_SAVE_CXXFLAGS="$CXXFLAGS"

View File

@ -11,6 +11,7 @@ Chris Randall
Driss Hafdi
Eric Rippey
Garrett Smith
Geza Lore
Gianfranco Costamagna
Howard Su
Iztok Jeras

View File

@ -84,6 +84,10 @@ To build Verilator you will need to install some standard packages:
sudo apt-get install autoconf
sudo apt-get install flex bison
The following are optional, but improve compilation speed:
sudo apt-get install libgoogle-perftools-dev
Additionally, to build or run Verilator you need these standard packages:
sudo apt-get install perl python3

View File

@ -70,7 +70,10 @@ The AST is represented at the top level by the class `AstNode`. This
abstract class has derived classes for the individual components
(e.g. `AstGenerate` for a generate block) or groups of components
(e.g. `AstNodeFTask` for functions and tasks, which in turn has `AstFunc`
and `AstTask` as derived classes).
and `AstTask` as derived classes). An important property of the `AstNode`
type hierarchy is that all non-final subclasses of `AstNode` (i.e.: those
which themselves have subclasses) must be abstract as well, and be named
with the prefix `AstNode*`. The `astgen` (see below) script relies on this.
Each `AstNode` has pointers to up to four children, accessed by the `op1p`
through `op4p` methods. These methods are then abstracted in a specific
@ -394,7 +397,7 @@ e.g. threads.
We will work with contributors to fix up indentation style issues, but it
is appreciated if you could match our style:
* All files should contain the magic header to insure standard indentation:
* All files should contain the magic header to ensure standard indentation:
+
// -*- mode: C++; c-file-style: "cc-mode" -*-
+
@ -959,7 +962,8 @@ src/VParseGrammar.y, as this grammar supports the full SystemVerilog
language and has a lot of back-and-forth with Verilator's grammar. Copy
the appropriate rules to src/verilog.y and modify the productions.
. If a new Ast type is needed, add it to V3AstNodes.h.
. If a new Ast type is needed, add it to V3AstNodes.h. Follow the convention
described above about the AstNode type hierarchy.
. Now you can run "test_regress/t/t_{new testcase}.pl --debug" and it'll
probably fail but you'll see a test_regress/obj_dir/t_{newtestcase}/*.tree

65
docs/xml.adoc Normal file
View File

@ -0,0 +1,65 @@
= Verilator XML Output
:toc: right
// Github doesn't render unless absolute URL
image::https://www.veripool.org/img/verilator_256_200_min.png[Logo,256,200,role="right"]
== Introduction
This document describes Verilator's XML output. For more general information
please see https://verilator.org[verilator.org].
== General
Verilator's XML output is enabled with the `--xml-only` flag. It contains
limited information about the elaborated design including files, modules,
instance hierarchy, logic and data types. There is no formal schema since part
of the structure of the XML document matches the compiled code which would
require the schema to describe legal SystemVerilog structure. The intended
usage is to enable other downstream tools to take advantage of Verilator's
parser.
== Structure
The XML document is consists of 4 sections within the top level `verilator_xml`
element:
`<files>`...`</files>`::
This section contains a list of all design files read, including the
built-in constructs and the command line as their own entries. Each
`<file>` has an attribute `id` which is a short ASCII string unique to that
file. Other elements' `loc` attributes use this id to refer to a particular
file.
`<module_files>`...`</module_files>`::
All files containing Verilog module definitions are listed in this section.
This element's contents is a subset of the `<files>` element's contents.
`<cells>`...`</cells>`::
The cells section of the XML document contains the design instance
hierarchy. Each instance is represented with the `<cell>` element with the
following attributes:
* `fl` (deprecated): The file id and line number where the module was
instanced. Use `loc` instead.
* `loc`: The file id, first line number, last line number, first column
number and last column number of the identifier where the module was
instanced, separated by commas.
* `name`: The instance name.
* `submodname`: The module name uniquified with particular parameter values (if any).
* `hier`: The full hierarchy path.
`<netlist>`...`</netlist>`::
The netlist section contains a number of `<module>`...`</module>` elements,
each describing the contents of that module, and a single `<typetable>`...
`</typetable>` element which lists all used types used within the
modules. Each type has a numeric `id` attribute that is referred to by
elements in the `<module>` elements using the `dtype_id` attribute.

View File

@ -418,9 +418,7 @@ static FASTLZ_INLINE int FASTLZ_DECOMPRESSOR(const void* input, int length, void
const flzuint8* ip = (const flzuint8*) input;
const flzuint8* ip_limit = ip + length;
flzuint8* op = (flzuint8*) output;
#ifdef FASTLZ_SAFE
flzuint8* op_limit = op + maxout;
#endif
flzuint32 ctrl = (*ip++) & 31;
int loop = 1;

View File

@ -33,9 +33,6 @@
#else
#include <malloc.h>
#endif
#elif defined(_MSC_VER)
#include <malloc.h>
#define alloca _alloca
#endif
#define wave_alloca alloca
#endif

View File

@ -73,12 +73,12 @@ private:
public:
// METHODS
// cppcheck-suppress truncLongCastReturn
virtual vluint64_t count() const { return *m_countp; }
virtual void zero() const { *m_countp = 0; }
virtual vluint64_t count() const VL_OVERRIDE { return *m_countp; }
virtual void zero() const VL_OVERRIDE { *m_countp = 0; }
// CONSTRUCTORS
// cppcheck-suppress noExplicitConstructor
VerilatedCoverItemSpec(T* countp) : m_countp(countp) { *m_countp = 0; }
virtual ~VerilatedCoverItemSpec() {}
virtual ~VerilatedCoverItemSpec() VL_OVERRIDE {}
};
//=============================================================================

View File

@ -164,12 +164,12 @@ private:
public:
// CONSTRUCTORS
VerilatedSave() { m_fd = -1; }
virtual ~VerilatedSave() { close(); }
virtual ~VerilatedSave() VL_OVERRIDE { close(); }
// METHODS
void open(const char* filenamep) VL_MT_UNSAFE_ONE; ///< Open the file; call isOpen() to see if errors
void open(const std::string& filename) VL_MT_UNSAFE_ONE { open(filename.c_str()); }
virtual void close() VL_MT_UNSAFE_ONE;
virtual void flush() VL_MT_UNSAFE_ONE;
virtual void close() VL_OVERRIDE VL_MT_UNSAFE_ONE;
virtual void flush() VL_OVERRIDE VL_MT_UNSAFE_ONE;
};
//=============================================================================
@ -183,14 +183,14 @@ private:
public:
// CONSTRUCTORS
VerilatedRestore() { m_fd = -1; }
virtual ~VerilatedRestore() { close(); }
virtual ~VerilatedRestore() VL_OVERRIDE { close(); }
// METHODS
void open(const char* filenamep) VL_MT_UNSAFE_ONE; ///< Open the file; call isOpen() to see if errors
void open(const std::string& filename) VL_MT_UNSAFE_ONE { open(filename.c_str()); }
virtual void close() VL_MT_UNSAFE_ONE;
virtual void flush() VL_MT_UNSAFE_ONE {}
virtual void fill() VL_MT_UNSAFE_ONE;
virtual void close() VL_OVERRIDE VL_MT_UNSAFE_ONE;
virtual void flush() VL_OVERRIDE VL_MT_UNSAFE_ONE {}
virtual void fill() VL_OVERRIDE VL_MT_UNSAFE_ONE;
};
//=============================================================================

View File

@ -184,12 +184,14 @@
# define VL_INCLUDE_UNORDERED_MAP <unordered_map>
# define VL_INCLUDE_UNORDERED_SET <unordered_set>
# endif
# define VL_FINAL final
# define VL_OVERRIDE override
#else
# define VL_EQ_DELETE
# define vl_unique_ptr std::auto_ptr
# define VL_INCLUDE_UNORDERED_MAP "verilated_unordered_set_map.h"
# define VL_INCLUDE_UNORDERED_SET "verilated_unordered_set_map.h"
# define VL_FINAL
# define VL_OVERRIDE
#endif
@ -271,6 +273,10 @@ typedef signed __int32 ssize_t; ///< signed size_t; returned fro
#else // Linux or compliant Unix flavors, -m64
// The inttypes supplied with some GCC versions requires STDC_FORMAT_MACROS
// to be declared in order to get the PRIxx macros used by fstapi.c
#define __STDC_FORMAT_MACROS
# include <inttypes.h> // Solaris
# include <stdint.h> // Linux and most flavors
# include <sys/types.h> // __WORDSIZE

View File

@ -68,6 +68,7 @@ CFG_CXXFLAGS_SRC = @CFG_CXXFLAGS_SRC@
CFG_CXXFLAGS_PARSER = @CFG_CXXFLAGS_PARSER@
# Compiler flags that turn on extra warnings
CFG_CXXFLAGS_WEXTRA = @CFG_CXXFLAGS_WEXTRA@
CFG_LIBS = @CFG_LIBS@
#### End of system configuration section. ####
@ -92,7 +93,7 @@ endif
# -lfl not needed as Flex invoked with %nowrap option
# -lstdc++ needed for clang, believed harmless with gcc
LIBS = -lm -lstdc++
LIBS = $(CFG_LIBS) -lm -lstdc++
CPPFLAGS += -MMD
CPPFLAGS += -I. -I$(bldsrc) -I$(srcdir) -I$(incdir) -I../../include
@ -193,6 +194,7 @@ RAW_OBJS = \
V3FileLine.o \
V3Gate.o \
V3GenClk.o \
V3Global.o \
V3Graph.o \
V3GraphAlg.o \
V3GraphAcyc.o \

View File

@ -70,7 +70,7 @@ private:
m_scopep->addActivep(nodep);
}
// VISITORS
virtual void visit(AstScope* nodep) {
virtual void visit(AstScope* nodep) VL_OVERRIDE {
m_scopep = nodep;
m_iActivep = NULL;
m_cActivep = NULL;
@ -79,15 +79,15 @@ private:
iterateChildren(nodep);
// Don't clear scopep, the namer persists beyond this visit
}
virtual void visit(AstSenTree* nodep) {
virtual void visit(AstSenTree* nodep) VL_OVERRIDE {
// Simplify sensitivity list
VL_DO_DANGLING(V3Const::constifyExpensiveEdit(nodep), nodep);
}
// Empty visitors, speed things up
virtual void visit(AstNodeStmt* nodep) { }
virtual void visit(AstNodeStmt* nodep) VL_OVERRIDE { }
//--------------------
// Default
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
// Default: Just iterate
iterateChildren(nodep);
}
@ -163,7 +163,7 @@ private:
AstNode* m_alwaysp; // Always we're under
AstNode* m_assignp; // In assign
// VISITORS
virtual void visit(AstAssignDly* nodep) {
virtual void visit(AstAssignDly* nodep) VL_OVERRIDE {
if (m_check != CT_SEQ) {
// Convert to a non-delayed assignment
UINFO(5," ASSIGNDLY "<<nodep<<endl);
@ -184,7 +184,7 @@ private:
VL_DO_DANGLING(nodep->deleteTree(), nodep);
}
}
virtual void visit(AstAssign* nodep) {
virtual void visit(AstAssign* nodep) VL_OVERRIDE {
if (m_check == CT_SEQ) {
AstNode* las = m_assignp;
m_assignp = nodep;
@ -192,7 +192,7 @@ private:
m_assignp = las;
}
}
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
AstVar* varp = nodep->varp();
if (m_check == CT_SEQ
&& m_assignp
@ -210,7 +210,7 @@ private:
}
}
//--------------------
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:
@ -240,7 +240,7 @@ private:
bool m_itemSequent; // Found a SenItem sequential
// VISITORS
virtual void visit(AstScope* nodep) {
virtual void visit(AstScope* nodep) VL_OVERRIDE {
// Create required actives and add to scope
UINFO(4," SCOPE "<<nodep<<endl);
// Clear last scope's names, and collect this scope's existing names
@ -248,10 +248,10 @@ private:
m_scopeFinalp = NULL;
iterateChildren(nodep);
}
virtual void visit(AstActive* nodep) {
virtual void visit(AstActive* nodep) VL_OVERRIDE {
// Actives are being formed, so we can ignore any already made
}
virtual void visit(AstInitial* nodep) {
virtual void visit(AstInitial* nodep) VL_OVERRIDE {
// Relink to IACTIVE, unless already under it
UINFO(4," INITIAL "<<nodep<<endl);
ActiveDlyVisitor dlyvisitor (nodep, ActiveDlyVisitor::CT_INITIAL);
@ -259,28 +259,28 @@ private:
nodep->unlinkFrBack();
wantactivep->addStmtsp(nodep);
}
virtual void visit(AstAssignAlias* nodep) {
virtual void visit(AstAssignAlias* nodep) VL_OVERRIDE {
// Relink to CACTIVE, unless already under it
UINFO(4," ASSIGNW "<<nodep<<endl);
AstActive* wantactivep = m_namer.getCActive(nodep->fileline());
nodep->unlinkFrBack();
wantactivep->addStmtsp(nodep);
}
virtual void visit(AstAssignW* nodep) {
virtual void visit(AstAssignW* nodep) VL_OVERRIDE {
// Relink to CACTIVE, unless already under it
UINFO(4," ASSIGNW "<<nodep<<endl);
AstActive* wantactivep = m_namer.getCActive(nodep->fileline());
nodep->unlinkFrBack();
wantactivep->addStmtsp(nodep);
}
virtual void visit(AstCoverToggle* nodep) {
virtual void visit(AstCoverToggle* nodep) VL_OVERRIDE {
// Relink to CACTIVE, unless already under it
UINFO(4," COVERTOGGLE "<<nodep<<endl);
AstActive* wantactivep = m_namer.getCActive(nodep->fileline());
nodep->unlinkFrBack();
wantactivep->addStmtsp(nodep);
}
virtual void visit(AstFinal* nodep) {
virtual void visit(AstFinal* nodep) VL_OVERRIDE {
// Relink to CFUNC for the final
UINFO(4," FINAL "<<nodep<<endl);
if (!nodep->bodysp()) { // Empty, Kill it.
@ -372,7 +372,7 @@ private:
ActiveDlyVisitor dlyvisitor (nodep, ActiveDlyVisitor::CT_SEQ);
}
}
virtual void visit(AstAlways* nodep) {
virtual void visit(AstAlways* nodep) VL_OVERRIDE {
// Move always to appropriate ACTIVE based on its sense list
UINFO(4," ALW "<<nodep<<endl);
//if (debug()>=9) nodep->dumpTree(cout, " Alw: ");
@ -384,13 +384,13 @@ private:
}
visitAlways(nodep, nodep->sensesp(), nodep->keyword());
}
virtual void visit(AstAlwaysPublic* nodep) {
virtual void visit(AstAlwaysPublic* nodep) VL_OVERRIDE {
// Move always to appropriate ACTIVE based on its sense list
UINFO(4," ALWPub "<<nodep<<endl);
//if (debug()>=9) nodep->dumpTree(cout, " Alw: ");
visitAlways(nodep, nodep->sensesp(), VAlwaysKwd::ALWAYS);
}
virtual void visit(AstSenGate* nodep) {
virtual void visit(AstSenGate* nodep) VL_OVERRIDE {
AstSenItem* subitemp = nodep->sensesp();
UASSERT_OBJ(subitemp->edgeType() == VEdgeType::ET_ANYEDGE
|| subitemp->edgeType() == VEdgeType::ET_POSEDGE
@ -398,7 +398,7 @@ private:
nodep, "Strange activity type under SenGate");
iterateChildren(nodep);
}
virtual void visit(AstSenItem* nodep) {
virtual void visit(AstSenItem* nodep) VL_OVERRIDE {
if (nodep->edgeType() == VEdgeType::ET_ANYEDGE) {
m_itemCombo = true;
// Delete the sensitivity
@ -416,10 +416,10 @@ private:
}
// Empty visitors, speed things up
virtual void visit(AstNodeMath* nodep) {}
virtual void visit(AstVarScope* nodep) {}
virtual void visit(AstNodeMath* nodep) VL_OVERRIDE {}
virtual void visit(AstVarScope* nodep) VL_OVERRIDE {}
//--------------------
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:

View File

@ -56,19 +56,19 @@ private:
VL_DEBUG_FUNC; // Declare debug()
// VISITORS
virtual void visit(AstTopScope* nodep) {
virtual void visit(AstTopScope* nodep) VL_OVERRIDE {
m_topscopep = nodep;
m_finder.main(m_topscopep);
iterateChildren(nodep);
m_topscopep = NULL;
}
virtual void visit(AstNodeModule* nodep) {
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
// Create required actives and add to module
// We can start ordering at a module, or a scope
UINFO(4," MOD "<<nodep<<endl);
iterateChildren(nodep);
}
virtual void visit(AstActive* nodep) {
virtual void visit(AstActive* nodep) VL_OVERRIDE {
UINFO(4," ACTIVE "<<nodep<<endl);
V3Const::constifyExpensiveEdit(nodep); // Remove duplicate clocks and such; sensesp() may change!
AstSenTree* sensesp = nodep->sensesp();
@ -113,29 +113,29 @@ private:
// No need to do statements under it, they're already moved.
//iterateChildren(nodep);
}
virtual void visit(AstInitial* nodep) { // LCOV_EXCL_LINE
virtual void visit(AstInitial* nodep) VL_OVERRIDE { // LCOV_EXCL_LINE
nodep->v3fatalSrc("Node should have been under ACTIVE");
}
virtual void visit(AstAssignAlias* nodep) { // LCOV_EXCL_LINE
virtual void visit(AstAssignAlias* nodep) VL_OVERRIDE { // LCOV_EXCL_LINE
nodep->v3fatalSrc("Node should have been under ACTIVE");
}
virtual void visit(AstAssignW* nodep) { // LCOV_EXCL_LINE
virtual void visit(AstAssignW* nodep) VL_OVERRIDE { // LCOV_EXCL_LINE
nodep->v3fatalSrc("Node should have been under ACTIVE");
}
virtual void visit(AstAlways* nodep) { // LCOV_EXCL_LINE
virtual void visit(AstAlways* nodep) VL_OVERRIDE { // LCOV_EXCL_LINE
nodep->v3fatalSrc("Node should have been under ACTIVE");
}
virtual void visit(AstAlwaysPublic* nodep) { // LCOV_EXCL_LINE
virtual void visit(AstAlwaysPublic* nodep) VL_OVERRIDE { // LCOV_EXCL_LINE
nodep->v3fatalSrc("Node should have been under ACTIVE");
}
virtual void visit(AstFinal* nodep) { // LCOV_EXCL_LINE
virtual void visit(AstFinal* nodep) VL_OVERRIDE { // LCOV_EXCL_LINE
nodep->v3fatalSrc("Node should have been deleted");
}
// Empty visitors, speed things up
virtual void visit(AstNodeMath* nodep) {}
virtual void visit(AstVarScope* nodep) {}
virtual void visit(AstNodeMath* nodep) VL_OVERRIDE {}
virtual void visit(AstVarScope* nodep) VL_OVERRIDE {}
//--------------------
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:

View File

@ -115,9 +115,9 @@ private:
if (failsp) failsp->unlinkFrBackWithNext();
if (nodep->immediate()) {
UASSERT_OBJ(!sentreep, nodep, "Immediate assertions don't have sensivity");
UASSERT_OBJ(!sentreep, nodep, "Immediate assertions don't have sensitivity");
} else {
UASSERT_OBJ(sentreep, nodep, "Concurrent assertions must have sensivity");
UASSERT_OBJ(sentreep, nodep, "Concurrent assertions must have sensitivity");
sentreep->unlinkFrBack();
}
//
@ -174,7 +174,7 @@ private:
}
// VISITORS
virtual void visit(AstIf* nodep) {
virtual void visit(AstIf* nodep) VL_OVERRIDE {
if (nodep->user1SetOnce()) return;
if (nodep->uniquePragma() || nodep->unique0Pragma()) {
AstNodeIf* ifp = nodep;
@ -234,7 +234,7 @@ private:
}
//========== Case assertions
virtual void visit(AstCase* nodep) {
virtual void visit(AstCase* nodep) VL_OVERRIDE {
iterateChildren(nodep);
if (!nodep->user1SetOnce()) {
bool has_default = false;
@ -296,7 +296,7 @@ private:
}
//========== Past
virtual void visit(AstPast* nodep) {
virtual void visit(AstPast* nodep) VL_OVERRIDE {
iterateChildren(nodep);
uint32_t ticks = 1;
if (nodep->ticksp()) {
@ -326,9 +326,13 @@ private:
}
nodep->replaceWith(inp);
}
virtual void visit(AstSampled* nodep) VL_OVERRIDE {
nodep->replaceWith(nodep->exprp()->unlinkFrBack());
VL_DO_DANGLING(pushDeletep(nodep), nodep);
}
//========== Statements
virtual void visit(AstDisplay* nodep) {
virtual void visit(AstDisplay* nodep) VL_OVERRIDE {
iterateChildren(nodep);
// Replace the special types with standard text
if (nodep->displayType()==AstDisplayType::DT_INFO) {
@ -341,29 +345,32 @@ private:
}
}
virtual void visit(AstAssert* nodep) {
virtual void visit(AstAssert* nodep) VL_OVERRIDE {
iterateChildren(nodep);
newPslAssertion(nodep, nodep->failsp());
}
virtual void visit(AstCover* nodep) {
virtual void visit(AstCover* nodep) VL_OVERRIDE {
iterateChildren(nodep);
newPslAssertion(nodep, NULL);
}
virtual void visit(AstRestrict* nodep) {
virtual void visit(AstRestrict* nodep) VL_OVERRIDE {
iterateChildren(nodep);
// IEEE says simulator ignores these
VL_DO_DANGLING(pushDeletep(nodep->unlinkFrBack()), nodep);
}
virtual void visit(AstNodeModule* nodep) {
m_modp = nodep;
m_modPastNum = 0;
//
iterateChildren(nodep);
// Reset defaults
m_modp = NULL;
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
AstNodeModule* origModp = m_modp;
unsigned origPastNum = m_modPastNum;
{
m_modp = nodep;
m_modPastNum = 0;
iterateChildren(nodep);
}
m_modp = origModp;
m_modPastNum = origPastNum;
}
virtual void visit(AstBegin* nodep) {
virtual void visit(AstBegin* nodep) VL_OVERRIDE {
// This code is needed rather than a visitor in V3Begin,
// because V3Assert is called before V3Begin
AstBegin* lastp = m_beginp;
@ -374,7 +381,7 @@ private:
m_beginp = lastp;
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:

View File

@ -71,7 +71,7 @@ private:
// VISITORS
//========== Statements
virtual void visit(AstClocking* nodep) {
virtual void visit(AstClocking* nodep) VL_OVERRIDE {
UINFO(8," CLOCKING"<<nodep<<endl);
// Store the new default clock, reset on new module
m_seniDefaultp = nodep->sensesp();
@ -83,7 +83,7 @@ private:
}
VL_DO_DANGLING(pushDeletep(nodep), nodep);
}
virtual void visit(AstAlways* nodep) {
virtual void visit(AstAlways* nodep) VL_OVERRIDE {
iterateAndNextNull(nodep->sensesp());
if (nodep->sensesp()) {
m_seniAlwaysp = nodep->sensesp()->sensesp();
@ -92,7 +92,7 @@ private:
m_seniAlwaysp = NULL;
}
virtual void visit(AstNodeCoverOrAssert* nodep) {
virtual void visit(AstNodeCoverOrAssert* nodep) VL_OVERRIDE {
if (nodep->sentreep()) return; // Already processed
clearAssertInfo();
// Find Clocking's buried under nodep->exprsp
@ -102,12 +102,12 @@ private:
}
clearAssertInfo();
}
virtual void visit(AstPast* nodep) {
virtual void visit(AstPast* nodep) VL_OVERRIDE {
if (nodep->sentreep()) return; // Already processed
iterateChildren(nodep);
nodep->sentreep(newSenTree(nodep));
}
virtual void visit(AstPropClocked* nodep) {
virtual void visit(AstPropClocked* nodep) VL_OVERRIDE {
// No need to iterate the body, once replace will get iterated
iterateAndNextNull(nodep->sensesp());
if (m_senip) {
@ -132,12 +132,12 @@ private:
nodep->replaceWith(blockp);
VL_DO_DANGLING(pushDeletep(nodep), nodep);
}
virtual void visit(AstNodeModule* nodep) {
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
iterateChildren(nodep);
// Reset defaults
m_seniDefaultp = NULL;
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}

View File

@ -51,15 +51,18 @@ typedef std::set<int> MTaskIdSet; // Set of mtaskIds for Var sorting
//######################################################################
// For broken() function, return error string if have a match
#define BROKEN_RTN(test) do { if (VL_UNCOVERABLE(test)) return # test; } while(0)
#define BROKEN_RTN(test) \
do { \
if (VL_UNCOVERABLE(test)) return #test; \
} while (0)
// (V)erilator (N)ode is: True if AstNode is of a a given AstType
#define VN_IS(nodep,nodetypename) (AstNode::privateIs ## nodetypename(nodep))
#define VN_IS(nodep,nodetypename) (AstNode::privateIs<Ast ## nodetypename>(nodep))
// (V)erilator (N)ode cast: Cast to given type if can; effectively
// dynamic_cast<nodetypename>(nodep)
#define VN_CAST(nodep,nodetypename) (AstNode::privateCast ## nodetypename(nodep))
#define VN_CAST_CONST(nodep,nodetypename) (AstNode::privateConstCast ## nodetypename(nodep) )
#define VN_CAST(nodep,nodetypename) (AstNode::privateCast<Ast ## nodetypename>(nodep))
#define VN_CAST_CONST(nodep,nodetypename) (AstNode::privateConstCast<Ast ## nodetypename>(nodep))
// (V)erilator (N)ode deleted: Reference to deleted child (for assertions only)
#define VN_DELETED(nodep) VL_UNLIKELY((vluint64_t)(nodep) == 0x1)
@ -305,6 +308,8 @@ public:
//
MEMBER_BASE, // V3LinkResolve creates for AstPreSel, V3LinkParam removes
//
TYPENAME, // V3Width processes
//
VAR_BASE, // V3LinkResolve creates for AstPreSel, V3LinkParam removes
VAR_CLOCK, // V3LinkParse moves to AstVar::attrScClocked
VAR_CLOCK_ENABLE, // V3LinkParse moves to AstVar::attrClockEn
@ -328,6 +333,7 @@ public:
"ENUM_BASE", "ENUM_FIRST", "ENUM_LAST", "ENUM_NUM",
"ENUM_NEXT", "ENUM_PREV", "ENUM_NAME",
"MEMBER_BASE",
"TYPENAME",
"VAR_BASE", "VAR_CLOCK", "VAR_CLOCK_ENABLE", "VAR_PUBLIC",
"VAR_PUBLIC_FLAT", "VAR_PUBLIC_FLAT_RD", "VAR_PUBLIC_FLAT_RW",
"VAR_ISOLATE_ASSIGNMENTS", "VAR_SC_BV", "VAR_SFORMAT", "VAR_CLOCKER",
@ -1157,6 +1163,8 @@ class AstNode {
AstNode* m_headtailp; // When at begin/end of list, the opposite end of the list
const AstType m_type; // Node sub-type identifier
FileLine* m_fileline; // Where it was declared
vluint64_t m_editCount; // When it was last edited
static vluint64_t s_editCntGbl; // Global edit counter
@ -1211,8 +1219,10 @@ public:
protected:
// CONSTRUCTORS
AstNode() { init(); }
explicit AstNode(FileLine* fileline) {init(); m_fileline = fileline; }
AstNode(AstType t)
: m_type(t) { init(); }
AstNode(AstType t, FileLine* fl)
: m_type(t) { init(); m_fileline = fl; }
virtual AstNode* clone() = 0; // Generally, cloneTree is what you want instead
virtual void cloneRelink() {}
void cloneRelinkTree();
@ -1243,7 +1253,7 @@ protected:
public:
// ACCESSORS
virtual AstType type() const = 0;
inline AstType type() const { return m_type; }
const char* typeName() const { return type().ascii(); } // See also prettyTypeName
AstNode* nextp() const { return m_nextp; }
AstNode* backp() const { return m_backp; }
@ -1299,7 +1309,7 @@ public:
static string vcdName(const string& namein); // Name for printing out to vcd files
string prettyName() const { return prettyName(name()); }
string prettyNameQ() const { return prettyNameQ(name()); }
string prettyTypeName() const; // "VARREF" for error messages
string prettyTypeName() const; // "VARREF" for error messages (NOT dtype's pretty name)
virtual string prettyOperatorName() const { return "operator "+prettyTypeName(); }
FileLine* fileline() const { return m_fileline; }
void fileline(FileLine* fl) { m_fileline = fl; }
@ -1533,11 +1543,22 @@ private:
// CONVERSION
public:
#include "V3Ast__gen_interface.h" // From ./astgen
// Things like:
// AstAlways* castAlways();
// These for use by VN_IS macro only
template<class T>
static bool privateIs(const AstNode* nodep);
// These for use by VN_CAST macro only
template<class T>
static T* privateCast(AstNode* nodep);
// These for use by VN_CAST_CONST macro only
template<class T>
static const T* privateConstCast(const AstNode* nodep);
};
// Specialisations of privateIs/privateCast
#include "V3Ast__gen_impl.h" // From ./astgen
inline std::ostream& operator<<(std::ostream& os, const AstNode* rhs) {
if (!rhs) os<<"NULL"; else rhs->dump(os); return os;
}
@ -1557,8 +1578,8 @@ inline void AstNRelinker::relink(AstNode* newp) { newp->AstNode::relink(this); }
class AstNodeMath : public AstNode {
// Math -- anything that's part of an expression tree
public:
explicit AstNodeMath(FileLine* fl)
: AstNode(fl) {}
AstNodeMath(AstType t, FileLine* fl)
: AstNode(t, fl) {}
ASTNODE_BASE_FUNCS(NodeMath)
// METHODS
virtual bool hasDType() const { return true; }
@ -1574,8 +1595,8 @@ public:
class AstNodeTermop : public AstNodeMath {
// Terminal operator -- a operator with no "inputs"
public:
explicit AstNodeTermop(FileLine* fl)
: AstNodeMath(fl) {}
AstNodeTermop(AstType t, FileLine* fl)
: AstNodeMath(t, fl) {}
ASTNODE_BASE_FUNCS(NodeTermop)
// Know no children, and hot function, so skip iterator for speed
// See checkTreeIter also that asserts no children
@ -1586,8 +1607,8 @@ public:
class AstNodeUniop : public AstNodeMath {
// Unary math
public:
AstNodeUniop(FileLine* fl, AstNode* lhsp)
: AstNodeMath(fl) {
AstNodeUniop(AstType t, FileLine* fl, AstNode* lhsp)
: AstNodeMath(t, fl) {
dtypeFrom(lhsp);
setOp1p(lhsp); }
ASTNODE_BASE_FUNCS(NodeUniop)
@ -1608,8 +1629,8 @@ public:
class AstNodeBiop : public AstNodeMath {
// Binary math
public:
AstNodeBiop(FileLine* fl, AstNode* lhs, AstNode* rhs)
: AstNodeMath(fl) {
AstNodeBiop(AstType t, FileLine* fl, AstNode* lhs, AstNode* rhs)
: AstNodeMath(t, fl) {
setOp1p(lhs); setOp2p(rhs); }
ASTNODE_BASE_FUNCS(NodeBiop)
virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) = 0; // Clone single node, just get same type back.
@ -1635,8 +1656,8 @@ public:
class AstNodeTriop : public AstNodeMath {
// Trinary math
public:
AstNodeTriop(FileLine* fl, AstNode* lhs, AstNode* rhs, AstNode* ths)
: AstNodeMath(fl) {
AstNodeTriop(AstType t, FileLine* fl, AstNode* lhs, AstNode* rhs, AstNode* ths)
: AstNodeMath(t, fl) {
setOp1p(lhs); setOp2p(rhs); setOp3p(ths); }
ASTNODE_BASE_FUNCS(NodeTriop)
AstNode* lhsp() const { return op1p(); }
@ -1663,22 +1684,22 @@ public:
class AstNodeBiCom : public AstNodeBiop {
// Binary math with commutative properties
public:
AstNodeBiCom(FileLine* fl, AstNode* lhs, AstNode* rhs)
: AstNodeBiop(fl, lhs, rhs) {}
AstNodeBiCom(AstType t, FileLine* fl, AstNode* lhs, AstNode* rhs)
: AstNodeBiop(t, fl, lhs, rhs) {}
ASTNODE_BASE_FUNCS(NodeBiCom)
};
class AstNodeBiComAsv : public AstNodeBiCom {
// Binary math with commutative & associative properties
public:
AstNodeBiComAsv(FileLine* fl, AstNode* lhs, AstNode* rhs)
: AstNodeBiCom(fl, lhs, rhs) {}
AstNodeBiComAsv(AstType t, FileLine* fl, AstNode* lhs, AstNode* rhs)
: AstNodeBiCom(t, fl, lhs, rhs) {}
ASTNODE_BASE_FUNCS(NodeBiComAsv)
};
class AstNodeCond : public AstNodeTriop {
public:
AstNodeCond(FileLine* fl, AstNode* condp, AstNode* expr1p, AstNode* expr2p)
: AstNodeTriop(fl, condp, expr1p, expr2p) {
AstNodeCond(AstType t, FileLine* fl, AstNode* condp, AstNode* expr1p, AstNode* expr2p)
: AstNodeTriop(t, fl, condp, expr1p, expr2p) {
if (expr1p) dtypeFrom(expr1p);
else if (expr2p) dtypeFrom(expr2p);
}
@ -1704,8 +1725,8 @@ public:
class AstNodePreSel : public AstNode {
// Something that becomes an AstSel
public:
AstNodePreSel(FileLine* fl, AstNode* lhs, AstNode* rhs, AstNode* ths)
: AstNode(fl) {
AstNodePreSel(AstType t, FileLine* fl, AstNode* lhs, AstNode* rhs, AstNode* ths)
: AstNode(t, fl) {
setOp1p(lhs); setOp2p(rhs); setNOp3p(ths); }
ASTNODE_BASE_FUNCS(NodePreSel)
AstNode* lhsp() const { return op1p(); }
@ -1726,8 +1747,8 @@ class AstNodeStmt : public AstNode {
// Statement -- anything that's directly under a function
bool m_statement; // Really a statement (e.g. not a function with return)
public:
explicit AstNodeStmt(FileLine* fl, bool statement = true)
: AstNode(fl)
AstNodeStmt(AstType t, FileLine* fl, bool statement = true)
: AstNode(t, fl)
, m_statement(statement) {}
ASTNODE_BASE_FUNCS(NodeStmt)
// METHODS
@ -1739,8 +1760,8 @@ public:
class AstNodeAssign : public AstNodeStmt {
public:
AstNodeAssign(FileLine* fl, AstNode* lhsp, AstNode* rhsp)
: AstNodeStmt(fl) {
AstNodeAssign(AstType t, FileLine* fl, AstNode* lhsp, AstNode* rhsp)
: AstNodeStmt(t, fl) {
setOp1p(rhsp); setOp2p(lhsp);
dtypeFrom(lhsp);
}
@ -1762,9 +1783,9 @@ public:
class AstNodeFor : public AstNodeStmt {
public:
AstNodeFor(FileLine* fileline, AstNode* initsp, AstNode* condp,
AstNodeFor(AstType t, FileLine* fl, AstNode* initsp, AstNode* condp,
AstNode* incsp, AstNode* bodysp)
: AstNodeStmt(fileline) {
: AstNodeStmt(t, fl) {
addNOp1p(initsp); setOp2p(condp); addNOp3p(incsp); addNOp4p(bodysp);
}
ASTNODE_BASE_FUNCS(NodeFor)
@ -1782,8 +1803,8 @@ class AstNodeIf : public AstNodeStmt {
private:
VBranchPred m_branchPred; // Branch prediction as taken/untaken?
public:
AstNodeIf(FileLine* fl, AstNode* condp, AstNode* ifsp, AstNode* elsesp)
: AstNodeStmt(fl) {
AstNodeIf(AstType t, FileLine* fl, AstNode* condp, AstNode* ifsp, AstNode* elsesp)
: AstNodeStmt(t, fl) {
setOp1p(condp); addNOp2p(ifsp); addNOp3p(elsesp);
}
ASTNODE_BASE_FUNCS(NodeIf)
@ -1804,8 +1825,8 @@ public:
class AstNodeCase : public AstNodeStmt {
public:
AstNodeCase(FileLine* fl, AstNode* exprp, AstNode* casesp)
: AstNodeStmt(fl) {
AstNodeCase(AstType t, FileLine* fl, AstNode* exprp, AstNode* casesp)
: AstNodeStmt(t, fl) {
setOp1p(exprp); addNOp2p(casesp);
}
ASTNODE_BASE_FUNCS(NodeCase)
@ -1820,7 +1841,8 @@ public:
class AstNodeSenItem : public AstNode {
// An AstSenItem or AstSenGate
public:
explicit AstNodeSenItem(FileLine* fl) : AstNode(fl) {}
AstNodeSenItem(AstType t, FileLine* fl)
: AstNode(t, fl) {}
ASTNODE_BASE_FUNCS(NodeSenItem)
virtual bool isClocked() const = 0;
virtual bool isCombo() const = 0;
@ -1841,14 +1863,14 @@ private:
bool m_hierThis; // Hiername points to "this" function
void init();
public:
AstNodeVarRef(FileLine* fl, const string& name, bool lvalue)
: AstNodeMath(fl), m_lvalue(lvalue), m_varp(NULL), m_varScopep(NULL),
m_packagep(NULL), m_name(name), m_hierThis(false) {
AstNodeVarRef(AstType t, FileLine* fl, const string& name, bool lvalue)
: AstNodeMath(t, fl), m_lvalue(lvalue), m_varp(NULL), m_varScopep(NULL)
, m_packagep(NULL), m_name(name), m_hierThis(false) {
init();
}
AstNodeVarRef(FileLine* fl, const string& name, AstVar* varp, bool lvalue)
: AstNodeMath(fl), m_lvalue(lvalue), m_varp(varp), m_varScopep(NULL),
m_packagep(NULL), m_name(name), m_hierThis(false) {
AstNodeVarRef(AstType t, FileLine* fl, const string& name, AstVar* varp, bool lvalue)
: AstNodeMath(t, fl), m_lvalue(lvalue), m_varp(varp), m_varScopep(NULL)
, m_packagep(NULL), m_name(name), m_hierThis(false) {
// May have varp==NULL
init();
}
@ -1883,8 +1905,8 @@ private:
string m_text;
public:
// Node that simply puts text into the output stream
AstNodeText(FileLine* fileline, const string& textp)
: AstNode(fileline) {
AstNodeText(AstType t, FileLine* fl, const string& textp)
: AstNode(t, fl) {
m_text = textp; // Copy it
}
ASTNODE_BASE_FUNCS(NodeText)
@ -1909,7 +1931,8 @@ private:
static int s_uniqueNum; // Unique number assigned to each dtype during creation for IEEE matching
public:
// CONSTRUCTORS
explicit AstNodeDType(FileLine* fl) : AstNode(fl) {
AstNodeDType(AstType t, FileLine* fl)
: AstNode(t, fl) {
m_width = 0; m_widthMin = 0; m_generic = false;
}
ASTNODE_BASE_FUNCS(NodeDType)
@ -1931,6 +1954,8 @@ public:
virtual bool similarDType(AstNodeDType* samep) const = 0; // Assignable equivalence. Call skipRefp() on this and samep before calling
virtual AstNodeDType* subDTypep() const { return NULL; } // Iff has a non-null subDTypep(), as generic node function
virtual bool isFourstate() const;
virtual string prettyDTypeName() const { return prettyTypeName(); } // Ideally an IEEE $typename
string prettyDTypeNameQ() const { return "'" + prettyDTypeName() + "'"; }
//
// Changing the width may confuse the data type resolution, so must clear
// TypeTable cache after use.
@ -1969,8 +1994,8 @@ private:
bool m_isFourstate;
MemberNameMap m_members;
public:
AstNodeUOrStructDType(FileLine* fl, AstNumeric numericUnpack)
: AstNodeDType(fl) {
AstNodeUOrStructDType(AstType t, FileLine* fl, AstNumeric numericUnpack)
: AstNodeDType(t, fl) {
// AstNumeric::NOSIGN overloaded to indicate not packed
m_packed = (numericUnpack != AstNumeric::NOSIGN);
m_isFourstate = false; // V3Width computes
@ -2020,7 +2045,8 @@ private:
AstNodeDType* m_refDTypep; // Elements of this type (after widthing)
AstNode* rangenp() const { return op2p(); } // op2 = Array(s) of variable
public:
explicit AstNodeArrayDType(FileLine* fl) : AstNodeDType(fl) {
AstNodeArrayDType(AstType t, FileLine* fl)
: AstNodeDType(t, fl) {
m_refDTypep = NULL;
}
ASTNODE_BASE_FUNCS(NodeArrayDType)
@ -2071,8 +2097,8 @@ public:
class AstNodeSel : public AstNodeBiop {
// Single bit range extraction, perhaps with non-constant selection or array selection
public:
AstNodeSel(FileLine* fl, AstNode* fromp, AstNode* bitp)
: AstNodeBiop(fl, fromp, bitp) {}
AstNodeSel(AstType t, FileLine* fl, AstNode* fromp, AstNode* bitp)
: AstNodeBiop(t, fl, fromp, bitp) {}
ASTNODE_BASE_FUNCS(NodeSel)
AstNode* fromp() const { return op1p(); } // op1 = Extracting what (NULL=TBD during parsing)
void fromp(AstNode* nodep) { setOp1p(nodep); }
@ -2085,7 +2111,8 @@ public:
class AstNodeStream : public AstNodeBiop {
// Verilog {rhs{lhs}} - Note rhsp() is the slice size, not the lhsp()
public:
AstNodeStream(FileLine* fl, AstNode* lhsp, AstNode* rhsp) : AstNodeBiop(fl, lhsp, rhsp) {
AstNodeStream(AstType t, FileLine* fl, AstNode* lhsp, AstNode* rhsp)
: AstNodeBiop(t, fl, lhsp, rhsp) {
if (lhsp->dtypep()) {
dtypeSetLogicSized(lhsp->dtypep()->width(), AstNumeric::UNSIGNED);
}
@ -2111,8 +2138,8 @@ private:
bool m_dpiTask:1; // DPI import task (vs. void function)
bool m_pure:1; // DPI import pure
public:
AstNodeFTask(FileLine* fileline, const string& name, AstNode* stmtsp)
: AstNode(fileline)
AstNodeFTask(AstType t, FileLine* fl, const string& name, AstNode* stmtsp)
: AstNode(t, fl)
, m_name(name)
, m_dpiOpenParent(0), m_taskPublic(false)
, m_attrIsolateAssign(false), m_prototype(false)
@ -2174,13 +2201,13 @@ private:
string m_inlinedDots; // Dotted hierarchy flattened out
AstPackage* m_packagep; // Package hierarchy
public:
AstNodeFTaskRef(FileLine* fl, bool statement, AstNode* namep, AstNode* pinsp)
: AstNodeStmt(fl, statement)
AstNodeFTaskRef(AstType t, FileLine* fl, bool statement, AstNode* namep, AstNode* pinsp)
: AstNodeStmt(t, fl, statement)
, m_taskp(NULL), m_packagep(NULL) {
setOp1p(namep); addNOp2p(pinsp);
}
AstNodeFTaskRef(FileLine* fl, bool statement, const string& name, AstNode* pinsp)
: AstNodeStmt(fl, statement)
AstNodeFTaskRef(AstType t, FileLine* fl, bool statement, const string& name, AstNode* pinsp)
: AstNodeStmt(t, fl, statement)
, m_taskp(NULL), m_name(name), m_packagep(NULL) {
addNOp2p(pinsp);
}
@ -2231,8 +2258,8 @@ private:
int m_varNum; // Incrementing variable number
int m_typeNum; // Incrementing implicit type number
public:
AstNodeModule(FileLine* fl, const string& name)
: AstNode(fl)
AstNodeModule(AstType t, FileLine* fl, const string& name)
: AstNode(t, fl)
, m_name(name), m_origName(name)
, m_modPublic(false), m_modTrace(false), m_inLibrary(false), m_dead(false)
, m_internal(false), m_recursive(false), m_recursiveClone(false)
@ -2245,7 +2272,7 @@ public:
AstActive* activesp() const { return VN_CAST(op3p(), Active); } // op3 = List of i/sblocks
// METHODS
void addInlinesp(AstNode* nodep) { addOp1p(nodep); }
void addStmtp(AstNode* nodep) { addOp2p(nodep); }
void addStmtp(AstNode* nodep) { addNOp2p(nodep); }
void addActivep(AstNode* nodep) { addOp3p(nodep); }
// ACCESSORS
virtual void name(const string& name) { m_name = name; }
@ -2276,18 +2303,14 @@ public:
class AstNodeRange : public AstNode {
// A range, sized or unsized
public:
explicit AstNodeRange(FileLine* fl) : AstNode(fl) { }
AstNodeRange(AstType t, FileLine* fl)
: AstNode(t, fl) {}
ASTNODE_BASE_FUNCS(NodeRange)
};
//######################################################################
#include "V3AstNodes.h"
#include "V3Ast__gen_impl.h" // From ./astgen
// Things like:
// inline AstAlways* AstNode::castAlways() { return dynamic_cast<AstAlways*>(this); }
// inline bool AstNode::privateIsaAlways(const AstNode* nodep) { return nodep && nodep->type() == AstType::atAlways; }
#include "V3AstNodes__gen.h"
//######################################################################
// Inline AstNVisitor METHODS

View File

@ -168,7 +168,7 @@ AstNodeBiop* AstEqWild::newTyped(FileLine* fl, AstNode* lhsp, AstNode* rhsp) {
}
AstExecGraph::AstExecGraph(FileLine* fileline)
: AstNode(fileline) {
: AstNode(AstType::atExecGraph, fileline) {
m_depGraphp = new V3Graph;
}
AstExecGraph::~AstExecGraph() {
@ -943,6 +943,14 @@ void AstBasicDType::dump(std::ostream& str) const {
str<<" kwd="<<keyword().ascii();
if (isRanged() && !rangep()) str<<" range=["<<left()<<":"<<right()<<"]";
}
string AstBasicDType::prettyDTypeName() const {
std::ostringstream os;
os << keyword().ascii();
if (isRanged() && !rangep() && keyword().width() <= 1) {
os << "[" << left() << ":" << right() << "]";
}
return os.str();
}
void AstCCast::dump(std::ostream& str) const {
this->AstNode::dump(str);
str<<" sz"<<size();
@ -1079,6 +1087,24 @@ void AstNodeArrayDType::dump(std::ostream& str) const {
this->AstNodeDType::dump(str);
str<<" "<<declRange();
}
string AstPackArrayDType::prettyDTypeName() const {
std::ostringstream os;
os << subDTypep()->prettyDTypeName() << declRange();
return os.str();
}
string AstUnpackArrayDType::prettyDTypeName() const {
std::ostringstream os;
string ranges = cvtToStr(declRange());
// Unfortunately we need a single $ for the first unpacked, and all
// dimensions shown in "reverse" order
AstNodeDType* subp = subDTypep()->skipRefp();
while (AstUnpackArrayDType* adtypep = VN_CAST(subp, UnpackArrayDType)) {
ranges += cvtToStr(adtypep->declRange());
subp = adtypep->subDTypep()->skipRefp();
}
os << subp->prettyDTypeName() << "$" << ranges;
return os.str();
}
void AstNodeModule::dump(std::ostream& str) const {
this->AstNode::dump(str);
str<<" L"<<level();
@ -1139,10 +1165,18 @@ void AstAssocArrayDType::dumpSmall(std::ostream& str) const {
this->AstNodeDType::dumpSmall(str);
str<<"[assoc-"<<(void*)keyDTypep()<<"]";
}
string AstAssocArrayDType::prettyDTypeName() const {
return subDTypep()->prettyDTypeName() + "[" + keyDTypep()->prettyDTypeName() + "]";
}
void AstQueueDType::dumpSmall(std::ostream& str) const {
this->AstNodeDType::dumpSmall(str);
str<<"[queue]";
}
string AstQueueDType::prettyDTypeName() const {
string str = subDTypep()->prettyDTypeName() + "[$";
if (boundConst()) str += ":" + cvtToStr(boundConst());
return str + "]";
}
void AstUnsizedArrayDType::dumpSmall(std::ostream& str) const {
this->AstNodeDType::dumpSmall(str);
str<<"[]";

File diff suppressed because it is too large Load Diff

View File

@ -72,20 +72,21 @@ private:
AstNodeFTask* m_ftaskp; // Current function/task
string m_namedScope; // Name of begin blocks above us
string m_unnamedScope; // Name of begin blocks, including unnamed blocks
int m_repeatNum; // Repeat counter
int m_ifDepth; // Current if depth
// METHODS
VL_DEBUG_FUNC; // Declare debug()
// VISITORS
virtual void visit(AstNodeModule* nodep) {
m_modp = nodep;
m_repeatNum = 0;
iterateChildren(nodep);
m_modp = NULL;
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
AstNodeModule* origModp = m_modp;
{
m_modp = nodep;
iterateChildren(nodep);
}
m_modp = origModp;
}
virtual void visit(AstNodeFTask* nodep) {
virtual void visit(AstNodeFTask* nodep) VL_OVERRIDE {
UINFO(8," "<<nodep<<endl);
// Rename it
if (m_unnamedScope != "") {
@ -110,7 +111,7 @@ private:
m_namedScope = oldScope;
m_unnamedScope = oldUnnamed;
}
virtual void visit(AstBegin* nodep) {
virtual void visit(AstBegin* nodep) VL_OVERRIDE {
// Begin blocks were only useful in variable creation, change names and delete
UINFO(8," "<<nodep<<endl);
string oldScope = m_namedScope;
@ -159,7 +160,7 @@ private:
}
VL_DO_DANGLING(pushDeletep(nodep), nodep);
}
virtual void visit(AstVar* nodep) {
virtual void visit(AstVar* nodep) VL_OVERRIDE {
if (m_unnamedScope != "") {
// Rename it
nodep->name(m_unnamedScope+"__DOT__"+nodep->name());
@ -170,7 +171,7 @@ private:
else m_modp->addStmtp(nodep);
}
}
virtual void visit(AstCell* nodep) {
virtual void visit(AstCell* nodep) VL_OVERRIDE {
UINFO(8," CELL "<<nodep<<endl);
if (m_namedScope != "") {
m_statep->userMarkChanged(nodep);
@ -183,14 +184,14 @@ private:
}
iterateChildren(nodep);
}
virtual void visit(AstVarXRef* nodep) {
virtual void visit(AstVarXRef* nodep) VL_OVERRIDE {
UINFO(9, " VARXREF "<<nodep<<endl);
if (m_namedScope != "" && nodep->inlinedDots() == "") {
nodep->inlinedDots(m_namedScope);
UINFO(9, " rescope to "<<nodep<<endl);
}
}
virtual void visit(AstScopeName* nodep) {
virtual void visit(AstScopeName* nodep) VL_OVERRIDE {
// If there's a %m in the display text, we add a special node that will contain the name()
// Similar code in V3Inline
if (nodep->user1SetOnce()) return; // Don't double-add text's
@ -203,13 +204,13 @@ private:
}
iterateChildren(nodep);
}
virtual void visit(AstCoverDecl* nodep) {
virtual void visit(AstCoverDecl* nodep) VL_OVERRIDE {
// Don't need to fix path in coverage statements, they're not under
// any BEGINs, but V3Coverage adds them all under the module itself.
iterateChildren(nodep);
}
// VISITORS - LINT CHECK
virtual void visit(AstIf* nodep) { // Note not AstNodeIf; other types don't get covered
virtual void visit(AstIf* nodep) VL_OVERRIDE { // Note not AstNodeIf; other types don't get covered
// Check IFDEPTH warning - could be in other transform files if desire
int prevIfDepth = m_ifDepth;
if (m_ifDepth == -1 || v3Global.opt.ifDepth()<1) { // Turned off
@ -223,7 +224,7 @@ private:
iterateChildren(nodep);
m_ifDepth = prevIfDepth;
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:
@ -232,7 +233,6 @@ public:
m_statep = statep;
m_modp = NULL;
m_ftaskp = NULL;
m_repeatNum = 0;
m_ifDepth = 0;
iterate(nodep);
}
@ -249,21 +249,21 @@ private:
// AstNodeFTask::user1p // Node replaced, rename it
// VISITORS
virtual void visit(AstNodeFTaskRef* nodep) {
virtual void visit(AstNodeFTaskRef* nodep) VL_OVERRIDE {
if (nodep->taskp()->user1()) { // It was converted
UINFO(9, " relinkFTask "<<nodep<<endl);
nodep->name(nodep->taskp()->name());
}
iterateChildren(nodep);
}
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
if (nodep->varp()->user1()) { // It was converted
UINFO(9, " relinVarRef "<<nodep<<endl);
nodep->name(nodep->varp()->name());
}
iterateChildren(nodep);
}
virtual void visit(AstIfaceRefDType* nodep) {
virtual void visit(AstIfaceRefDType* nodep) VL_OVERRIDE {
// May have changed cell names
// TypeTable is always after all modules, so names are stable
UINFO(8," IFACEREFDTYPE "<<nodep<<endl);
@ -272,7 +272,7 @@ private:
iterateChildren(nodep);
}
//--------------------
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:

View File

@ -70,7 +70,7 @@ private:
}
// VISITORS
virtual void visit(AstNodeIf* nodep) {
virtual void visit(AstNodeIf* nodep) VL_OVERRIDE {
UINFO(4," IF: "<<nodep<<endl);
int lastLikely = m_likely;
int lastUnlikely = m_unlikely;
@ -96,17 +96,17 @@ private:
m_likely = lastLikely;
m_unlikely = lastUnlikely;
}
virtual void visit(AstCCall* nodep) {
virtual void visit(AstCCall* nodep) VL_OVERRIDE {
checkUnlikely(nodep);
nodep->funcp()->user1Inc();
iterateChildren(nodep);
}
virtual void visit(AstCFunc* nodep) {
virtual void visit(AstCFunc* nodep) VL_OVERRIDE {
checkUnlikely(nodep);
m_cfuncsp.push_back(nodep);
iterateChildren(nodep);
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
checkUnlikely(nodep);
iterateChildren(nodep);
}

View File

@ -209,7 +209,7 @@ private:
iterateChildrenConst(nodep);
}
// VISITORS
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
processAndIterate(nodep);
}
public:
@ -257,7 +257,7 @@ private:
iterateChildrenConst(nodep);
BrokenTable::setUnder(nodep, false);
}
virtual void visit(AstNodeAssign* nodep) {
virtual void visit(AstNodeAssign* nodep) VL_OVERRIDE {
processAndIterate(nodep);
UASSERT_OBJ(!(v3Global.assertDTypesResolved()
&& nodep->brokeLhsMustBeLvalue()
@ -265,7 +265,7 @@ private:
&& !VN_CAST(nodep->lhsp(), NodeVarRef)->lvalue()),
nodep, "Assignment LHS is not an lvalue");
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
processAndIterate(nodep);
}
public:

View File

@ -62,7 +62,7 @@ private:
// METHODS
VL_DEBUG_FUNC; // Declare debug()
virtual void visit(AstNodeCase* nodep) {
virtual void visit(AstNodeCase* nodep) VL_OVERRIDE {
if (VN_IS(nodep, Case) && VN_CAST(nodep, Case)->casex()) {
nodep->v3warn(CASEX, "Suggest casez (with ?'s) in place of casex (with X's)");
}
@ -89,7 +89,7 @@ private:
m_caseExprp = NULL;
}
}
virtual void visit(AstConst* nodep) {
virtual void visit(AstConst* nodep) VL_OVERRIDE {
// See also neverItem
if (m_caseExprp && nodep->num().isFourState()) {
if (VN_IS(m_caseExprp, GenCase)) {
@ -106,7 +106,7 @@ private:
}
}
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:
@ -460,7 +460,7 @@ private:
}
// VISITORS
virtual void visit(AstCase* nodep) {
virtual void visit(AstCase* nodep) VL_OVERRIDE {
V3Case::caseLint(nodep);
iterateChildren(nodep);
if (debug()>=9) nodep->dumpTree(cout, " case_old: ");
@ -476,7 +476,7 @@ private:
}
//--------------------
// Default: Just iterate
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}

View File

@ -75,7 +75,7 @@ private:
relinkHandle.relink(castp);
//if (debug()>8) castp->dumpTree(cout, "-castins: ");
//
insureLower32Cast(castp);
ensureLower32Cast(castp);
nodep->user1(1); // Now must be of known size
}
int castSize(AstNode* nodep) {
@ -84,13 +84,13 @@ private:
else if (nodep->width() <= 16) return 16;
else return VL_IDATASIZE;
}
void insureCast(AstNode* nodep) {
void ensureCast(AstNode* nodep) {
if (castSize(nodep->backp()) != castSize(nodep)
|| !nodep->user1()) {
insertCast(nodep, castSize(nodep->backp()));
}
}
void insureLower32Cast(AstCCast* nodep) {
void ensureLower32Cast(AstCCast* nodep) {
// If we have uint64 = CAST(uint64(x)) then the upcasting
// really needs to be CAST(uint64(CAST(uint32(x))).
// Otherwise a (uint64)(a>b) would return wrong value, as
@ -102,33 +102,33 @@ private:
}
// VISITORS
virtual void visit(AstNodeUniop* nodep) {
virtual void visit(AstNodeUniop* nodep) VL_OVERRIDE {
iterateChildren(nodep);
nodep->user1(nodep->lhsp()->user1());
if (nodep->sizeMattersLhs()) insureCast(nodep->lhsp());
if (nodep->sizeMattersLhs()) ensureCast(nodep->lhsp());
}
virtual void visit(AstNodeBiop* nodep) {
virtual void visit(AstNodeBiop* nodep) VL_OVERRIDE {
iterateChildren(nodep);
nodep->user1(nodep->lhsp()->user1()
| nodep->rhsp()->user1());
if (nodep->sizeMattersLhs()) insureCast(nodep->lhsp());
if (nodep->sizeMattersRhs()) insureCast(nodep->rhsp());
if (nodep->sizeMattersLhs()) ensureCast(nodep->lhsp());
if (nodep->sizeMattersRhs()) ensureCast(nodep->rhsp());
}
virtual void visit(AstNodeTriop* nodep) {
virtual void visit(AstNodeTriop* nodep) VL_OVERRIDE {
iterateChildren(nodep);
nodep->user1(nodep->lhsp()->user1()
| nodep->rhsp()->user1()
| nodep->thsp()->user1());
if (nodep->sizeMattersLhs()) insureCast(nodep->lhsp());
if (nodep->sizeMattersRhs()) insureCast(nodep->rhsp());
if (nodep->sizeMattersThs()) insureCast(nodep->thsp());
if (nodep->sizeMattersLhs()) ensureCast(nodep->lhsp());
if (nodep->sizeMattersRhs()) ensureCast(nodep->rhsp());
if (nodep->sizeMattersThs()) ensureCast(nodep->thsp());
}
virtual void visit(AstCCast* nodep) {
virtual void visit(AstCCast* nodep) VL_OVERRIDE {
iterateChildren(nodep);
insureLower32Cast(nodep);
ensureLower32Cast(nodep);
nodep->user1(1);
}
virtual void visit(AstNegate* nodep) {
virtual void visit(AstNegate* nodep) VL_OVERRIDE {
iterateChildren(nodep);
nodep->user1(nodep->lhsp()->user1());
if (nodep->lhsp()->widthMin()==1) {
@ -137,10 +137,10 @@ private:
// out = {32{a<b}} => out = - (a<b)
insertCast(nodep->lhsp(), castSize(nodep));
} else {
insureCast(nodep->lhsp());
ensureCast(nodep->lhsp());
}
}
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
if (!nodep->lvalue()
&& !VN_IS(nodep->backp(), CCast)
&& VN_IS(nodep->backp(), NodeMath)
@ -153,7 +153,7 @@ private:
}
nodep->user1(1);
}
virtual void visit(AstConst* nodep) {
virtual void visit(AstConst* nodep) VL_OVERRIDE {
// Constants are of unknown size if smaller than 33 bits, because
// we're too lazy to wrap every constant in the universe in
// ((IData)#).
@ -161,11 +161,11 @@ private:
}
// NOPs
virtual void visit(AstVar* nodep) {}
virtual void visit(AstVar* nodep) VL_OVERRIDE {}
//--------------------
// Default: Just iterate
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}

View File

@ -136,7 +136,7 @@ private:
std::ofstream* m_ofp; // Output file
string m_prefix;
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
*m_ofp<<m_prefix;
if (nodep->user3()) *m_ofp<<" %%";
else *m_ofp<<" ";
@ -170,7 +170,7 @@ private:
int m_maxLineno;
size_t m_maxFilenameLen;
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
// Keeping line+filename lengths separate is much faster than calling ascii().length()
if (nodep->fileline()->lineno() >= m_maxLineno) {
@ -608,19 +608,22 @@ private:
}
// VISITORS
virtual void visit(AstNodeModule* nodep) {
m_modp = nodep;
iterateChildren(nodep);
m_modp = NULL;
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
AstNodeModule* origModp = m_modp;
{
m_modp = nodep;
iterateChildren(nodep);
}
m_modp = origModp;
}
virtual void visit(AstScope* nodep) {
virtual void visit(AstScope* nodep) VL_OVERRIDE {
UINFO(4," SCOPE "<<nodep<<endl);
m_scopep = nodep;
m_logicVertexp = NULL;
iterateChildren(nodep);
m_scopep = NULL;
}
virtual void visit(AstActive* nodep) {
virtual void visit(AstActive* nodep) VL_OVERRIDE {
// Create required blocks and add to module
UINFO(4," BLOCK "<<nodep<<endl);
AstNode::user2ClearTree();
@ -631,7 +634,7 @@ private:
m_domainp = NULL;
AstNode::user2ClearTree();
}
virtual void visit(AstNodeVarRef* nodep) {
virtual void visit(AstNodeVarRef* nodep) VL_OVERRIDE {
if (m_scopep) {
UASSERT_OBJ(m_logicVertexp, nodep, "Var ref not under a logic block");
AstVarScope* varscp = nodep->varScopep();
@ -659,72 +662,72 @@ private:
}
}
}
virtual void visit(AstAssignDly* nodep) {
virtual void visit(AstAssignDly* nodep) VL_OVERRIDE {
m_inDly = true;
iterateChildren(nodep);
m_inDly = false;
}
virtual void visit(AstSenItem* nodep) {
virtual void visit(AstSenItem* nodep) VL_OVERRIDE {
// Note we look at only AstSenItems, not AstSenGate's
// The gating term of a AstSenGate is normal logic
m_inSenItem = true;
iterateChildren(nodep);
m_inSenItem = false;
}
virtual void visit(AstAlways* nodep) {
virtual void visit(AstAlways* nodep) VL_OVERRIDE {
iterateNewStmt(nodep);
}
virtual void visit(AstAlwaysPublic* nodep) {
virtual void visit(AstAlwaysPublic* nodep) VL_OVERRIDE {
// CDC doesn't care about public variables
}
virtual void visit(AstCFunc* nodep) {
virtual void visit(AstCFunc* nodep) VL_OVERRIDE {
iterateNewStmt(nodep);
}
virtual void visit(AstSenGate* nodep) {
virtual void visit(AstSenGate* nodep) VL_OVERRIDE {
// First handle the clock part will be handled in a minute by visit AstSenItem
// The logic gating term is dealt with as logic
iterateNewStmt(nodep);
}
virtual void visit(AstAssignAlias* nodep) {
virtual void visit(AstAssignAlias* nodep) VL_OVERRIDE {
iterateNewStmt(nodep);
}
virtual void visit(AstAssignW* nodep) {
virtual void visit(AstAssignW* nodep) VL_OVERRIDE {
iterateNewStmt(nodep);
}
// Math that shouldn't cause us to clear hazard
virtual void visit(AstConst* nodep) { }
virtual void visit(AstReplicate* nodep) {
virtual void visit(AstConst* nodep) VL_OVERRIDE { }
virtual void visit(AstReplicate* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
virtual void visit(AstConcat* nodep) {
virtual void visit(AstConcat* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
virtual void visit(AstNot* nodep) {
virtual void visit(AstNot* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
virtual void visit(AstSel* nodep) {
virtual void visit(AstSel* nodep) VL_OVERRIDE {
if (!VN_IS(nodep->lsbp(), Const)) setNodeHazard(nodep);
iterateChildren(nodep);
}
virtual void visit(AstNodeSel* nodep) {
virtual void visit(AstNodeSel* nodep) VL_OVERRIDE {
if (!VN_IS(nodep->bitp(), Const)) setNodeHazard(nodep);
iterateChildren(nodep);
}
// Ignores
virtual void visit(AstInitial* nodep) { }
virtual void visit(AstTraceInc* nodep) { }
virtual void visit(AstCoverToggle* nodep) { }
virtual void visit(AstNodeDType* nodep) { }
virtual void visit(AstInitial* nodep) VL_OVERRIDE { }
virtual void visit(AstTraceInc* nodep) VL_OVERRIDE { }
virtual void visit(AstCoverToggle* nodep) VL_OVERRIDE { }
virtual void visit(AstNodeDType* nodep) VL_OVERRIDE { }
//--------------------
// Default
virtual void visit(AstNodeMath* nodep) {
virtual void visit(AstNodeMath* nodep) VL_OVERRIDE {
setNodeHazard(nodep);
iterateChildren(nodep);
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}

View File

@ -148,13 +148,13 @@ private:
m_statep->m_numStmts += visitor.count();
}
virtual void visit(AstBasicDType* nodep) {
virtual void visit(AstBasicDType* nodep) VL_OVERRIDE {
newChangeDet();
}
virtual void visit(AstPackArrayDType* nodep) {
virtual void visit(AstPackArrayDType* nodep) VL_OVERRIDE {
newChangeDet();
}
virtual void visit(AstUnpackArrayDType* nodep) {
virtual void visit(AstUnpackArrayDType* nodep) VL_OVERRIDE {
for (int index=0; index < nodep->elementsConst(); ++index) {
AstNode* origVEp = m_varEqnp;
AstNode* origNLEp = m_newLvEqnp;
@ -175,7 +175,7 @@ private:
m_newRvEqnp = origNREp;
}
}
virtual void visit(AstNodeUOrStructDType* nodep) {
virtual void visit(AstNodeUOrStructDType* nodep) VL_OVERRIDE {
if (nodep->packedUnsup()) {
newChangeDet();
} else {
@ -185,7 +185,7 @@ private:
<<m_vscp->varp()->prettyNameQ());
}
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
if (debug()) nodep->dumpTree(cout, "-DETECTARRAY-general-");
m_vscp->v3warn(E_DETECTARRAY, "Unsupported: Can't detect changes on complex variable"
@ -247,7 +247,7 @@ private:
}
// VISITORS
virtual void visit(AstNodeModule* nodep) {
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
UINFO(4," MOD "<<nodep<<endl);
if (nodep->isTop()) {
m_statep->m_topModp = nodep;
@ -255,7 +255,7 @@ private:
iterateChildren(nodep);
}
virtual void visit(AstTopScope* nodep) {
virtual void visit(AstTopScope* nodep) VL_OVERRIDE {
UINFO(4," TS "<<nodep<<endl);
// Clearing
AstNode::user1ClearTree();
@ -279,7 +279,7 @@ private:
iterateChildren(nodep);
}
virtual void visit(AstVarScope* nodep) {
virtual void visit(AstVarScope* nodep) VL_OVERRIDE {
if (nodep->isCircular()) {
UINFO(8," CIRC "<<nodep<<endl);
if (!nodep->user1SetOnce()) {
@ -287,12 +287,12 @@ private:
}
}
}
virtual void visit(AstNodeMath* nodep) {
virtual void visit(AstNodeMath* nodep) VL_OVERRIDE {
// Short-circuit
}
//--------------------
// Default: Just iterate
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}

View File

@ -135,15 +135,15 @@ private:
cleanp->dtypeFrom(nodep); // Otherwise the AND normally picks LHS
relinkHandle.relink(cleanp);
}
void insureClean(AstNode* nodep) {
void ensureClean(AstNode* nodep) {
computeCppWidth(nodep);
if (!isClean(nodep)) insertClean(nodep);
}
void insureCleanAndNext(AstNode* nodep) {
void ensureCleanAndNext(AstNode* nodep) {
// Editing list, careful looping!
for (AstNode* exprp = nodep; exprp; ) {
AstNode* nextp = exprp->nextp();
insureClean(exprp);
ensureClean(exprp);
exprp = nextp;
}
}
@ -153,10 +153,10 @@ private:
iterateChildren(nodep);
computeCppWidth(nodep);
if (nodep->cleanLhs()) {
insureClean(nodep->lhsp());
ensureClean(nodep->lhsp());
}
if (nodep->cleanRhs()) {
insureClean(nodep->rhsp());
ensureClean(nodep->rhsp());
}
//no setClean.. must do it in each user routine.
}
@ -164,70 +164,73 @@ private:
iterateChildren(nodep);
computeCppWidth(nodep);
if (nodep->cleanLhs()) {
insureClean(nodep->lhsp());
ensureClean(nodep->lhsp());
}
if (nodep->cleanRhs()) {
insureClean(nodep->rhsp());
ensureClean(nodep->rhsp());
}
if (nodep->cleanThs()) {
insureClean(nodep->thsp());
ensureClean(nodep->thsp());
}
//no setClean.. must do it in each user routine.
}
// VISITORS
virtual void visit(AstNodeModule* nodep) {
m_modp = nodep;
iterateChildren(nodep);
m_modp = NULL;
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
AstNodeModule* origModp = m_modp;
{
m_modp = nodep;
iterateChildren(nodep);
}
m_modp = origModp;
}
virtual void visit(AstNodeUniop* nodep) {
virtual void visit(AstNodeUniop* nodep) VL_OVERRIDE {
iterateChildren(nodep);
computeCppWidth(nodep);
if (nodep->cleanLhs()) {
insureClean(nodep->lhsp());
ensureClean(nodep->lhsp());
}
setClean(nodep, nodep->cleanOut());
}
virtual void visit(AstNodeBiop* nodep) {
virtual void visit(AstNodeBiop* nodep) VL_OVERRIDE {
operandBiop(nodep);
setClean(nodep, nodep->cleanOut());
}
virtual void visit(AstAnd* nodep) {
virtual void visit(AstAnd* nodep) VL_OVERRIDE {
operandBiop(nodep);
setClean(nodep, isClean(nodep->lhsp()) || isClean(nodep->rhsp()));
}
virtual void visit(AstXor* nodep) {
virtual void visit(AstXor* nodep) VL_OVERRIDE {
operandBiop(nodep);
setClean(nodep, isClean(nodep->lhsp()) && isClean(nodep->rhsp()));
}
virtual void visit(AstOr* nodep) {
virtual void visit(AstOr* nodep) VL_OVERRIDE {
operandBiop(nodep);
setClean(nodep, isClean(nodep->lhsp()) && isClean(nodep->rhsp()));
}
virtual void visit(AstNodeMath* nodep) {
virtual void visit(AstNodeMath* nodep) VL_OVERRIDE {
iterateChildren(nodep);
computeCppWidth(nodep);
setClean(nodep, nodep->cleanOut());
}
virtual void visit(AstNodeAssign* nodep) {
virtual void visit(AstNodeAssign* nodep) VL_OVERRIDE {
iterateChildren(nodep);
computeCppWidth(nodep);
if (nodep->cleanRhs()) {
insureClean(nodep->rhsp());
ensureClean(nodep->rhsp());
}
}
virtual void visit(AstText* nodep) {
virtual void visit(AstText* nodep) VL_OVERRIDE {
setClean(nodep, true);
}
virtual void visit(AstScopeName* nodep) {
virtual void visit(AstScopeName* nodep) VL_OVERRIDE {
setClean(nodep, true);
}
virtual void visit(AstSel* nodep) {
virtual void visit(AstSel* nodep) VL_OVERRIDE {
operandTriop(nodep);
setClean(nodep, nodep->cleanOut());
}
virtual void visit(AstUCFunc* nodep) {
virtual void visit(AstUCFunc* nodep) VL_OVERRIDE {
iterateChildren(nodep);
computeCppWidth(nodep);
setClean(nodep, false);
@ -235,66 +238,66 @@ private:
if (!VN_IS(nodep->backp(), And)) {
insertClean(nodep);
}
insureCleanAndNext(nodep->bodysp());
ensureCleanAndNext(nodep->bodysp());
}
virtual void visit(AstTraceDecl* nodep) {
virtual void visit(AstTraceDecl* nodep) VL_OVERRIDE {
// No cleaning, or would loose pointer to enum
iterateChildren(nodep);
}
virtual void visit(AstTraceInc* nodep) {
virtual void visit(AstTraceInc* nodep) VL_OVERRIDE {
iterateChildren(nodep);
insureCleanAndNext(nodep->valuep());
ensureCleanAndNext(nodep->valuep());
}
virtual void visit(AstTypedef* nodep) {
virtual void visit(AstTypedef* nodep) VL_OVERRIDE {
// No cleaning, or would loose pointer to enum
iterateChildren(nodep);
}
virtual void visit(AstParamTypeDType* nodep) {
virtual void visit(AstParamTypeDType* nodep) VL_OVERRIDE {
// No cleaning, or would loose pointer to enum
iterateChildren(nodep);
}
// Control flow operators
virtual void visit(AstNodeCond* nodep) {
virtual void visit(AstNodeCond* nodep) VL_OVERRIDE {
iterateChildren(nodep);
insureClean(nodep->condp());
ensureClean(nodep->condp());
setClean(nodep, isClean(nodep->expr1p()) && isClean(nodep->expr2p()));
}
virtual void visit(AstWhile* nodep) {
virtual void visit(AstWhile* nodep) VL_OVERRIDE {
iterateChildren(nodep);
insureClean(nodep->condp());
ensureClean(nodep->condp());
}
virtual void visit(AstNodeIf* nodep) {
virtual void visit(AstNodeIf* nodep) VL_OVERRIDE {
iterateChildren(nodep);
insureClean(nodep->condp());
ensureClean(nodep->condp());
}
virtual void visit(AstSFormatF* nodep) {
virtual void visit(AstSFormatF* nodep) VL_OVERRIDE {
iterateChildren(nodep);
insureCleanAndNext(nodep->exprsp());
ensureCleanAndNext(nodep->exprsp());
setClean(nodep, true); // generates a string, so not relevant
}
virtual void visit(AstUCStmt* nodep) {
virtual void visit(AstUCStmt* nodep) VL_OVERRIDE {
iterateChildren(nodep);
insureCleanAndNext(nodep->bodysp());
ensureCleanAndNext(nodep->bodysp());
}
virtual void visit(AstCCall* nodep) {
virtual void visit(AstCCall* nodep) VL_OVERRIDE {
iterateChildren(nodep);
insureCleanAndNext(nodep->argsp());
ensureCleanAndNext(nodep->argsp());
setClean(nodep, true);
}
virtual void visit(AstCMethodHard* nodep) {
virtual void visit(AstCMethodHard* nodep) VL_OVERRIDE {
iterateChildren(nodep);
insureCleanAndNext(nodep->pinsp());
ensureCleanAndNext(nodep->pinsp());
setClean(nodep, true);
}
virtual void visit(AstIntfRef* nodep) {
virtual void visit(AstIntfRef* nodep) VL_OVERRIDE {
iterateChildren(nodep);
setClean(nodep, true); // generates a string, so not relevant
}
//--------------------
// Default: Just iterate
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
computeCppWidth(nodep);
}

View File

@ -189,7 +189,7 @@ private:
}
// VISITORS
virtual void visit(AstTopScope* nodep) {
virtual void visit(AstTopScope* nodep) VL_OVERRIDE {
UINFO(4," TOPSCOPE "<<nodep<<endl);
m_topScopep = nodep;
m_scopep = nodep->scopep();
@ -254,13 +254,16 @@ private:
m_topScopep = NULL;
m_scopep = NULL;
}
virtual void visit(AstNodeModule* nodep) {
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
//UINFO(4," MOD "<<nodep<<endl);
m_modp = nodep;
iterateChildren(nodep);
m_modp= NULL;
AstNodeModule* origModp = m_modp;
{
m_modp = nodep;
iterateChildren(nodep);
}
m_modp = origModp;
}
virtual void visit(AstScope* nodep) {
virtual void visit(AstScope* nodep) VL_OVERRIDE {
//UINFO(4," SCOPE "<<nodep<<endl);
m_scopep = nodep;
iterateChildren(nodep);
@ -271,7 +274,7 @@ private:
}
m_scopep = NULL;
}
virtual void visit(AstAlways* nodep) {
virtual void visit(AstAlways* nodep) VL_OVERRIDE {
AstNode* cmtp = new AstComment(nodep->fileline(), nodep->typeName(), true);
nodep->replaceWith(cmtp);
if (AstNode* stmtsp = nodep->bodysp()) {
@ -280,7 +283,7 @@ private:
}
VL_DO_DANGLING(nodep->deleteTree(), nodep);
}
virtual void visit(AstAlwaysPost* nodep) {
virtual void visit(AstAlwaysPost* nodep) VL_OVERRIDE {
AstNode* cmtp = new AstComment(nodep->fileline(), nodep->typeName(), true);
nodep->replaceWith(cmtp);
if (AstNode* stmtsp = nodep->bodysp()) {
@ -289,7 +292,7 @@ private:
}
VL_DO_DANGLING(nodep->deleteTree(), nodep);
}
virtual void visit(AstCoverToggle* nodep) {
virtual void visit(AstCoverToggle* nodep) VL_OVERRIDE {
//nodep->dumpTree(cout, "ct:");
//COVERTOGGLE(INC, ORIG, CHANGE) ->
// IF(ORIG ^ CHANGE) { INC; CHANGE = ORIG; }
@ -309,7 +312,7 @@ private:
origp->cloneTree(false)));
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
}
virtual void visit(AstInitial* nodep) {
virtual void visit(AstInitial* nodep) VL_OVERRIDE {
AstNode* cmtp = new AstComment(nodep->fileline(), nodep->typeName(), true);
nodep->replaceWith(cmtp);
if (AstNode* stmtsp = nodep->bodysp()) {
@ -318,7 +321,7 @@ private:
}
VL_DO_DANGLING(nodep->deleteTree(), nodep);
}
virtual void visit(AstCFunc* nodep) {
virtual void visit(AstCFunc* nodep) VL_OVERRIDE {
iterateChildren(nodep);
// Link to global function
if (nodep->formCallTree()) {
@ -328,7 +331,7 @@ private:
m_finalFuncp->addStmtsp(callp);
}
}
virtual void visit(AstSenTree* nodep) {
virtual void visit(AstSenTree* nodep) VL_OVERRIDE {
// Delete it later; Actives still pointing to it
nodep->unlinkFrBack();
pushDeletep(nodep);
@ -342,7 +345,7 @@ private:
void addToInitial(AstNode* stmtsp) {
m_initFuncp->addStmtsp(stmtsp); // add to top level function
}
virtual void visit(AstActive* nodep) {
virtual void visit(AstActive* nodep) VL_OVERRIDE {
// Careful if adding variables here, ACTIVES can be under other ACTIVES
// Need to save and restore any member state in AstUntilStable block
if (!m_topScopep || !nodep->stmtsp()) {
@ -410,7 +413,7 @@ private:
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
}
}
virtual void visit(AstExecGraph* nodep) {
virtual void visit(AstExecGraph* nodep) VL_OVERRIDE {
for (m_mtaskBodyp = VN_CAST(nodep->op1p(), MTaskBody);
m_mtaskBodyp;
m_mtaskBodyp = VN_CAST(m_mtaskBodyp->nextp(), MTaskBody)) {
@ -427,7 +430,7 @@ private:
//--------------------
// Default: Just iterate
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}

View File

@ -66,7 +66,7 @@ protected:
static bool emptyFunctionDeletion() { return true; }
static bool duplicateFunctionCombine() { return true; }
// Note this is disabled, it still needed work
// Also repair it for DPI functions; when make __common need to insure proper
// Also repair it for DPI functions; when make __common need to ensure proper
// flags get inherited from the old to new AstCFunc, and that AstText doesn't
// get split between functions causing the text to have a dangling reference.
bool statementCombine() { return false; } // duplicateFunctionCombine();
@ -131,13 +131,13 @@ public:
}
private:
// VISITORS
virtual void visit(AstCCall* nodep) {
virtual void visit(AstCCall* nodep) VL_OVERRIDE {
addCall(nodep);
}
// Speed things up
virtual void visit(AstNodeAssign* nodep) {}
virtual void visit(AstNodeMath* nodep) {}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNodeAssign* nodep) VL_OVERRIDE {}
virtual void visit(AstNodeMath* nodep) VL_OVERRIDE {}
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:
@ -160,7 +160,7 @@ private:
// OUTPUT:
// AstNode::user3() -> bool. True to indicate duplicated
// VISITORS
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
nodep->user3(true);
iterateChildren(nodep);
}
@ -389,7 +389,7 @@ private:
}
// VISITORS
virtual void visit(AstNetlist* nodep) {
virtual void visit(AstNetlist* nodep) VL_OVERRIDE {
// Track all callers of each function
m_call.main(nodep);
//
@ -398,7 +398,7 @@ private:
// Required so that a module instantiating another can benefit from collapsing.
iterateChildrenBackwards(nodep);
}
virtual void visit(AstNodeModule* nodep) {
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
UINFO(4," MOD "<<nodep<<endl);
m_modp = nodep;
m_modNFuncs = 0;
@ -427,7 +427,7 @@ private:
}
m_modp = NULL;
}
virtual void visit(AstCFunc* nodep) {
virtual void visit(AstCFunc* nodep) VL_OVERRIDE {
m_funcp = nodep;
if (!nodep->dontCombine()) {
if (m_state == STATE_HASH) {
@ -438,7 +438,7 @@ private:
}
m_funcp = NULL;
}
virtual void visit(AstNodeStmt* nodep) {
virtual void visit(AstNodeStmt* nodep) VL_OVERRIDE {
if (!nodep->isStatement()) {
iterateChildren(nodep);
return;
@ -453,10 +453,10 @@ private:
//--------------------
// Default: Just iterate
virtual void visit(AstVar*) {}
virtual void visit(AstTraceDecl*) {}
virtual void visit(AstTraceInc*) {}
virtual void visit(AstNode* nodep) {
virtual void visit(AstVar*) VL_OVERRIDE {}
virtual void visit(AstTraceDecl*) VL_OVERRIDE {}
virtual void visit(AstTraceInc*) VL_OVERRIDE {}
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}

View File

@ -165,7 +165,7 @@ typedef V3ConfigWildcardResolver<V3ConfigFTask> V3ConfigFTaskResolver;
// Modules have tasks, variables, named blocks and properties
class V3ConfigModule {
typedef std::unordered_set<string> StringSet;
typedef vl_unordered_set<string> StringSet;
V3ConfigFTaskResolver m_tasks; // Functions/tasks in module
V3ConfigVarResolver m_vars; // Variables in module
@ -290,8 +290,10 @@ class V3ConfigFile {
}
public:
V3ConfigFile() { m_lastIgnore = {-1, m_ignLines.begin()}; }
V3ConfigFile() {
m_lastIgnore.lineno = -1;
m_lastIgnore.it = m_ignLines.begin();
}
void update(const V3ConfigFile& file) {
// Copy in all Attributes
for (LineAttrMap::const_iterator it = file.m_lineAttrs.begin();
@ -455,7 +457,7 @@ void V3Config::addVarAttr(FileLine* fl, const string& module, const string& ftas
if (ftask.empty()) {
mod.vars().at(var).push_back(V3ConfigVarAttr(attr, sensep));
} else {
mod.ftasks().at(ftask).vars().at(var).push_back({attr, sensep});
mod.ftasks().at(ftask).vars().at(var).push_back(V3ConfigVarAttr(attr, sensep));
}
}
}

View File

@ -46,10 +46,10 @@ class ConstVarMarkVisitor : public AstNVisitor {
// AstVar::user4p -> bool, Var marked, 0=not set yet
private:
// VISITORS
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
if (nodep->varp()) nodep->varp()->user4(1);
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:
@ -68,10 +68,10 @@ class ConstVarFindVisitor : public AstNVisitor {
bool m_found;
private:
// VISITORS
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
if (nodep->varp() && nodep->varp()->user4()) m_found = true;
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:
@ -1282,23 +1282,26 @@ private:
//----------------------------------------
// VISITORS
virtual void visit(AstNetlist* nodep) {
virtual void visit(AstNetlist* nodep) VL_OVERRIDE {
// Iterate modules backwards, in bottom-up order. That's faster
iterateChildrenBackwards(nodep);
}
virtual void visit(AstNodeModule* nodep) {
m_modp = nodep;
iterateChildren(nodep);
m_modp = NULL;
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
AstNodeModule* origModp = m_modp;
{
m_modp = nodep;
iterateChildren(nodep);
}
m_modp = origModp;
}
virtual void visit(AstCFunc* nodep) {
virtual void visit(AstCFunc* nodep) VL_OVERRIDE {
// No ASSIGNW removals under funcs, we've long eliminated INITIALs
// (We should perhaps rename the assignw's to just assigns)
m_wremove = false;
iterateChildren(nodep);
m_wremove = true;
}
virtual void visit(AstScope* nodep) {
virtual void visit(AstScope* nodep) VL_OVERRIDE {
// No ASSIGNW removals under scope, we've long eliminated INITIALs
m_scopep = nodep;
m_wremove = false;
@ -1371,16 +1374,16 @@ private:
}
// Special cases
virtual void visit(AstConst* nodep) {} // Already constant
virtual void visit(AstConst* nodep) VL_OVERRIDE {} // Already constant
virtual void visit(AstCell* nodep) {
virtual void visit(AstCell* nodep) VL_OVERRIDE {
if (m_params) {
iterateAndNextNull(nodep->paramsp());
} else {
iterateChildren(nodep);
}
}
virtual void visit(AstPin* nodep) {
virtual void visit(AstPin* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
@ -1568,14 +1571,14 @@ private:
nodep->replaceWith(fromp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
}
virtual void visit(AstAttrOf* nodep) {
virtual void visit(AstAttrOf* nodep) VL_OVERRIDE {
AstAttrOf* oldAttr = m_attrp;
m_attrp = nodep;
iterateChildren(nodep);
m_attrp = oldAttr;
}
virtual void visit(AstArraySel* nodep) {
virtual void visit(AstArraySel* nodep) VL_OVERRIDE {
iterateAndNextNull(nodep->bitp());
if (VN_IS(nodep->bitp(), Const)
&& VN_IS(nodep->fromp(), VarRef)
@ -1601,7 +1604,7 @@ private:
}
m_selp = NULL;
}
virtual void visit(AstNodeVarRef* nodep) {
virtual void visit(AstNodeVarRef* nodep) VL_OVERRIDE {
iterateChildren(nodep);
UASSERT_OBJ(nodep->varp(), nodep, "Not linked");
bool did = false;
@ -1652,7 +1655,7 @@ private:
<<nodep->varp()->prettyNameQ());
}
}
virtual void visit(AstEnumItemRef* nodep) {
virtual void visit(AstEnumItemRef* nodep) VL_OVERRIDE {
iterateChildren(nodep);
UASSERT_OBJ(nodep->itemp(), nodep, "Not linked");
bool did = false;
@ -1677,7 +1680,7 @@ private:
}
}
// virtual void visit(AstCvtPackString* nodep) {
// virtual void visit(AstCvtPackString* nodep) VL_OVERRIDE {
// Not constant propagated (for today) because AstNodeMath::isOpaque is set
// Someday if lower is constant, convert to quoted "string".
@ -1685,7 +1688,7 @@ private:
// Only one if it's not in a list
return (!nodep->nextp() && nodep->backp()->nextp() != nodep);
}
virtual void visit(AstSenItem* nodep) {
virtual void visit(AstSenItem* nodep) VL_OVERRIDE {
iterateChildren(nodep);
if (m_doNConst
&& (VN_IS(nodep->sensp(), Const)
@ -1727,7 +1730,7 @@ private:
"Null sensitivity variable");
}
}
virtual void visit(AstSenGate* nodep) {
virtual void visit(AstSenGate* nodep) VL_OVERRIDE {
iterateChildren(nodep);
if (AstConst* constp = VN_CAST(nodep->rhsp(), Const)) {
if (constp->isZero()) {
@ -1779,7 +1782,7 @@ private:
}
};
virtual void visit(AstSenTree* nodep) {
virtual void visit(AstSenTree* nodep) VL_OVERRIDE {
iterateChildren(nodep);
if (m_doExpensive) {
//cout<<endl; nodep->dumpTree(cout, "ssin: ");
@ -1788,7 +1791,7 @@ private:
// SENTREE(... SENITEM(x), SENGATE(SENITEM(x),*) ...) => SENITEM(x)
// Do we need the SENITEM's to be identical? No because we're
// ORing between them; we just need to insure that the result is at
// ORing between them; we just need to ensure that the result is at
// least as frequently activating. So we simply
// SENGATE(SENITEM(x)) -> SENITEM(x), then let it collapse with the
// other SENITEM(x).
@ -1890,17 +1893,17 @@ private:
//-----
// Zero elimination
virtual void visit(AstNodeAssign* nodep) {
virtual void visit(AstNodeAssign* nodep) VL_OVERRIDE {
iterateChildren(nodep);
if (m_doNConst && replaceNodeAssign(nodep)) return;
}
virtual void visit(AstAssignAlias* nodep) {
virtual void visit(AstAssignAlias* nodep) VL_OVERRIDE {
// Don't perform any optimizations, keep the alias around
}
virtual void visit(AstAssignVarScope* nodep) {
virtual void visit(AstAssignVarScope* nodep) VL_OVERRIDE {
// Don't perform any optimizations, the node won't be linked yet
}
virtual void visit(AstAssignW* nodep) {
virtual void visit(AstAssignW* nodep) VL_OVERRIDE {
iterateChildren(nodep);
if (m_doNConst && replaceNodeAssign(nodep)) return;
AstNodeVarRef* varrefp = VN_CAST(nodep->lhsp(), VarRef); // Not VarXRef, as different refs may set different values to each hierarchy
@ -1927,7 +1930,7 @@ private:
}
}
virtual void visit(AstNodeIf* nodep) {
virtual void visit(AstNodeIf* nodep) VL_OVERRIDE {
iterateChildren(nodep);
if (m_doNConst) {
if (const AstConst* constp = VN_CAST(nodep->condp(), Const)) {
@ -2006,7 +2009,7 @@ private:
}
}
virtual void visit(AstDisplay* nodep) {
virtual void visit(AstDisplay* nodep) VL_OVERRIDE {
// DISPLAY(SFORMAT(text1)),DISPLAY(SFORMAT(text2)) -> DISPLAY(SFORMAT(text1+text2))
iterateChildren(nodep);
if (stmtDisplayDisplay(nodep)) return;
@ -2051,7 +2054,7 @@ private:
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
return true;
}
virtual void visit(AstSFormatF* nodep) {
virtual void visit(AstSFormatF* nodep) VL_OVERRIDE {
// Substitute constants into displays. The main point of this is to
// simplify assertion methodologies which call functions with display's.
// This eliminates a pile of wide temps, and makes the C a whole lot more readable.
@ -2114,17 +2117,17 @@ private:
}
}
virtual void visit(AstFuncRef* nodep) {
virtual void visit(AstFuncRef* nodep) VL_OVERRIDE {
iterateChildren(nodep);
if (m_params) { // Only parameters force us to do constant function call propagation
replaceWithSimulation(nodep);
}
}
virtual void visit(AstArg* nodep) {
virtual void visit(AstArg* nodep) VL_OVERRIDE {
// replaceWithSimulation on the Arg's parent FuncRef replaces these
iterateChildren(nodep);
}
virtual void visit(AstWhile* nodep) {
virtual void visit(AstWhile* nodep) VL_OVERRIDE {
bool oldHasJumpGo = m_hasJumpGo;
m_hasJumpGo = false;
{
@ -2150,19 +2153,19 @@ private:
}
}
}
virtual void visit(AstInitArray* nodep) {
virtual void visit(AstInitArray* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
virtual void visit(AstInitItem* nodep) {
virtual void visit(AstInitItem* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
// These are converted by V3Param. Don't constify as we don't want the
// from() VARREF to disappear, if any.
// If output of a presel didn't get consted, chances are V3Param didn't visit properly
virtual void visit(AstNodePreSel* nodep) {}
virtual void visit(AstNodePreSel* nodep) VL_OVERRIDE {}
// Ignored, can eliminate early
virtual void visit(AstSysIgnore* nodep) {
virtual void visit(AstSysIgnore* nodep) VL_OVERRIDE {
iterateChildren(nodep);
if (m_doNConst) {
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
@ -2170,7 +2173,7 @@ private:
}
// Simplify
virtual void visit(AstBasicDType* nodep) {
virtual void visit(AstBasicDType* nodep) VL_OVERRIDE {
iterateChildren(nodep);
nodep->cvtRangeConst();
}
@ -2178,7 +2181,7 @@ private:
//-----
// Jump elimination
virtual void visit(AstJumpGo* nodep) {
virtual void visit(AstJumpGo* nodep) VL_OVERRIDE {
iterateChildren(nodep);
m_hasJumpGo = true;
if (m_doExpensive) {
@ -2197,7 +2200,7 @@ private:
}
}
virtual void visit(AstJumpLabel* nodep) {
virtual void visit(AstJumpLabel* nodep) VL_OVERRIDE {
// Because JumpLabels disable many optimizations,
// remove JumpLabels that are not pointed to by any AstJumpGos
// Note this assumes all AstJumpGos are underneath the given label; V3Broken asserts this
@ -2543,7 +2546,7 @@ private:
// Note we can't convert EqCase/NeqCase to Eq/Neq here because that would break 3'b1x1==3'b101
//-----
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
// Default: Just iterate
if (m_required) {
if (VN_IS(nodep, NodeDType) || VN_IS(nodep, Range)) {

View File

@ -149,17 +149,21 @@ private:
+"_"+type;
}
// VISITORS - BOTH
virtual void visit(AstNodeModule* nodep) {
m_modp = nodep;
m_inModOff = nodep->isTop(); // Ignore coverage on top module; it's a shell we created
m_fileps.clear();
iterateChildren(nodep);
m_modp = NULL;
m_inModOff = true;
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
AstNodeModule* origModp = m_modp;
bool origInModOff = m_inModOff;
{
m_modp = nodep;
m_inModOff = nodep->isTop(); // Ignore coverage on top module; it's a shell we created
m_fileps.clear();
iterateChildren(nodep);
}
m_modp = origModp;
m_inModOff = origInModOff;
}
// VISITORS - TOGGLE COVERAGE
virtual void visit(AstNodeFTask* nodep) {
virtual void visit(AstNodeFTask* nodep) VL_OVERRIDE {
bool oldtog = m_inToggleOff;
{
m_inToggleOff = true;
@ -167,7 +171,7 @@ private:
}
m_inToggleOff = oldtog;
}
virtual void visit(AstVar* nodep) {
virtual void visit(AstVar* nodep) VL_OVERRIDE {
iterateChildren(nodep);
if (m_modp && !m_inModOff && !m_inToggleOff
&& nodep->fileline()->coverageOn() && v3Global.opt.coverageToggle()) {
@ -303,7 +307,7 @@ private:
}
// VISITORS - LINE COVERAGE
virtual void visit(AstIf* nodep) { // Note not AstNodeIf; other types don't get covered
virtual void visit(AstIf* nodep) VL_OVERRIDE { // Note not AstNodeIf; other types don't get covered
UINFO(4," IF: "<<nodep<<endl);
if (m_checkBlock) {
// An else-if. When we iterate the if, use "elsif" marking
@ -340,7 +344,7 @@ private:
m_checkBlock = true; // Reset as a child may have cleared it
}
}
virtual void visit(AstCaseItem* nodep) {
virtual void visit(AstCaseItem* nodep) VL_OVERRIDE {
UINFO(4," CASEI: "<<nodep<<endl);
if (m_checkBlock && !m_inModOff
&& nodep->fileline()->coverageOn() && v3Global.opt.coverageLine()) {
@ -353,7 +357,7 @@ private:
m_checkBlock = true; // Reset as a child may have cleared it
}
}
virtual void visit(AstCover* nodep) {
virtual void visit(AstCover* nodep) VL_OVERRIDE {
UINFO(4," COVER: "<<nodep<<endl);
m_checkBlock = true; // Always do cover blocks, even if there's a $stop
iterateChildren(nodep);
@ -364,11 +368,11 @@ private:
}
m_checkBlock = true; // Reset as a child may have cleared it
}
virtual void visit(AstStop* nodep) {
virtual void visit(AstStop* nodep) VL_OVERRIDE {
UINFO(4," STOP: "<<nodep<<endl);
m_checkBlock = false;
}
virtual void visit(AstPragma* nodep) {
virtual void visit(AstPragma* nodep) VL_OVERRIDE {
if (nodep->pragType() == AstPragmaType::COVERAGE_BLOCK_OFF) {
// Skip all NEXT nodes under this block, and skip this if/case branch
UINFO(4," OFF: "<<nodep<<endl);
@ -378,7 +382,7 @@ private:
if (m_checkBlock) iterateChildren(nodep);
}
}
virtual void visit(AstBegin* nodep) {
virtual void visit(AstBegin* nodep) VL_OVERRIDE {
// Record the hierarchy of any named begins, so we can apply to user
// coverage points. This is because there may be cov points inside
// generate blocks; each point should get separate consideration.
@ -398,7 +402,7 @@ private:
}
// VISITORS - BOTH
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
// Default: Just iterate
if (m_checkBlock) {
iterateChildren(nodep);

View File

@ -102,19 +102,19 @@ private:
}
// VISITORS
virtual void visit(AstNetlist* nodep) {
virtual void visit(AstNetlist* nodep) VL_OVERRIDE {
// Find all Coverage's
iterateChildren(nodep);
// Simplify
detectDuplicates();
}
virtual void visit(AstCoverToggle* nodep) {
virtual void visit(AstCoverToggle* nodep) VL_OVERRIDE {
m_toggleps.push_back(nodep);
iterateChildren(nodep);
}
//--------------------
virtual void visit(AstNodeMath* nodep) {} // Accelerate
virtual void visit(AstNode* nodep) {
virtual void visit(AstNodeMath* nodep) VL_OVERRIDE {} // Accelerate
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}

View File

@ -57,13 +57,13 @@ private:
// NODE STATE
// ** Shared with DeadVisitor **
// VISITORS
virtual void visit(AstCell* nodep) {
virtual void visit(AstCell* nodep) VL_OVERRIDE {
iterateChildren(nodep);
nodep->modp()->user1Inc(-1);
}
//-----
virtual void visit(AstNodeMath* nodep) {} // Accelerate
virtual void visit(AstNode* nodep) {
virtual void visit(AstNodeMath* nodep) VL_OVERRIDE {} // Accelerate
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:
@ -133,20 +133,23 @@ private:
}
// VISITORS
virtual void visit(AstNodeModule* nodep) {
m_modp = nodep;
if (!nodep->dead()) {
iterateChildren(nodep);
checkAll(nodep);
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
AstNodeModule* origModp = m_modp;
{
m_modp = nodep;
if (!nodep->dead()) {
iterateChildren(nodep);
checkAll(nodep);
}
}
m_modp = NULL;
m_modp = origModp;
}
virtual void visit(AstCFunc* nodep) {
virtual void visit(AstCFunc* nodep) VL_OVERRIDE {
iterateChildren(nodep);
checkAll(nodep);
if (nodep->scopep()) nodep->scopep()->user1Inc();
}
virtual void visit(AstScope* nodep) {
virtual void visit(AstScope* nodep) VL_OVERRIDE {
iterateChildren(nodep);
checkAll(nodep);
if (nodep->aboveScopep()) nodep->aboveScopep()->user1Inc();
@ -155,14 +158,14 @@ private:
m_scopesp.push_back(nodep);
}
}
virtual void visit(AstCell* nodep) {
virtual void visit(AstCell* nodep) VL_OVERRIDE {
iterateChildren(nodep);
checkAll(nodep);
m_cellsp.push_back(nodep);
nodep->modp()->user1Inc();
}
virtual void visit(AstNodeVarRef* nodep) {
virtual void visit(AstNodeVarRef* nodep) VL_OVERRIDE {
iterateChildren(nodep);
checkAll(nodep);
if (nodep->varScopep()) {
@ -177,7 +180,7 @@ private:
else nodep->packagep()->user1Inc();
}
}
virtual void visit(AstNodeFTaskRef* nodep) {
virtual void visit(AstNodeFTaskRef* nodep) VL_OVERRIDE {
iterateChildren(nodep);
checkAll(nodep);
if (nodep->packagep()) {
@ -185,7 +188,7 @@ private:
else nodep->packagep()->user1Inc();
}
}
virtual void visit(AstRefDType* nodep) {
virtual void visit(AstRefDType* nodep) VL_OVERRIDE {
iterateChildren(nodep);
checkDType(nodep);
checkAll(nodep);
@ -194,12 +197,12 @@ private:
else nodep->packagep()->user1Inc();
}
}
virtual void visit(AstNodeDType* nodep) {
virtual void visit(AstNodeDType* nodep) VL_OVERRIDE {
iterateChildren(nodep);
checkDType(nodep);
checkAll(nodep);
}
virtual void visit(AstEnumItemRef* nodep) {
virtual void visit(AstEnumItemRef* nodep) VL_OVERRIDE {
iterateChildren(nodep);
checkAll(nodep);
if (nodep->packagep()) {
@ -208,7 +211,7 @@ private:
}
checkAll(nodep);
}
virtual void visit(AstModport* nodep) {
virtual void visit(AstModport* nodep) VL_OVERRIDE {
iterateChildren(nodep);
if (m_elimCells) {
if (!nodep->varsp()) {
@ -218,7 +221,7 @@ private:
}
checkAll(nodep);
}
virtual void visit(AstTypedef* nodep) {
virtual void visit(AstTypedef* nodep) VL_OVERRIDE {
iterateChildren(nodep);
if (m_elimCells && !nodep->attrPublic()) {
VL_DO_DANGLING(pushDeletep(nodep->unlinkFrBack()), nodep);
@ -229,7 +232,7 @@ private:
// Normal modules may disappear, e.g. if they are parameterized then removed
if (nodep->attrPublic() && m_modp && VN_IS(m_modp, Package)) m_modp->user1Inc();
}
virtual void visit(AstVarScope* nodep) {
virtual void visit(AstVarScope* nodep) VL_OVERRIDE {
iterateChildren(nodep);
checkAll(nodep);
if (nodep->scopep()) nodep->scopep()->user1Inc();
@ -237,7 +240,7 @@ private:
m_vscsp.push_back(nodep);
}
}
virtual void visit(AstVar* nodep) {
virtual void visit(AstVar* nodep) VL_OVERRIDE {
iterateChildren(nodep);
checkAll(nodep);
if (nodep->isSigPublic() && m_modp && VN_IS(m_modp, Package)) m_modp->user1Inc();
@ -245,7 +248,7 @@ private:
m_varsp.push_back(nodep);
}
}
virtual void visit(AstNodeAssign* nodep) {
virtual void visit(AstNodeAssign* nodep) VL_OVERRIDE {
// See if simple assignments to variables may be eliminated because
// that variable is never used.
// Similar code in V3Life
@ -265,7 +268,7 @@ private:
}
//-----
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
if (nodep->isOutputter()) m_sideEffect = true;
iterateChildren(nodep);
checkAll(nodep);

View File

@ -348,22 +348,22 @@ private:
}
// VISITORS
virtual void visit(AstNetlist* nodep) {
virtual void visit(AstNetlist* nodep) VL_OVERRIDE {
//VV***** We reset all userp() on the netlist
m_modVarMap.clear();
iterateChildren(nodep);
}
virtual void visit(AstScope* nodep) {
virtual void visit(AstScope* nodep) VL_OVERRIDE {
UINFO(4," MOD "<<nodep<<endl);
AstNode::user3ClearTree();
iterateChildren(nodep);
}
virtual void visit(AstCFunc* nodep) {
virtual void visit(AstCFunc* nodep) VL_OVERRIDE {
m_cfuncp = nodep;
iterateChildren(nodep);
m_cfuncp = NULL;
}
virtual void visit(AstActive* nodep) {
virtual void visit(AstActive* nodep) VL_OVERRIDE {
m_activep = nodep;
bool oldinit = m_inInitial;
m_inInitial = nodep->hasInitial();
@ -371,7 +371,7 @@ private:
iterateChildren(nodep);
m_inInitial = oldinit;
}
virtual void visit(AstAssignDly* nodep) {
virtual void visit(AstAssignDly* nodep) VL_OVERRIDE {
m_inDly = true;
m_nextDlyp = VN_CAST(nodep->nextp(), AssignDly); // Next assignment in same block, maybe NULL.
if (m_cfuncp) nodep->v3error("Unsupported: Delayed assignment inside public function/task");
@ -395,7 +395,7 @@ private:
m_nextDlyp = NULL;
}
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
if (!nodep->user2Inc()) { // Not done yet
if (m_inDly && nodep->lvalue()) {
UINFO(4,"AssignDlyVar: "<<nodep<<endl);
@ -444,10 +444,10 @@ private:
}
}
virtual void visit(AstNodeFor* nodep) {
virtual void visit(AstNodeFor* nodep) VL_OVERRIDE {
nodep->v3fatalSrc("For statements should have been converted to while statements in V3Begin");
}
virtual void visit(AstWhile* nodep) {
virtual void visit(AstWhile* nodep) VL_OVERRIDE {
bool oldloop = m_inLoop;
m_inLoop = true;
iterateChildren(nodep);
@ -456,7 +456,7 @@ private:
//--------------------
// Default: Just iterate
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}

View File

@ -82,14 +82,17 @@ private:
}
// VISITORS
virtual void visit(AstNodeModule* nodep) {
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
UINFO(4," MOD "<<nodep<<endl);
m_modp = nodep;
m_funcp = NULL;
iterateChildren(nodep);
m_modp = NULL;
AstNodeModule* origModp = m_modp;
{
m_modp = nodep;
m_funcp = NULL;
iterateChildren(nodep);
}
m_modp = origModp;
}
virtual void visit(AstCFunc* nodep) {
virtual void visit(AstCFunc* nodep) VL_OVERRIDE {
m_funcp = nodep;
m_depth = 0;
m_maxdepth = 0;
@ -103,7 +106,7 @@ private:
iterateChildren(nodep);
m_stmtp = NULL;
}
virtual void visit(AstNodeStmt* nodep) {
virtual void visit(AstNodeStmt* nodep) VL_OVERRIDE {
if (!nodep->isStatement()) {
iterateChildren(nodep);
} else {
@ -111,9 +114,9 @@ private:
}
}
// Operators
virtual void visit(AstNodeTermop* nodep) {
virtual void visit(AstNodeTermop* nodep) VL_OVERRIDE {
}
virtual void visit(AstNodeMath* nodep) {
virtual void visit(AstNodeMath* nodep) VL_OVERRIDE {
// We have some operator defines that use 2 parens, so += 2.
m_depth += 2;
if (m_depth>m_maxdepth) m_maxdepth = m_depth;
@ -140,19 +143,19 @@ private:
m_funcp->isStatic(false);
}
}
virtual void visit(AstUCFunc* nodep) {
virtual void visit(AstUCFunc* nodep) VL_OVERRIDE {
needNonStaticFunc(nodep);
iterateChildren(nodep);
}
virtual void visit(AstUCStmt* nodep) {
virtual void visit(AstUCStmt* nodep) VL_OVERRIDE {
needNonStaticFunc(nodep);
visitStmt(nodep);
}
//--------------------
// Default: Just iterate
virtual void visit(AstVar* nodep) {} // Don't hit varrefs under vars
virtual void visit(AstNode* nodep) {
virtual void visit(AstVar* nodep) VL_OVERRIDE {} // Don't hit varrefs under vars
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}

View File

@ -71,14 +71,17 @@ private:
}
// VISITORS
virtual void visit(AstNodeModule* nodep) {
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
UINFO(4," MOD "<<nodep<<endl);
m_modp = nodep;
m_deepNum = 0;
iterateChildren(nodep);
m_modp = NULL;
AstNodeModule* origModp = m_modp;
{
m_modp = nodep;
m_deepNum = 0;
iterateChildren(nodep);
}
m_modp = origModp;
}
virtual void visit(AstCFunc* nodep) {
virtual void visit(AstCFunc* nodep) VL_OVERRIDE {
// We recurse into this.
int lastDepth = m_depth;
AstCFunc* lastFuncp = m_funcp;
@ -106,7 +109,7 @@ private:
}
m_depth--;
}
virtual void visit(AstNodeStmt* nodep) {
virtual void visit(AstNodeStmt* nodep) VL_OVERRIDE {
if (!nodep->isStatement()) {
iterateChildren(nodep);
} else {
@ -114,11 +117,11 @@ private:
}
}
virtual void visit(AstNodeMath* nodep) {} // Accelerate
virtual void visit(AstNodeMath* nodep) VL_OVERRIDE {} // Accelerate
//--------------------
// Default: Just iterate
virtual void visit(AstVar* nodep) {} // Don't hit varrefs under vars
virtual void visit(AstNode* nodep) {
virtual void visit(AstVar* nodep) VL_OVERRIDE {} // Don't hit varrefs under vars
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}

View File

@ -44,18 +44,18 @@ private:
// NODE STATE
// Cleared entire netlist
// AstCFunc::user() // bool. Indicates processing completed
AstUser1InUse m_inuser1;
AstUser1InUse m_inuser1;
// TYPES
typedef std::multimap<string,AstCFunc*> FuncMmap;
typedef std::multimap<string, AstCFunc*> FuncMmap;
// STATE
AstNodeModule* m_modp; // Current module
AstScope* m_scopep; // Current scope
bool m_modSingleton; // m_modp is only instanced once
bool m_allowThis; // Allow function non-static
bool m_needThis; // Make function non-static
FuncMmap m_modFuncs; // Name of public functions added
AstNodeModule* m_modp; // Current module
AstScope* m_scopep; // Current scope
bool m_modSingleton; // m_modp is only instanced once
bool m_allowThis; // Allow function non-static
bool m_needThis; // Make function non-static
FuncMmap m_modFuncs; // Name of public functions added
// METHODS
VL_DEBUG_FUNC; // Declare debug()
@ -63,7 +63,7 @@ private:
static bool modIsSingleton(AstNodeModule* modp) {
// True iff there's exactly one instance of this module in the design.
int instances = 0;
for (AstNode* stmtp = modp->stmtsp(); stmtp; stmtp=stmtp->nextp()) {
for (AstNode* stmtp = modp->stmtsp(); stmtp; stmtp = stmtp->nextp()) {
if (VN_IS(stmtp, Scope)) {
if (++instances > 1) { return false; }
}
@ -81,8 +81,7 @@ private:
// Sets 'hierThisr' true if the object is local to this scope
// (and could be made into a function-local later in V3Localize),
// false if the object is in another scope.
string descopedName(const AstScope* scopep, bool& hierThisr,
const AstVar* varp=NULL) {
string descopedName(const AstScope* scopep, bool& hierThisr, const AstVar* varp = NULL) {
UASSERT(scopep, "Var/Func not scoped");
hierThisr = (scopep == m_scopep);
@ -97,7 +96,6 @@ private:
//
// Static functions can't use this
if (!m_allowThis) relativeRefOk = false;
//
// Use absolute refs in top-scoped routines, keep them static.
// The DPI callback registration depends on representing top-level
@ -106,18 +104,15 @@ private:
//
// V3Combine wouldn't likely be able to combine top-level
// routines anyway, so there's no harm in keeping these static.
if (m_modp->isTop()) {
relativeRefOk = false;
}
UASSERT_OBJ(m_modp, scopep, "Scope not under module");
if (m_modp->isTop()) relativeRefOk = false;
//
// Use absolute refs if this scope is the only instance of the module.
// Saves a bit of overhead on passing the 'this' pointer, and there's no
// need to be nice to V3Combine when we have only a single instance.
// The risk that this prevents combining identical logic from differently-
// named but identical modules seems low.
if (m_modSingleton) {
relativeRefOk = false;
}
if (m_modSingleton) relativeRefOk = false;
if (varp && varp->isFuncLocal()) {
hierThisr = true;
@ -130,23 +125,21 @@ private:
// Reference to scope of cell directly under this module, can just "cell->"
string name = scopep->name();
string::size_type pos;
if ((pos = name.rfind('.')) != string::npos) {
name.erase(0, pos+1);
}
if ((pos = name.rfind('.')) != string::npos) name.erase(0, pos + 1);
m_needThis = true;
return name+"->";
return name + "->";
} else {
// Reference to something elsewhere, or relative references
// are disabled. Use global variable
UINFO(8," Descope "<<scopep<<endl);
UINFO(8," to "<<scopep->name()<<endl);
UINFO(8," under "<<m_scopep->name()<<endl);
UINFO(8, " Descope " << scopep << endl);
UINFO(8, " to " << scopep->name() << endl);
UINFO(8, " under " << m_scopep->name() << endl);
if (!scopep->aboveScopep()) { // Top
// We could also return "vlSymsp->TOPp->" here, but GCC would
// suspect aliases.
return "vlTOPp->";
} else {
return scopep->nameVlSym()+".";
return scopep->nameVlSym() + ".";
}
}
}
@ -155,64 +148,64 @@ private:
// We recorded all public functions in m_modFuncs.
// If for any given name only one function exists, we can use that function directly.
// If multiple functions exist, we need to select the appropriate scope.
for (FuncMmap::iterator it = m_modFuncs.begin(); it!=m_modFuncs.end(); ++it) {
for (FuncMmap::iterator it = m_modFuncs.begin(); it != m_modFuncs.end(); ++it) {
string name = it->first;
AstCFunc* topFuncp = it->second;
FuncMmap::iterator nextIt1 = it; ++nextIt1;
bool moreOfSame1 = (nextIt1!=m_modFuncs.end() && nextIt1->first == name);
FuncMmap::iterator nextIt1 = it;
++nextIt1;
bool moreOfSame1 = (nextIt1 != m_modFuncs.end() && nextIt1->first == name);
if (moreOfSame1) {
// Multiple functions under this name, need a wrapper function
UINFO(6," Wrapping "<<name<<" multifuncs\n");
UINFO(6, " Wrapping " << name << " multifuncs\n");
AstCFunc* newfuncp = topFuncp->cloneTree(false);
if (newfuncp->initsp()) newfuncp->initsp()->unlinkFrBackWithNext()->deleteTree();
if (newfuncp->stmtsp()) newfuncp->stmtsp()->unlinkFrBackWithNext()->deleteTree();
if (newfuncp->initsp()) newfuncp->initsp()->unlinkFrBackWithNext()->deleteTree();
if (newfuncp->stmtsp()) newfuncp->stmtsp()->unlinkFrBackWithNext()->deleteTree();
if (newfuncp->finalsp()) newfuncp->finalsp()->unlinkFrBackWithNext()->deleteTree();
newfuncp->name(name);
newfuncp->isStatic(false);
newfuncp->addInitsp(
new AstCStmt(newfuncp->fileline(),
EmitCBaseVisitor::symClassVar()+" = this->__VlSymsp;\n"));
newfuncp->addInitsp(new AstCStmt(newfuncp->fileline(),
EmitCBaseVisitor::symTopAssign()+"\n"));
EmitCBaseVisitor::symClassVar() + " = this->__VlSymsp;\n"));
newfuncp->addInitsp(
new AstCStmt(newfuncp->fileline(), EmitCBaseVisitor::symTopAssign() + "\n"));
topFuncp->addNextHere(newfuncp);
// In the body, call each function if it matches the given scope
for (FuncMmap::iterator eachIt = it;
eachIt != m_modFuncs.end() && eachIt->first==name; ++eachIt) {
eachIt != m_modFuncs.end() && eachIt->first == name; ++eachIt) {
it = eachIt;
AstCFunc* funcp = eachIt->second;
FuncMmap::iterator nextIt2 = eachIt; ++nextIt2;
bool moreOfSame = (nextIt2!=m_modFuncs.end() && nextIt2->first == name);
FuncMmap::iterator nextIt2 = eachIt;
++nextIt2;
bool moreOfSame = (nextIt2 != m_modFuncs.end() && nextIt2->first == name);
UASSERT_OBJ(funcp->scopep(), funcp, "Not scoped");
UINFO(6," Wrapping "<<name<<" "<<funcp<<endl);
UINFO(6," at "<<newfuncp->argTypes()<<" und "<<funcp->argTypes()<<endl);
UINFO(6, " Wrapping " << name << " " << funcp << endl);
UINFO(6, " at " << newfuncp->argTypes()
<< " und " << funcp->argTypes() << endl);
funcp->declPrivate(true);
AstNode* argsp = NULL;
for (AstNode* stmtp = newfuncp->argsp(); stmtp; stmtp=stmtp->nextp()) {
for (AstNode* stmtp = newfuncp->argsp(); stmtp; stmtp = stmtp->nextp()) {
if (AstVar* portp = VN_CAST(stmtp, Var)) {
if (portp->isIO() && !portp->isFuncReturn()) {
AstNode* newp = new AstVarRef(portp->fileline(),
portp, portp->isWritable());
if (argsp) argsp = argsp->addNextNull(newp);
else argsp = newp;
AstNode* newp
= new AstVarRef(portp->fileline(), portp, portp->isWritable());
argsp = argsp ? argsp->addNextNull(newp) : newp;
}
}
}
AstNode* returnp = new AstCReturn(funcp->fileline(),
new AstCCall(funcp->fileline(),
funcp, argsp));
AstNode* returnp = new AstCReturn(
funcp->fileline(), new AstCCall(funcp->fileline(), funcp, argsp));
if (moreOfSame) {
AstIf* ifp = new AstIf(funcp->fileline(),
new AstEq(funcp->fileline(),
new AstCMath(funcp->fileline(),
"this", 64),
new AstCMath(funcp->fileline(),
string("&(")
+funcp->scopep()->nameVlSym()
+")", 64)),
returnp, NULL);
AstIf* ifp = new AstIf(
funcp->fileline(),
new AstEq(
funcp->fileline(), new AstCMath(funcp->fileline(), "this", 64),
new AstCMath(funcp->fileline(),
string("&(") + funcp->scopep()->nameVlSym() + ")",
64)),
returnp, NULL);
newfuncp->addStmtsp(ifp);
} else {
newfuncp->addStmtsp(returnp);
@ -220,68 +213,70 @@ private:
}
// Not really any way the user could do this, and we'd need
// to come up with some return value
//newfuncp->addStmtsp(new AstDisplay(newfuncp->fileline(),
// newfuncp->addStmtsp(new AstDisplay(newfuncp->fileline(),
// AstDisplayType::DT_WARNING,
// string("%%Error: ")+name+"() called with bad scope", NULL));
//newfuncp->addStmtsp(new AstStop(newfuncp->fileline()));
if (debug()>=9) newfuncp->dumpTree(cout, " newfunc: ");
// string("%%Error: ")+name+"() called with bad
// scope", NULL));
// newfuncp->addStmtsp(new AstStop(newfuncp->fileline()));
if (debug() >= 9) newfuncp->dumpTree(cout, " newfunc: ");
} else {
// Only a single function under this name, we can simply rename it
UINFO(6," Wrapping "<<name<<" just one "<<topFuncp<<endl);
UINFO(6, " Wrapping " << name << " just one " << topFuncp << endl);
topFuncp->name(name);
}
}
}
// VISITORS
virtual void visit(AstNodeModule* nodep) {
m_modp = nodep;
m_modFuncs.clear();
m_modSingleton = modIsSingleton(m_modp);
iterateChildren(nodep);
makePublicFuncWrappers();
m_modp = NULL;
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
AstNodeModule* origModp = m_modp;
{
m_modp = nodep;
m_modFuncs.clear();
m_modSingleton = modIsSingleton(m_modp);
iterateChildren(nodep);
makePublicFuncWrappers();
}
m_modp = origModp;
}
virtual void visit(AstScope* nodep) {
virtual void visit(AstScope* nodep) VL_OVERRIDE {
m_scopep = nodep;
iterateChildren(nodep);
m_scopep = NULL;
}
virtual void visit(AstVarScope* nodep) {
virtual void visit(AstVarScope* nodep) VL_OVERRIDE {
// Delete the varscope when we're finished
nodep->unlinkFrBack();
pushDeletep(nodep);
}
virtual void visit(AstNodeVarRef* nodep) {
virtual void visit(AstNodeVarRef* nodep) VL_OVERRIDE {
iterateChildren(nodep);
// Convert the hierch name
UASSERT_OBJ(m_scopep, nodep, "Node not under scope");
bool hierThis;
nodep->hiername(descopedName(nodep->varScopep()->scopep(), hierThis/*ref*/,
nodep->hiername(descopedName(nodep->varScopep()->scopep(), hierThis /*ref*/,
nodep->varScopep()->varp()));
nodep->hierThis(hierThis);
nodep->varScopep(NULL);
}
virtual void visit(AstCCall* nodep) {
//UINFO(9," "<<nodep<<endl);
virtual void visit(AstCCall* nodep) VL_OVERRIDE {
// UINFO(9," "<<nodep<<endl);
iterateChildren(nodep);
// Convert the hierch name
UASSERT_OBJ(m_scopep, nodep, "Node not under scope");
UASSERT_OBJ(nodep->funcp()->scopep(), nodep, "CFunc not under scope");
bool hierThis;
nodep->hiername(descopedName(nodep->funcp()->scopep(), hierThis/*ref*/));
nodep->hiername(descopedName(nodep->funcp()->scopep(), hierThis /*ref*/));
// Can't do this, as we may have more calls later
// nodep->funcp()->scopep(NULL);
}
virtual void visit(AstCFunc* nodep) {
virtual void visit(AstCFunc* nodep) VL_OVERRIDE {
if (!nodep->user1()) {
m_needThis = false;
m_allowThis = nodep->isStatic().falseU(); // Non-static or unknown if static
iterateChildren(nodep);
nodep->user1(true);
if (m_needThis) {
nodep->isStatic(false);
}
if (m_needThis) nodep->isStatic(false);
// If it's under a scope, move it up to the top
if (m_scopep) {
nodep->unlinkFrBack();
@ -291,23 +286,22 @@ private:
// There may be multiple public functions by the same name;
// record for later correction or making of shells
m_modFuncs.insert(make_pair(nodep->name(), nodep));
nodep->name(m_scopep->nameDotless() +"__" + nodep->name());
nodep->name(m_scopep->nameDotless() + "__" + nodep->name());
}
}
}
}
virtual void visit(AstVar*) {}
virtual void visit(AstNode* nodep) {
iterateChildren(nodep);
}
virtual void visit(AstVar*) VL_OVERRIDE {}
virtual void visit(AstNode* nodep) VL_OVERRIDE { iterateChildren(nodep); }
public:
// CONSTRUCTORS
explicit DescopeVisitor(AstNetlist* nodep)
: m_modp(NULL),
m_scopep(NULL),
m_modSingleton(false),
m_allowThis(false),
m_needThis(false) {
: m_modp(NULL)
, m_scopep(NULL)
, m_modSingleton(false)
, m_allowThis(false)
, m_needThis(false) {
iterate(nodep);
}
virtual ~DescopeVisitor() {}

File diff suppressed because it is too large Load Diff

View File

@ -56,11 +56,12 @@ public:
static string symClassVar() { return symClassName()+"* __restrict vlSymsp"; }
static string symTopAssign() {
return v3Global.opt.prefix()+"* __restrict vlTOPp VL_ATTR_UNUSED = vlSymsp->TOPp;"; }
static string modClassName(AstNodeModule* modp) { // Return name of current module being processed
if (modp->isTop()) {
static string prefixNameProtect(const AstNode* nodep) { // C++ name with prefix
const AstNodeModule* modp = VN_CAST_CONST(nodep, NodeModule);
if (modp && modp->isTop()) {
return v3Global.opt.prefix();
} else {
return v3Global.opt.modPrefix()+"_"+protect(modp->name());
return v3Global.opt.modPrefix() + "_" + protect(nodep->name());
}
}
static string topClassName() { // Return name of top wrapper module
@ -108,7 +109,7 @@ private:
// MEMBERS
int m_count; // Number of statements
// VISITORS
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
m_count++;
iterateChildren(nodep);
}

View File

@ -40,51 +40,55 @@ class EmitCInlines : EmitCBaseVisitor {
void emitInt();
// VISITORS
virtual void visit(AstBasicDType* nodep) {
virtual void visit(AstBasicDType* nodep) VL_OVERRIDE {
if (nodep->keyword() == AstBasicDTypeKwd::STRING) {
// Request #include <string> via verilated_heavy.h when we create symbol file
v3Global.needHeavy(true);
}
}
virtual void visit(AstAssocArrayDType* nodep) {
virtual void visit(AstAssocArrayDType* nodep) VL_OVERRIDE {
v3Global.needHeavy(true);
iterateChildren(nodep);
}
virtual void visit(AstQueueDType* nodep) {
virtual void visit(AstQueueDType* nodep) VL_OVERRIDE {
v3Global.needHeavy(true);
iterateChildren(nodep);
}
virtual void visit(AstNodeReadWriteMem* nodep) {
virtual void visit(AstNodeReadWriteMem* nodep) VL_OVERRIDE {
v3Global.needHeavy(true);
iterateChildren(nodep);
}
virtual void visit(AstValuePlusArgs* nodep) {
virtual void visit(AstValuePlusArgs* nodep) VL_OVERRIDE {
v3Global.needHeavy(true);
iterateChildren(nodep);
}
virtual void visit(AstAtoN* nodep) {
virtual void visit(AstAtoN* nodep) VL_OVERRIDE {
v3Global.needHeavy(true);
iterateChildren(nodep);
}
virtual void visit(AstPutcN* nodep) {
virtual void visit(AstPutcN* nodep) VL_OVERRIDE {
v3Global.needHeavy(true);
iterateChildren(nodep);
}
virtual void visit(AstGetcN* nodep) {
virtual void visit(AstGetcN* nodep) VL_OVERRIDE {
v3Global.needHeavy(true);
iterateChildren(nodep);
}
virtual void visit(AstSubstrN* nodep) {
virtual void visit(AstGetcRefN* nodep) VL_OVERRIDE {
v3Global.needHeavy(true);
iterateChildren(nodep);
}
virtual void visit(AstCompareNN* nodep) {
virtual void visit(AstSubstrN* nodep) VL_OVERRIDE {
v3Global.needHeavy(true);
iterateChildren(nodep);
}
virtual void visit(AstCompareNN* nodep) VL_OVERRIDE {
v3Global.needHeavy(true);
iterateChildren(nodep);
}
// Default
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
//---------------------------------------

View File

@ -125,8 +125,8 @@ class CMakeEmitter {
*of << "\n### Sources...\n";
std::vector<string> classes_fast, classes_slow, support_fast, support_slow, global;
for (AstFile* nodep = v3Global.rootp()->filesp(); nodep;
nodep = VN_CAST(nodep->nextp(), File)) {
for (AstNodeFile* nodep = v3Global.rootp()->filesp(); nodep;
nodep = VN_CAST(nodep->nextp(), NodeFile)) {
AstCFile* cfilep = VN_CAST(nodep, CFile);
if (cfilep && cfilep->source()) {
if (cfilep->support()) {

View File

@ -244,7 +244,7 @@ class EmitCSyms : EmitCBaseVisitor {
}
// VISITORS
virtual void visit(AstNetlist* nodep) {
virtual void visit(AstNetlist* nodep) VL_OVERRIDE {
// Collect list of scopes
iterateChildren(nodep);
varsExpand();
@ -268,13 +268,16 @@ class EmitCSyms : EmitCBaseVisitor {
if (!m_dpiHdrOnly) emitDpiImp();
}
}
virtual void visit(AstNodeModule* nodep) {
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
nameCheck(nodep);
m_modp = nodep;
iterateChildren(nodep);
m_modp = NULL;
AstNodeModule* origModp = m_modp;
{
m_modp = nodep;
iterateChildren(nodep);
}
m_modp = origModp;
}
virtual void visit(AstCellInline* nodep) {
virtual void visit(AstCellInline* nodep) VL_OVERRIDE {
if (v3Global.opt.vpi()) {
string type = (nodep->origModName() == "__BEGIN__") ? "SCOPE_OTHER"
: "SCOPE_MODULE";
@ -284,18 +287,19 @@ class EmitCSyms : EmitCBaseVisitor {
name_dedot, type)));
}
}
virtual void visit(AstScope* nodep) {
virtual void visit(AstScope* nodep) VL_OVERRIDE {
nameCheck(nodep);
m_scopes.push_back(make_pair(nodep, m_modp));
if (v3Global.opt.vpi() && !nodep->isTop()) {
string name_dedot = AstNode::dedotName(nodep->shortName());
m_vpiScopeCandidates.insert(make_pair(nodep->name(),
ScopeData(scopeSymString(nodep->name()),
nodep->name(), "SCOPE_MODULE")));
name_dedot, "SCOPE_MODULE")));
}
}
virtual void visit(AstScopeName* nodep) {
virtual void visit(AstScopeName* nodep) VL_OVERRIDE {
string name = nodep->scopeSymName();
//UINFO(9,"scnameins sp "<<nodep->name()<<" sp "<<nodep->scopePrettySymName()<<" ss "<<name<<endl);
if (m_scopeNames.find(name) == m_scopeNames.end()) {
@ -315,7 +319,7 @@ class EmitCSyms : EmitCBaseVisitor {
}
}
}
virtual void visit(AstVar* nodep) {
virtual void visit(AstVar* nodep) VL_OVERRIDE {
nameCheck(nodep);
iterateChildren(nodep);
if (nodep->isSigUserRdPublic()
@ -323,13 +327,13 @@ class EmitCSyms : EmitCBaseVisitor {
m_modVars.push_back(make_pair(m_modp, nodep));
}
}
virtual void visit(AstCoverDecl* nodep) {
virtual void visit(AstCoverDecl* nodep) VL_OVERRIDE {
// Assign numbers to all bins, so we know how big of an array to use
if (!nodep->dataDeclNullp()) { // else duplicate we don't need code for
nodep->binNum(m_coverBins++);
}
}
virtual void visit(AstCFunc* nodep) {
virtual void visit(AstCFunc* nodep) VL_OVERRIDE {
nameCheck(nodep);
if (nodep->dpiImport() || nodep->dpiExportWrapper()) {
m_dpis.push_back(nodep);
@ -339,9 +343,9 @@ class EmitCSyms : EmitCBaseVisitor {
m_funcp = NULL;
}
// NOPs
virtual void visit(AstConst*) {}
virtual void visit(AstConst*) VL_OVERRIDE {}
// Default
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
//---------------------------------------
@ -387,7 +391,7 @@ void EmitCSyms::emitSymHdr() {
puts("\n// INCLUDE MODULE CLASSES\n");
for (AstNodeModule* nodep = v3Global.rootp()->modulesp();
nodep; nodep=VN_CAST(nodep->nextp(), NodeModule)) {
puts("#include \""+modClassName(nodep)+".h\"\n");
puts("#include \"" + prefixNameProtect(nodep) + ".h\"\n");
}
if (v3Global.dpi()) {
@ -418,14 +422,14 @@ void EmitCSyms::emitSymHdr() {
puts("\n// SUBCELL STATE\n");
for (std::vector<ScopeModPair>::iterator it = m_scopes.begin(); it != m_scopes.end(); ++it) {
AstScope* scopep = it->first; AstNodeModule* modp = it->second;
AstScope* scopep = it->first;
AstNodeModule* modp = it->second;
if (modp->isTop()) {
ofp()->printf("%-30s ", (modClassName(modp)+"*").c_str());
puts(protectIf(scopep->nameDotless()+"p", scopep->protect())+";\n");
}
else {
ofp()->printf("%-30s ", (modClassName(modp)+"").c_str());
puts(protectIf(scopep->nameDotless(), scopep->protect())+";\n");
ofp()->printf("%-30s ", (prefixNameProtect(modp) + "*").c_str());
puts(protectIf(scopep->nameDotless() + "p", scopep->protect()) + ";\n");
} else {
ofp()->printf("%-30s ", (prefixNameProtect(modp) + "").c_str());
puts(protectIf(scopep->nameDotless(), scopep->protect()) + ";\n");
}
}
@ -521,9 +525,9 @@ void EmitCSyms::emitSymImpPreamble() {
// Includes
puts("#include \""+symClassName()+".h\"\n");
for (AstNodeModule* nodep = v3Global.rootp()->modulesp();
nodep; nodep=VN_CAST(nodep->nextp(), NodeModule)) {
puts("#include \""+modClassName(nodep)+".h\"\n");
for (AstNodeModule* nodep = v3Global.rootp()->modulesp(); nodep;
nodep = VN_CAST(nodep->nextp(), NodeModule)) {
puts("#include \"" + prefixNameProtect(nodep) + ".h\"\n");
}
}
@ -579,13 +583,14 @@ void EmitCSyms::emitSymImp() {
}
puts(" , __Vm_didInit(false)\n");
puts(" // Setup submodule names\n");
char comma=',';
char comma = ',';
for (std::vector<ScopeModPair>::iterator it = m_scopes.begin(); it != m_scopes.end(); ++it) {
AstScope* scopep = it->first; AstNodeModule* modp = it->second;
AstScope* scopep = it->first;
AstNodeModule* modp = it->second;
if (modp->isTop()) {
} else {
puts(string(" ")+comma+" "+protect(scopep->nameDotless()));
puts("(Verilated::catName(topp->name(),");
puts(string(" ") + comma + " " + protect(scopep->nameDotless()));
puts("(Verilated::catName(topp->name(), ");
// The "." is added by catName
putsQuoted(protectWordsIf(scopep->prettyName(), scopep->protect()));
puts("))\n");
@ -599,7 +604,8 @@ void EmitCSyms::emitSymImp() {
puts("TOPp = topp;\n");
puts("// Setup each module's pointers to their submodules\n");
for (std::vector<ScopeModPair>::iterator it = m_scopes.begin(); it != m_scopes.end(); ++it) {
AstScope* scopep = it->first; AstNodeModule* modp = it->second;
AstScope* scopep = it->first;
AstNodeModule* modp = it->second;
if (!modp->isTop()) {
checkSplit(false);
string arrow = scopep->name();
@ -608,10 +614,9 @@ void EmitCSyms::emitSymImp() {
arrow.replace(pos, 1, "->");
}
if (arrow.substr(0, 5) == "TOP->") arrow.replace(0, 5, "TOPp->");
string arrowProt = protectWordsIf(arrow, scopep->protect());
ofp()->printf("%-30s ", arrowProt.c_str());
ofp()->puts(protectWordsIf(arrow, scopep->protect()));
puts(" = &");
puts(protectIf(scopep->nameDotless(), scopep->protect())+";\n");
puts(protectIf(scopep->nameDotless(), scopep->protect()) + ";\n");
++m_numStmts;
}
}
@ -619,7 +624,8 @@ void EmitCSyms::emitSymImp() {
puts("// Setup each module's pointer back to symbol table (for public functions)\n");
puts("TOPp->"+protect("__Vconfigure")+"(this, true);\n");
for (std::vector<ScopeModPair>::iterator it = m_scopes.begin(); it != m_scopes.end(); ++it) {
AstScope* scopep = it->first; AstNodeModule* modp = it->second;
AstScope* scopep = it->first;
AstNodeModule* modp = it->second;
if (!modp->isTop()) {
checkSplit(false);
// first is used by AstCoverDecl's call to __vlCoverInsert
@ -692,7 +698,7 @@ void EmitCSyms::emitSymImp() {
puts(protect("__Vscope_"+scopep->scopeSymName())+".exportInsert(__Vfinal, ");
putsQuoted(funcp->cname()); // Not protected - user asked for import/export
puts(", (void*)(&");
puts(modClassName(modp));
puts(prefixNameProtect(modp));
puts("::");
puts(funcp->nameProtect());
puts("));\n");
@ -774,7 +780,7 @@ void EmitCSyms::emitDpiHdr() {
puts("// DESCR" "IPTION: Verilator output: Prototypes for DPI import and export functions.\n");
puts("//\n");
puts("// Verilator includes this file in all generated .cpp files that use DPI functions.\n");
puts("// Manually include this file where DPI .c import functions are declared to insure\n");
puts("// Manually include this file where DPI .c import functions are declared to ensure\n");
puts("// the C functions match the expectations of the DPI imports.\n");
puts("\n");
puts("#include \"svdpi.h\"\n");

View File

@ -55,7 +55,7 @@ public:
of.puts("VM_THREADS = "); of.puts(cvtToStr(v3Global.opt.threads())); of.puts("\n");
of.puts("# Tracing output mode? 0/1 (from --trace)\n");
of.puts("VM_TRACE = "); of.puts(v3Global.opt.trace()?"1":"0"); of.puts("\n");
of.puts("# Tracing threadeds output mode? 0/1 (from --trace-fst-thread)\n");
of.puts("# Tracing threaded output mode? 0/1 (from --trace-fst-thread)\n");
of.puts("VM_TRACE_THREADED = "); of.puts(v3Global.opt.traceFormat().threaded()
?"1":"0"); of.puts("\n");
@ -101,8 +101,8 @@ public:
else if (support==2 && slow) {
}
else {
for (AstFile* nodep = v3Global.rootp()->filesp();
nodep; nodep = VN_CAST(nodep->nextp(), File)) {
for (AstNodeFile* nodep = v3Global.rootp()->filesp();
nodep; nodep = VN_CAST(nodep->nextp(), NodeFile)) {
AstCFile* cfilep = VN_CAST(nodep, CFile);
if (cfilep && cfilep->source()
&& cfilep->slow()==(slow!=0)

View File

@ -57,15 +57,15 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
}
// VISITORS
virtual void visit(AstNetlist* nodep) {
virtual void visit(AstNetlist* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
virtual void visit(AstNodeModule* nodep) {
putfs(nodep, nodep->verilogKwd()+" "+modClassName(nodep)+";\n");
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
putfs(nodep, nodep->verilogKwd() + " " + prefixNameProtect(nodep) + ";\n");
iterateChildren(nodep);
putqs(nodep, "end"+nodep->verilogKwd()+"\n");
putqs(nodep, "end" + nodep->verilogKwd() + "\n");
}
virtual void visit(AstNodeFTask* nodep) {
virtual void visit(AstNodeFTask* nodep) VL_OVERRIDE {
putfs(nodep, nodep->isFunction() ? "function":"task");
puts(" ");
puts(nodep->prettyName());
@ -75,7 +75,7 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
putqs(nodep, "end\n");
}
virtual void visit(AstBegin* nodep) {
virtual void visit(AstBegin* nodep) VL_OVERRIDE {
if (nodep->unnamed()) {
putbs("begin\n");
} else {
@ -84,22 +84,22 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
iterateChildren(nodep);
puts("end\n");
}
virtual void visit(AstGenerate* nodep) {
virtual void visit(AstGenerate* nodep) VL_OVERRIDE {
putfs(nodep, "generate\n");
iterateChildren(nodep);
putqs(nodep, "end\n");
}
virtual void visit(AstFinal* nodep) {
virtual void visit(AstFinal* nodep) VL_OVERRIDE {
putfs(nodep, "final begin\n");
iterateChildren(nodep);
putqs(nodep, "end\n");
}
virtual void visit(AstInitial* nodep) {
virtual void visit(AstInitial* nodep) VL_OVERRIDE {
putfs(nodep, "initial begin\n");
iterateChildren(nodep);
putqs(nodep, "end\n");
}
virtual void visit(AstAlways* nodep) {
virtual void visit(AstAlways* nodep) VL_OVERRIDE {
putfs(nodep, "always ");
if (m_sensesp) iterateAndNextNull(m_sensesp); // In active
else iterateAndNextNull(nodep->sensesp());
@ -107,7 +107,7 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
iterateAndNextNull(nodep->bodysp());
putqs(nodep, "end\n");
}
virtual void visit(AstAlwaysPublic* nodep) {
virtual void visit(AstAlwaysPublic* nodep) VL_OVERRIDE {
putfs(nodep, "/*verilator public_flat_rw ");
if (m_sensesp) iterateAndNextNull(m_sensesp); // In active
else iterateAndNextNull(nodep->sensesp());
@ -115,37 +115,37 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
iterateAndNextNull(nodep->bodysp());
putqs(nodep, "*/\n");
}
virtual void visit(AstNodeAssign* nodep) {
virtual void visit(AstNodeAssign* nodep) VL_OVERRIDE {
iterateAndNextNull(nodep->lhsp());
putfs(nodep, " "+nodep->verilogKwd()+" ");
iterateAndNextNull(nodep->rhsp());
if (!m_suppressSemi) puts(";\n");
}
virtual void visit(AstAssignDly* nodep) {
virtual void visit(AstAssignDly* nodep) VL_OVERRIDE {
iterateAndNextNull(nodep->lhsp());
putfs(nodep, " <= ");
iterateAndNextNull(nodep->rhsp());
puts(";\n");
}
virtual void visit(AstAssignAlias* nodep) {
virtual void visit(AstAssignAlias* nodep) VL_OVERRIDE {
putbs("alias ");
iterateAndNextNull(nodep->lhsp());
putfs(nodep, " = ");
iterateAndNextNull(nodep->rhsp());
if (!m_suppressSemi) puts(";\n");
}
virtual void visit(AstAssignW* nodep) {
virtual void visit(AstAssignW* nodep) VL_OVERRIDE {
putfs(nodep, "assign ");
iterateAndNextNull(nodep->lhsp());
putbs(" = ");
iterateAndNextNull(nodep->rhsp());
if (!m_suppressSemi) puts(";\n");
}
virtual void visit(AstBreak* nodep) {
virtual void visit(AstBreak* nodep) VL_OVERRIDE {
putbs("break");
if (!m_suppressSemi) puts(";\n");
}
virtual void visit(AstSenTree* nodep) {
virtual void visit(AstSenTree* nodep) VL_OVERRIDE {
// AstSenItem is called for dumping in isolation by V3Order
putfs(nodep, "@(");
for (AstNode* expp=nodep->sensesp(); expp; expp = expp->nextp()) {
@ -154,16 +154,16 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
}
puts(")");
}
virtual void visit(AstSenGate* nodep) {
virtual void visit(AstSenGate* nodep) VL_OVERRIDE {
emitVerilogFormat(nodep, nodep->emitVerilog(), nodep->sensesp(), nodep->rhsp());
}
virtual void visit(AstSenItem* nodep) {
virtual void visit(AstSenItem* nodep) VL_OVERRIDE {
putfs(nodep, "");
puts(nodep->edgeType().verilogKwd());
if (nodep->sensp()) puts(" ");
iterateChildren(nodep);
}
virtual void visit(AstNodeCase* nodep) {
virtual void visit(AstNodeCase* nodep) VL_OVERRIDE {
putfs(nodep, "");
if (const AstCase* casep = VN_CAST(nodep, Case)) {
if (casep->priorityPragma()) puts("priority ");
@ -184,7 +184,7 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
iterateAndNextNull(nodep->itemsp());
putqs(nodep, "endcase\n");
}
virtual void visit(AstCaseItem* nodep) {
virtual void visit(AstCaseItem* nodep) VL_OVERRIDE {
if (nodep->condsp()) {
iterateAndNextNull(nodep->condsp());
} else putbs("default");
@ -192,17 +192,17 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
iterateAndNextNull(nodep->bodysp());
putqs(nodep, "end\n");
}
virtual void visit(AstComment* nodep) {
virtual void visit(AstComment* nodep) VL_OVERRIDE {
puts(string("// ")+nodep->name()+"\n");
iterateChildren(nodep);
}
virtual void visit(AstContinue* nodep) {
virtual void visit(AstContinue* nodep) VL_OVERRIDE {
putbs("continue");
if (!m_suppressSemi) puts(";\n");
}
virtual void visit(AstCoverDecl*) {} // N/A
virtual void visit(AstCoverInc*) {} // N/A
virtual void visit(AstCoverToggle*) {} // N/A
virtual void visit(AstCoverDecl*) VL_OVERRIDE {} // N/A
virtual void visit(AstCoverInc*) VL_OVERRIDE {} // N/A
virtual void visit(AstCoverToggle*) VL_OVERRIDE {} // N/A
void visitNodeDisplay(AstNode* nodep, AstNode* fileOrStrgp,
const string& text, AstNode* exprsp) {
@ -216,28 +216,28 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
}
puts(");\n");
}
virtual void visit(AstDisable* nodep) {
virtual void visit(AstDisable* nodep) VL_OVERRIDE {
putbs("disable "+nodep->name()+";\n");
}
virtual void visit(AstDisplay* nodep) {
virtual void visit(AstDisplay* nodep) VL_OVERRIDE {
visitNodeDisplay(nodep, nodep->filep(), nodep->fmtp()->text(), nodep->fmtp()->exprsp());
}
virtual void visit(AstElabDisplay* nodep) {
virtual void visit(AstElabDisplay* nodep) VL_OVERRIDE {
visitNodeDisplay(nodep, NULL, nodep->fmtp()->text(), nodep->fmtp()->exprsp());
}
virtual void visit(AstFScanF* nodep) {
virtual void visit(AstFScanF* nodep) VL_OVERRIDE {
visitNodeDisplay(nodep, nodep->filep(), nodep->text(), nodep->exprsp());
}
virtual void visit(AstSScanF* nodep) {
virtual void visit(AstSScanF* nodep) VL_OVERRIDE {
visitNodeDisplay(nodep, nodep->fromp(), nodep->text(), nodep->exprsp());
}
virtual void visit(AstSFormat* nodep) {
virtual void visit(AstSFormat* nodep) VL_OVERRIDE {
visitNodeDisplay(nodep, nodep->lhsp(), nodep->fmtp()->text(), nodep->fmtp()->exprsp());
}
virtual void visit(AstSFormatF* nodep) {
virtual void visit(AstSFormatF* nodep) VL_OVERRIDE {
visitNodeDisplay(nodep, NULL, nodep->text(), nodep->exprsp());
}
virtual void visit(AstFOpen* nodep) {
virtual void visit(AstFOpen* nodep) VL_OVERRIDE {
putfs(nodep, nodep->verilogKwd());
putbs(" (");
if (nodep->filep()) iterateAndNextNull(nodep->filep());
@ -247,27 +247,27 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
if (nodep->modep()) iterateAndNextNull(nodep->modep());
puts(");\n");
}
virtual void visit(AstFClose* nodep) {
virtual void visit(AstFClose* nodep) VL_OVERRIDE {
putfs(nodep, nodep->verilogKwd());
putbs(" (");
if (nodep->filep()) iterateAndNextNull(nodep->filep());
puts(");\n");
}
virtual void visit(AstFFlush* nodep) {
virtual void visit(AstFFlush* nodep) VL_OVERRIDE {
putfs(nodep, nodep->verilogKwd());
putbs(" (");
if (nodep->filep()) iterateAndNextNull(nodep->filep());
puts(");\n");
}
virtual void visit(AstJumpGo* nodep) {
virtual void visit(AstJumpGo* nodep) VL_OVERRIDE {
putbs("disable "+cvtToHex(nodep->labelp())+";\n");
}
virtual void visit(AstJumpLabel* nodep) {
virtual void visit(AstJumpLabel* nodep) VL_OVERRIDE {
putbs("begin : "+cvtToHex(nodep)+"\n");
if (nodep->stmtsp()) iterateAndNextNull(nodep->stmtsp());
puts("end\n");
}
virtual void visit(AstNodeReadWriteMem* nodep) {
virtual void visit(AstNodeReadWriteMem* nodep) VL_OVERRIDE {
putfs(nodep, nodep->verilogKwd());
putbs(" (");
if (nodep->filenamep()) iterateAndNextNull(nodep->filenamep());
@ -277,17 +277,17 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
if (nodep->msbp()) { putbs(","); iterateAndNextNull(nodep->msbp()); }
puts(");\n");
}
virtual void visit(AstSysFuncAsTask* nodep) {
virtual void visit(AstSysFuncAsTask* nodep) VL_OVERRIDE {
iterateAndNextNull(nodep->lhsp());
puts(";\n");
}
virtual void visit(AstSysIgnore* nodep) {
virtual void visit(AstSysIgnore* nodep) VL_OVERRIDE {
putfs(nodep, nodep->verilogKwd());
putbs(" (");
iterateAndNextNull(nodep->exprsp());
puts(");\n");
}
virtual void visit(AstNodeFor* nodep) {
virtual void visit(AstNodeFor* nodep) VL_OVERRIDE {
putfs(nodep, "for (");
m_suppressSemi = true;
iterateAndNextNull(nodep->initsp());
@ -300,14 +300,14 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
iterateAndNextNull(nodep->bodysp());
putqs(nodep, "end\n");
}
virtual void visit(AstRepeat* nodep) {
virtual void visit(AstRepeat* nodep) VL_OVERRIDE {
putfs(nodep, "repeat (");
iterateAndNextNull(nodep->countp());
puts(") begin\n");
iterateAndNextNull(nodep->bodysp());
putfs(nodep, "end\n");
}
virtual void visit(AstWhile* nodep) {
virtual void visit(AstWhile* nodep) VL_OVERRIDE {
iterateAndNextNull(nodep->precondsp());
putfs(nodep, "while (");
iterateAndNextNull(nodep->condp());
@ -317,7 +317,7 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
iterateAndNextNull(nodep->precondsp()); // Need to recompute before next loop
putfs(nodep, "end\n");
}
virtual void visit(AstNodeIf* nodep) {
virtual void visit(AstNodeIf* nodep) VL_OVERRIDE {
putfs(nodep, "");
if (const AstIf* ifp = VN_CAST(nodep, If)) {
if (ifp->priorityPragma()) puts("priority ");
@ -335,7 +335,7 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
}
putqs(nodep, "end\n");
}
virtual void visit(AstPast* nodep) {
virtual void visit(AstPast* nodep) VL_OVERRIDE {
putfs(nodep, "$past(");
iterateAndNextNull(nodep->exprp());
if (nodep->ticksp()) {
@ -344,49 +344,49 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
}
puts(")");
}
virtual void visit(AstReturn* nodep) {
virtual void visit(AstReturn* nodep) VL_OVERRIDE {
putfs(nodep, "return ");
iterateAndNextNull(nodep->lhsp());
puts(";\n");
}
virtual void visit(AstStop* nodep) {
virtual void visit(AstStop* nodep) VL_OVERRIDE {
putfs(nodep, "$stop;\n");
}
virtual void visit(AstFinish* nodep) {
virtual void visit(AstFinish* nodep) VL_OVERRIDE {
putfs(nodep, "$finish;\n");
}
virtual void visit(AstText* nodep) {
virtual void visit(AstNodeSimpleText* nodep) VL_OVERRIDE {
if (nodep->tracking() || m_trackText) {
puts(nodep->text());
} else {
putsNoTracking(nodep->text());
}
}
virtual void visit(AstTextBlock* nodep) {
visit(VN_CAST(nodep, Text));
virtual void visit(AstTextBlock* nodep) VL_OVERRIDE {
visit(VN_CAST(nodep, NodeSimpleText));
for (AstNode* childp = nodep->nodesp(); childp; childp = childp->nextp()) {
iterate(childp);
if (nodep->commas() && childp->nextp()) puts(", ");
}
}
virtual void visit(AstScopeName* nodep) {
virtual void visit(AstScopeName* nodep) VL_OVERRIDE {
}
virtual void visit(AstCStmt* nodep) {
virtual void visit(AstCStmt* nodep) VL_OVERRIDE {
putfs(nodep, "$_CSTMT(");
iterateAndNextNull(nodep->bodysp());
puts(");\n");
}
virtual void visit(AstCMath* nodep) {
virtual void visit(AstCMath* nodep) VL_OVERRIDE {
putfs(nodep, "$_CMATH(");
iterateAndNextNull(nodep->bodysp());
puts(");\n");
}
virtual void visit(AstUCStmt* nodep) {
virtual void visit(AstUCStmt* nodep) VL_OVERRIDE {
putfs(nodep, "$c(");
iterateAndNextNull(nodep->bodysp());
puts(");\n");
}
virtual void visit(AstUCFunc* nodep) {
virtual void visit(AstUCFunc* nodep) VL_OVERRIDE {
putfs(nodep, "$c(");
iterateAndNextNull(nodep->bodysp());
puts(")");
@ -444,19 +444,19 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
}
}
virtual void visit(AstNodeTermop* nodep) {
virtual void visit(AstNodeTermop* nodep) VL_OVERRIDE {
emitVerilogFormat(nodep, nodep->emitVerilog());
}
virtual void visit(AstNodeUniop* nodep) {
virtual void visit(AstNodeUniop* nodep) VL_OVERRIDE {
emitVerilogFormat(nodep, nodep->emitVerilog(), nodep->lhsp());
}
virtual void visit(AstNodeBiop* nodep) {
virtual void visit(AstNodeBiop* nodep) VL_OVERRIDE {
emitVerilogFormat(nodep, nodep->emitVerilog(), nodep->lhsp(), nodep->rhsp());
}
virtual void visit(AstNodeTriop* nodep) {
virtual void visit(AstNodeTriop* nodep) VL_OVERRIDE {
emitVerilogFormat(nodep, nodep->emitVerilog(), nodep->lhsp(), nodep->rhsp(), nodep->thsp());
}
virtual void visit(AstAttrOf* nodep) {
virtual void visit(AstAttrOf* nodep) VL_OVERRIDE {
putfs(nodep, "$_ATTROF(");
iterateAndNextNull(nodep->fromp());
if (nodep->dimp()) {
@ -465,7 +465,7 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
}
puts(")");
}
virtual void visit(AstInitArray* nodep) {
virtual void visit(AstInitArray* nodep) VL_OVERRIDE {
putfs(nodep, "`{");
int comma = 0;
const AstInitArray::KeyItemMap& mapr = nodep->map();
@ -479,13 +479,13 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
}
puts("}");
}
virtual void visit(AstNodeCond* nodep) {
virtual void visit(AstNodeCond* nodep) VL_OVERRIDE {
putbs("(");
iterateAndNextNull(nodep->condp()); putfs(nodep, " ? ");
iterateAndNextNull(nodep->expr1p()); putbs(" : ");
iterateAndNextNull(nodep->expr2p()); puts(")");
}
virtual void visit(AstRange* nodep) {
virtual void visit(AstRange* nodep) VL_OVERRIDE {
puts("[");
if (VN_IS(nodep->msbp(), Const) && VN_IS(nodep->lsbp(), Const)) {
// Looks nicer if we print [1:0] rather than [32'sh1:32sh0]
@ -496,7 +496,7 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
iterateAndNextNull(nodep->rightp()); puts("]");
}
}
virtual void visit(AstSel* nodep) {
virtual void visit(AstSel* nodep) VL_OVERRIDE {
iterateAndNextNull(nodep->fromp()); puts("[");
if (VN_IS(nodep->lsbp(), Const)) {
if (nodep->widthp()->isOne()) {
@ -518,44 +518,44 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
}
puts("]");
}
virtual void visit(AstSliceSel* nodep) {
virtual void visit(AstSliceSel* nodep) VL_OVERRIDE {
iterateAndNextNull(nodep->fromp());
puts(cvtToStr(nodep->declRange()));
}
virtual void visit(AstTypedef* nodep) {
virtual void visit(AstTypedef* nodep) VL_OVERRIDE {
putfs(nodep, "typedef ");
iterateAndNextNull(nodep->dtypep()); puts(" ");
puts(nodep->prettyName());
puts(";\n");
}
virtual void visit(AstBasicDType* nodep) {
virtual void visit(AstBasicDType* nodep) VL_OVERRIDE {
if (nodep->isSigned()) putfs(nodep, "signed ");
putfs(nodep, nodep->prettyName());
if (nodep->rangep()) { puts(" "); iterateAndNextNull(nodep->rangep()); puts(" "); }
else if (nodep->isRanged()) { puts(" ["); puts(cvtToStr(nodep->msb())); puts(":0] "); }
}
virtual void visit(AstConstDType* nodep) {
virtual void visit(AstConstDType* nodep) VL_OVERRIDE {
putfs(nodep, "const ");
iterate(nodep->subDTypep());
}
virtual void visit(AstNodeArrayDType* nodep) {
virtual void visit(AstNodeArrayDType* nodep) VL_OVERRIDE {
iterate(nodep->subDTypep());
iterateAndNextNull(nodep->rangep());
}
virtual void visit(AstNodeUOrStructDType* nodep) {
virtual void visit(AstNodeUOrStructDType* nodep) VL_OVERRIDE {
puts(nodep->verilogKwd()+" ");
if (nodep->packed()) puts("packed ");
puts("\n");
iterateAndNextNull(nodep->membersp());
puts("}");
}
virtual void visit(AstMemberDType* nodep) {
virtual void visit(AstMemberDType* nodep) VL_OVERRIDE {
iterate(nodep->subDTypep());
puts(" ");
puts(nodep->name());
puts("}");
}
virtual void visit(AstNodeFTaskRef* nodep) {
virtual void visit(AstNodeFTaskRef* nodep) VL_OVERRIDE {
if (nodep->dotted()!="") {
putfs(nodep, nodep->dotted()); puts("."); puts(nodep->prettyName());
} else { putfs(nodep, nodep->prettyName()); }
@ -563,11 +563,11 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
iterateAndNextNull(nodep->pinsp());
puts(")");
}
virtual void visit(AstArg* nodep) {
virtual void visit(AstArg* nodep) VL_OVERRIDE {
iterateAndNextNull(nodep->exprp());
}
// Terminals
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
if (nodep->varScopep()) {
putfs(nodep, nodep->varScopep()->prettyName());
} else {
@ -575,43 +575,43 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
puts(nodep->varp()->prettyName());
}
}
virtual void visit(AstVarXRef* nodep) {
virtual void visit(AstVarXRef* nodep) VL_OVERRIDE {
putfs(nodep, nodep->dotted());
puts(".");
puts(nodep->varp()->prettyName());
}
virtual void visit(AstConst* nodep) {
virtual void visit(AstConst* nodep) VL_OVERRIDE {
putfs(nodep, nodep->num().ascii(true, true));
}
// Just iterate
virtual void visit(AstTopScope* nodep) {
virtual void visit(AstTopScope* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
virtual void visit(AstScope* nodep) {
virtual void visit(AstScope* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
virtual void visit(AstVar* nodep) {
virtual void visit(AstVar* nodep) VL_OVERRIDE {
putfs(nodep, nodep->verilogKwd());
puts(" ");
iterate(nodep->dtypep()); puts(" ");
puts(nodep->prettyName());
if (!m_suppressVarSemi) puts(";\n"); else puts("\n");
}
virtual void visit(AstActive* nodep) {
virtual void visit(AstActive* nodep) VL_OVERRIDE {
m_sensesp = nodep->sensesp();
iterateAndNextNull(nodep->stmtsp());
m_sensesp = NULL;
}
virtual void visit(AstVarScope*) {}
virtual void visit(AstNodeText*) {}
virtual void visit(AstTraceDecl*) {}
virtual void visit(AstTraceInc*) {}
virtual void visit(AstVarScope*) VL_OVERRIDE {}
virtual void visit(AstNodeText*) VL_OVERRIDE {}
virtual void visit(AstTraceDecl*) VL_OVERRIDE {}
virtual void visit(AstTraceInc*) VL_OVERRIDE {}
// NOPs
virtual void visit(AstPragma*) {}
virtual void visit(AstCell*) {} // Handled outside the Visit class
virtual void visit(AstPragma*) VL_OVERRIDE {}
virtual void visit(AstCell*) VL_OVERRIDE {} // Handled outside the Visit class
// Default
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
puts(string("\n???? // ")+nodep->prettyTypeName()+"\n");
iterateChildren(nodep);
// Not v3fatalSrc so we keep processing
@ -757,12 +757,12 @@ void V3EmitV::emitv() {
EmitVFileVisitor visitor (v3Global.rootp(), &of);
} else {
// Process each module in turn
for (AstNodeModule* modp = v3Global.rootp()->modulesp();
modp; modp=VN_CAST(modp->nextp(), NodeModule)) {
V3OutVFile of (v3Global.opt.makeDir()
+"/"+EmitCBaseVisitor::modClassName(modp)+"__Vout.v");
for (AstNodeModule* modp = v3Global.rootp()->modulesp(); modp;
modp = VN_CAST(modp->nextp(), NodeModule)) {
V3OutVFile of(v3Global.opt.makeDir() + "/" + EmitCBaseVisitor::prefixNameProtect(modp)
+ "__Vout.v");
of.putsHeader();
EmitVFileVisitor visitor (modp, &of);
EmitVFileVisitor visitor(modp, &of);
}
}
}
@ -779,8 +779,8 @@ void V3EmitV::verilogPrefixedTree(AstNode* nodep, std::ostream& os,
void V3EmitV::emitvFiles() {
UINFO(2,__FUNCTION__<<": "<<endl);
for (AstFile* filep = v3Global.rootp()->filesp(); filep;
filep = VN_CAST(filep->nextp(), File)) {
for (AstNodeFile* filep = v3Global.rootp()->filesp(); filep;
filep = VN_CAST(filep->nextp(), NodeFile)) {
AstVFile* vfilep = VN_CAST(filep, VFile);
if (vfilep && vfilep->tblockp()) {
V3OutVFile of(vfilep->name());

View File

@ -71,6 +71,7 @@ class EmitXmlFileVisitor : public AstNVisitor {
void outputTag(AstNode* nodep, string tag) {
if (tag=="") tag = VString::downcase(nodep->typeName());
puts("<"+tag+" "+nodep->fileline()->xml());
puts(" "+nodep->fileline()->xmlDetailedLocation());
if (VN_IS(nodep, NodeDType)) { puts(" id="); outputId(nodep); }
if (nodep->name()!="") { puts(" name="); putsQuoted(nodep->prettyName()); }
if (nodep->tag()!="") { puts(" tag="); putsQuoted(nodep->tag()); }
@ -94,22 +95,22 @@ class EmitXmlFileVisitor : public AstNVisitor {
}
// VISITORS
virtual void visit(AstAssignW* nodep) {
virtual void visit(AstAssignW* nodep) VL_OVERRIDE {
outputTag(nodep, "contassign"); // IEEE: vpiContAssign
outputChildrenEnd(nodep, "contassign");
}
virtual void visit(AstCell* nodep) {
virtual void visit(AstCell* nodep) VL_OVERRIDE {
outputTag(nodep, "instance"); // IEEE: vpiInstance
puts(" defName="); putsQuoted(nodep->modName()); // IEEE vpiDefName
puts(" origName="); putsQuoted(nodep->origName());
outputChildrenEnd(nodep, "instance");
}
virtual void visit(AstNetlist* nodep) {
virtual void visit(AstNetlist* nodep) VL_OVERRIDE {
puts("<netlist>\n");
iterateChildren(nodep);
puts("</netlist>\n");
}
virtual void visit(AstNodeModule* nodep) {
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
outputTag(nodep, "");
puts(" origName="); putsQuoted(nodep->origName());
if (nodep->level()==1 || nodep->level()==2) // ==2 because we don't add wrapper when in XML mode
@ -117,7 +118,7 @@ class EmitXmlFileVisitor : public AstNVisitor {
if (nodep->modPublic()) puts(" public=\"true\"");
outputChildrenEnd(nodep, "");
}
virtual void visit(AstVar* nodep) {
virtual void visit(AstVar* nodep) VL_OVERRIDE {
AstVarType typ = nodep->varType();
string kw = nodep->verilogKwd();
string vt = nodep->dtypep()->name();
@ -147,7 +148,7 @@ class EmitXmlFileVisitor : public AstNVisitor {
if (nodep->attrSFormat()) puts(" sformat=\"true\"");
outputChildrenEnd(nodep, "");
}
virtual void visit(AstPin* nodep) {
virtual void visit(AstPin* nodep) VL_OVERRIDE {
// What we call a pin in verilator is a port in the IEEE spec.
outputTag(nodep, "port"); // IEEE: vpiPort
if (nodep->modVarp()->isIO()) {
@ -157,26 +158,26 @@ class EmitXmlFileVisitor : public AstNVisitor {
// Children includes vpiHighConn and vpiLowConn; we don't support port bits (yet?)
outputChildrenEnd(nodep, "port");
}
virtual void visit(AstSenItem* nodep) {
virtual void visit(AstSenItem* nodep) VL_OVERRIDE {
outputTag(nodep, "");
puts(" edgeType=\""+cvtToStr(nodep->edgeType().ascii())+"\""); // IEEE vpiTopModule
outputChildrenEnd(nodep, "");
}
virtual void visit(AstModportVarRef* nodep) {
virtual void visit(AstModportVarRef* nodep) VL_OVERRIDE {
// Dump direction for Modport references
string kw = nodep->direction().xmlKwd();
outputTag(nodep, "");
puts(" direction="); putsQuoted(kw);
outputChildrenEnd(nodep, "");
}
virtual void visit(AstVarXRef* nodep) {
virtual void visit(AstVarXRef* nodep) VL_OVERRIDE {
outputTag(nodep, "");
puts(" dotted="); putsQuoted(nodep->dotted());
outputChildrenEnd(nodep, "");
}
// Data types
virtual void visit(AstBasicDType* nodep) {
virtual void visit(AstBasicDType* nodep) VL_OVERRIDE {
outputTag(nodep, "basicdtype");
if (nodep->isRanged()) {
puts(" left=\""+cvtToStr(nodep->left())+"\"");
@ -184,30 +185,30 @@ class EmitXmlFileVisitor : public AstNVisitor {
}
puts("/>\n");
}
virtual void visit(AstIfaceRefDType* nodep) {
virtual void visit(AstIfaceRefDType* nodep) VL_OVERRIDE {
string mpn;
outputTag(nodep, "");
if (nodep->isModport()) mpn = nodep->modportName();
puts(" modportname="); putsQuoted(mpn);
outputChildrenEnd(nodep, "");
}
virtual void visit(AstDisplay* nodep) {
virtual void visit(AstDisplay* nodep) VL_OVERRIDE {
outputTag(nodep, "");
puts(" displaytype="); putsQuoted(nodep->verilogKwd());
outputChildrenEnd(nodep, "");
}
virtual void visit(AstElabDisplay* nodep) {
virtual void visit(AstElabDisplay* nodep) VL_OVERRIDE {
outputTag(nodep, "");
puts(" displaytype="); putsQuoted(nodep->verilogKwd());
outputChildrenEnd(nodep, "");
}
virtual void visit(AstExtend* nodep) {
virtual void visit(AstExtend* nodep) VL_OVERRIDE {
outputTag(nodep, "");
puts(" width="); putsQuoted(cvtToStr(nodep->width()));
puts(" widthminv="); putsQuoted(cvtToStr(nodep->lhsp()->widthMinV()));
outputChildrenEnd(nodep, "");
}
virtual void visit(AstExtendS* nodep) {
virtual void visit(AstExtendS* nodep) VL_OVERRIDE {
outputTag(nodep, "");
puts(" width="); putsQuoted(cvtToStr(nodep->width()));
puts(" widthminv="); putsQuoted(cvtToStr(nodep->lhsp()->widthMinV()));
@ -215,7 +216,7 @@ class EmitXmlFileVisitor : public AstNVisitor {
}
// Default
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
outputTag(nodep, "");
outputChildrenEnd(nodep, "");
}
@ -242,11 +243,11 @@ private:
VL_DEBUG_FUNC; // Declare debug()
// VISITORS
virtual void visit(AstNetlist* nodep) {
virtual void visit(AstNetlist* nodep) VL_OVERRIDE {
// Children are iterated backwards to ensure correct compilation order
iterateChildrenBackwards(nodep);
}
virtual void visit(AstNodeModule* nodep) {
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
// Only list modules and interfaces
// Assumes modules and interfaces list is already sorted level wise
if (!nodep->dead()
@ -256,7 +257,7 @@ private:
}
}
//-----
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
// All modules are present at root so no need to iterate on children
}
@ -293,11 +294,12 @@ private:
VL_DEBUG_FUNC; // Declare debug()
// VISITORS
virtual void visit(AstNodeModule* nodep) {
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
if (nodep->level() >= 0
&& nodep->level() <=2 ) { // ==2 because we don't add wrapper when in XML mode
m_os<<"<cells>\n";
m_os<<"<cell "<<nodep->fileline()->xml()
<<" "<<nodep->fileline()->xmlDetailedLocation()
<<" name=\""<<nodep->name()<<"\""
<<" submodname=\""<<nodep->name()<<"\""
<<" hier=\""<<nodep->name()<<"\"";
@ -312,12 +314,13 @@ private:
m_os<<"</cells>\n";
}
}
virtual void visit(AstCell* nodep) {
virtual void visit(AstCell* nodep) VL_OVERRIDE {
if (nodep->modp()->dead()) {
return;
}
if (!m_hasChildren) m_os<<">\n";
m_os<<"<cell "<<nodep->fileline()->xml()
<<" "<<nodep->fileline()->xmlDetailedLocation()
<<" name=\""<<nodep->name()<<"\""
<<" submodname=\""<<nodep->modName()<<"\""
<<" hier=\""<<m_hier+nodep->name()<<"\"";
@ -334,7 +337,7 @@ private:
m_hasChildren = true;
}
//-----
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}

View File

@ -292,8 +292,8 @@ inline void v3errorEndFatal(std::ostringstream& sstr) {
// Theses allow errors using << operators: v3error("foo"<<"bar");
// Careful, you can't put () around msg, as you would in most macro definitions
// Note the commas are the comma operator, not separating arguments. These are needed to insure
// evaluation order as otherwise we couldn't insure v3errorPrep is called first.
// Note the commas are the comma operator, not separating arguments. These are needed to ensure
// evaluation order as otherwise we couldn't ensure v3errorPrep is called first.
#define v3warnCode(code,msg) \
v3errorEnd((V3Error::v3errorPrep(code), (V3Error::v3errorStr()<<msg), V3Error::v3errorStr()));
#define v3warnCodeFatal(code,msg) \

View File

@ -306,7 +306,7 @@ private:
}
// VISITORS
virtual void visit(AstExtend* nodep) {
virtual void visit(AstExtend* nodep) VL_OVERRIDE {
if (nodep->user1SetOnce()) return; // Process once
iterateChildren(nodep);
if (nodep->isWide()) {
@ -343,7 +343,7 @@ private:
return true;
}
virtual void visit(AstSel* nodep) {
virtual void visit(AstSel* nodep) VL_OVERRIDE {
if (nodep->user1SetOnce()) return; // Process once
iterateChildren(nodep);
// Remember, Sel's may have non-integer rhs, so need to optimize for that!
@ -670,7 +670,7 @@ private:
}
}
virtual void visit(AstConcat* nodep) {
virtual void visit(AstConcat* nodep) VL_OVERRIDE {
if (nodep->user1SetOnce()) return; // Process once
iterateChildren(nodep);
if (nodep->isWide()) {
@ -714,7 +714,7 @@ private:
return true;
}
virtual void visit(AstReplicate* nodep) {
virtual void visit(AstReplicate* nodep) VL_OVERRIDE {
if (nodep->user1SetOnce()) return; // Process once
iterateChildren(nodep);
if (nodep->isWide()) {
@ -779,7 +779,7 @@ private:
return true;
}
virtual void visit(AstChangeXor* nodep) {
virtual void visit(AstChangeXor* nodep) VL_OVERRIDE {
if (nodep->user1SetOnce()) return; // Process once
iterateChildren(nodep);
UINFO(8," Wordize ChangeXor "<<nodep<<endl);
@ -819,10 +819,10 @@ private:
VL_DO_DANGLING(replaceWithDelete(nodep, newp), nodep);
}
}
virtual void visit(AstEq* nodep) { visitEqNeq(nodep); }
virtual void visit(AstNeq* nodep) { visitEqNeq(nodep); }
virtual void visit(AstEq* nodep) VL_OVERRIDE { visitEqNeq(nodep); }
virtual void visit(AstNeq* nodep) VL_OVERRIDE { visitEqNeq(nodep); }
virtual void visit(AstRedOr* nodep) {
virtual void visit(AstRedOr* nodep) VL_OVERRIDE {
if (nodep->user1SetOnce()) return; // Process once
iterateChildren(nodep);
if (nodep->lhsp()->isWide()) {
@ -847,7 +847,7 @@ private:
VL_DO_DANGLING(replaceWithDelete(nodep, newp), nodep);
}
}
virtual void visit(AstRedAnd* nodep) {
virtual void visit(AstRedAnd* nodep) VL_OVERRIDE {
if (nodep->user1SetOnce()) return; // Process once
iterateChildren(nodep);
if (nodep->lhsp()->isWide()) {
@ -880,7 +880,7 @@ private:
VL_DO_DANGLING(replaceWithDelete(nodep, newp), nodep);
}
}
virtual void visit(AstRedXor* nodep) {
virtual void visit(AstRedXor* nodep) VL_OVERRIDE {
if (nodep->user1SetOnce()) return; // Process once
iterateChildren(nodep);
if (nodep->lhsp()->isWide()) {
@ -899,7 +899,7 @@ private:
// which the inlined function does nicely.
}
virtual void visit(AstNodeStmt* nodep) {
virtual void visit(AstNodeStmt* nodep) VL_OVERRIDE {
if (nodep->user1SetOnce()) return; // Process once
if (!nodep->isStatement()) {
iterateChildren(nodep);
@ -909,7 +909,7 @@ private:
iterateChildren(nodep);
m_stmtp = NULL;
}
virtual void visit(AstNodeAssign* nodep) {
virtual void visit(AstNodeAssign* nodep) VL_OVERRIDE {
if (nodep->user1SetOnce()) return; // Process once
m_stmtp = nodep;
iterateChildren(nodep);
@ -955,8 +955,8 @@ private:
//--------------------
// Default: Just iterate
virtual void visit(AstVar*) {} // Don't hit varrefs under vars
virtual void visit(AstNode* nodep) {
virtual void visit(AstVar*) VL_OVERRIDE {} // Don't hit varrefs under vars
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}

View File

@ -158,6 +158,15 @@ FileLine::FileLine(FileLine::EmptySecret) {
}
}
const string FileLine::xmlDetailedLocation() const {
return "loc=\"" +
cvtToStr(filenameLetters()) + "," +
cvtToStr(firstLineno()) + "," +
cvtToStr(firstColumn()) + "," +
cvtToStr(lastLineno()) + "," +
cvtToStr(lastColumn()) + "\"";
}
string FileLine::lineDirectiveStrg(int enterExit) const {
char numbuf[20]; sprintf(numbuf, "%d", lastLineno());
char levelbuf[20]; sprintf(levelbuf, "%d", enterExit);

View File

@ -183,6 +183,7 @@ public:
const string filebasenameNoExt() const;
const string profileFuncname() const;
const string xml() const { return "fl=\""+filenameLetters()+cvtToStr(lastLineno())+"\""; }
const string xmlDetailedLocation() const;
string lineDirectiveStrg(int enterExit) const;
// Turn on/off warning messages on this line.

View File

@ -207,7 +207,7 @@ private:
}
}
// VISITORS
virtual void visit(AstNodeVarRef* nodep) {
virtual void visit(AstNodeVarRef* nodep) VL_OVERRIDE {
++m_ops;
iterateChildren(nodep);
// We only allow a LHS ref for the var being set, and a RHS ref for
@ -235,7 +235,7 @@ private:
m_rhsVarRefs.push_back(nodep);
}
}
virtual void visit(AstNodeAssign* nodep) {
virtual void visit(AstNodeAssign* nodep) VL_OVERRIDE {
m_substTreep = nodep->rhsp();
if (!VN_IS(nodep->lhsp(), NodeVarRef)) {
clearSimple("ASSIGN(non-VARREF)");
@ -258,7 +258,7 @@ private:
}
//--------------------
// Default
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
// *** Special iterator
if (!m_isSimple) return; // Fastpath
if (++m_ops > v3Global.opt.gateStmts()) {
@ -388,7 +388,7 @@ private:
void decomposeClkVectors();
// VISITORS
virtual void visit(AstNetlist* nodep) {
virtual void visit(AstNetlist* nodep) VL_OVERRIDE {
iterateChildren(nodep);
//if (debug()>6) m_graph.dump();
if (debug()>6) m_graph.dumpDotFilePrefixed("gate_pre");
@ -419,20 +419,23 @@ private:
consumedMove();
replaceAssigns();
}
virtual void visit(AstNodeModule* nodep) {
m_modp = nodep;
m_activeReducible = true;
iterateChildren(nodep);
m_modp = NULL;
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
AstNodeModule* origModp = m_modp;
{
m_modp = nodep;
m_activeReducible = true;
iterateChildren(nodep);
}
m_modp = origModp;
}
virtual void visit(AstScope* nodep) {
virtual void visit(AstScope* nodep) VL_OVERRIDE {
UINFO(4," SCOPE "<<nodep<<endl);
m_scopep = nodep;
m_logicVertexp = NULL;
iterateChildren(nodep);
m_scopep = NULL;
}
virtual void visit(AstActive* nodep) {
virtual void visit(AstActive* nodep) VL_OVERRIDE {
// Create required blocks and add to module
UINFO(4," BLOCK "<<nodep<<endl);
m_activeReducible = !(nodep->hasClocked()); // Seq logic outputs aren't reducible
@ -443,7 +446,7 @@ private:
m_activep = NULL;
m_activeReducible = true;
}
virtual void visit(AstNodeVarRef* nodep) {
virtual void visit(AstNodeVarRef* nodep) VL_OVERRIDE {
if (m_scopep) {
UASSERT_OBJ(m_logicVertexp, nodep, "Var ref not under a logic block");
AstVarScope* varscp = nodep->varScopep();
@ -469,19 +472,19 @@ private:
}
}
}
virtual void visit(AstAlways* nodep) {
virtual void visit(AstAlways* nodep) VL_OVERRIDE {
iterateNewStmt(nodep, (nodep->isJustOneBodyStmt()?NULL:"Multiple Stmts"), NULL);
}
virtual void visit(AstAlwaysPublic* nodep) {
virtual void visit(AstAlwaysPublic* nodep) VL_OVERRIDE {
bool lastslow = m_inSlow;
m_inSlow = true;
iterateNewStmt(nodep, "AlwaysPublic", NULL);
m_inSlow = lastslow;
}
virtual void visit(AstCFunc* nodep) {
virtual void visit(AstCFunc* nodep) VL_OVERRIDE {
iterateNewStmt(nodep, "User C Function", "User C Function");
}
virtual void visit(AstSenItem* nodep) {
virtual void visit(AstSenItem* nodep) VL_OVERRIDE {
// Note we look at only AstSenItems, not AstSenGate's
// The gating term of a AstSenGate is normal logic
m_inSenItem = true;
@ -492,33 +495,33 @@ private:
}
m_inSenItem = false;
}
virtual void visit(AstSenGate* nodep) {
virtual void visit(AstSenGate* nodep) VL_OVERRIDE {
// First handle the clock part will be handled in a minute by visit AstSenItem
// The logic gating term is dealt with as logic
iterateNewStmt(nodep, "Clock gater", "Clock gater");
}
virtual void visit(AstInitial* nodep) {
virtual void visit(AstInitial* nodep) VL_OVERRIDE {
bool lastslow = m_inSlow;
m_inSlow = true;
iterateNewStmt(nodep, (nodep->isJustOneBodyStmt()?NULL:"Multiple Stmts"), NULL);
m_inSlow = lastslow;
}
virtual void visit(AstAssignAlias* nodep) {
virtual void visit(AstAssignAlias* nodep) VL_OVERRIDE {
iterateNewStmt(nodep, NULL, NULL);
}
virtual void visit(AstAssignW* nodep) {
virtual void visit(AstAssignW* nodep) VL_OVERRIDE {
iterateNewStmt(nodep, NULL, NULL);
}
virtual void visit(AstCoverToggle* nodep) {
virtual void visit(AstCoverToggle* nodep) VL_OVERRIDE {
iterateNewStmt(nodep, "CoverToggle", "CoverToggle");
}
virtual void visit(AstTraceInc* nodep) {
virtual void visit(AstTraceInc* nodep) VL_OVERRIDE {
bool lastslow = m_inSlow;
m_inSlow = true;
iterateNewStmt(nodep, "Tracing", "Tracing");
m_inSlow = lastslow;
}
virtual void visit(AstConcat* nodep) {
virtual void visit(AstConcat* nodep) VL_OVERRIDE {
UASSERT_OBJ(!(VN_IS(nodep->backp(), NodeAssign)
&& VN_CAST(nodep->backp(), NodeAssign)->lhsp()==nodep),
nodep, "Concat on LHS of assignment; V3Const should have deleted it");
@ -527,7 +530,7 @@ private:
//--------------------
// Default
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
if (nodep->isOutputter() && m_logicVertexp) m_logicVertexp->setConsumed("outputter");
}
@ -860,7 +863,7 @@ private:
void hashReplace(AstNode* oldp, AstNode* newp);
// VISITORS
virtual void visit(AstNodeVarRef* nodep) {
virtual void visit(AstNodeVarRef* nodep) VL_OVERRIDE {
if (nodep->varScopep() == m_elimVarScp) {
// Substitute in the new tree
// It's possible we substitute into something that will be reduced more later,
@ -887,7 +890,7 @@ private:
VL_DO_DANGLING(nodep->deleteTree(), nodep);
}
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:
@ -1066,7 +1069,7 @@ private:
bool m_dedupable; // Determined the assign to be dedupable
// VISITORS
virtual void visit(AstNodeAssign* assignp) {
virtual void visit(AstNodeAssign* assignp) VL_OVERRIDE {
if (m_dedupable) {
// I think we could safely dedupe an always block with multiple
// non-blocking statements, but erring on side of caution here
@ -1077,7 +1080,7 @@ private:
}
}
}
virtual void visit(AstAlways* alwaysp) {
virtual void visit(AstAlways* alwaysp) VL_OVERRIDE {
if (m_dedupable) {
if (!m_always) {
m_always = true;
@ -1091,7 +1094,7 @@ private:
// always @(...)
// if (...)
// foo = ...; // or foo <= ...;
virtual void visit(AstNodeIf* ifp) {
virtual void visit(AstNodeIf* ifp) VL_OVERRIDE {
if (m_dedupable) {
if (m_always && !m_ifCondp && !ifp->elsesp()) { //we're under an always, this is the first IF, and there's no else
m_ifCondp = ifp->condp();
@ -1102,10 +1105,10 @@ private:
}
}
virtual void visit(AstComment*) {} // NOP
virtual void visit(AstComment*) VL_OVERRIDE {} // NOP
//--------------------
// Default
virtual void visit(AstNode*) {
virtual void visit(AstNode*) VL_OVERRIDE {
m_dedupable = false;
}
@ -1425,7 +1428,7 @@ private:
bool m_found; // Offset found
// VISITORS
virtual void visit(AstNodeVarRef* nodep) {
virtual void visit(AstNodeVarRef* nodep) VL_OVERRIDE {
UINFO(9,"CLK DECOMP Concat search var (off = "<<m_offset<<") - "<<nodep<<endl);
if (nodep->varScopep() == m_vscp && !nodep->user2() && !m_found) {
// A concatenation may use the same var multiple times
@ -1437,14 +1440,14 @@ private:
}
m_offset += nodep->dtypep()->width();
}
virtual void visit(AstConcat* nodep) {
virtual void visit(AstConcat* nodep) VL_OVERRIDE {
UINFO(9,"CLK DECOMP Concat search (off = "<<m_offset<<") - "<<nodep<<endl);
iterate(nodep->rhsp());
iterate(nodep->lhsp());
}
//--------------------
// Default
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:
@ -1617,7 +1620,7 @@ void GateVisitor::decomposeClkVectors() {
class GateDeassignVisitor : public GateBaseVisitor {
private:
// VISITORS
virtual void visit(AstVarScope* nodep) {
virtual void visit(AstVarScope* nodep) VL_OVERRIDE {
if (AstNodeAssign* assp = VN_CAST(nodep->valuep(), NodeAssign)) {
UINFO(5," Removeassign "<<assp<<endl);
AstNode* valuep = assp->rhsp();
@ -1627,9 +1630,9 @@ private:
}
}
// Speedups
virtual void visit(AstVar* nodep) {}
virtual void visit(AstActive* nodep) {}
virtual void visit(AstNode* nodep) {
virtual void visit(AstVar* nodep) VL_OVERRIDE {}
virtual void visit(AstActive* nodep) VL_OVERRIDE {}
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}

View File

@ -83,7 +83,7 @@ private:
}
// VISITORS
virtual void visit(AstTopScope* nodep) {
virtual void visit(AstTopScope* nodep) VL_OVERRIDE {
AstNode::user2ClearTree(); // user2p() used on entire tree
AstScope* scopep = nodep->scopep();
@ -93,7 +93,7 @@ private:
iterateChildren(nodep);
}
//----
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
// Consumption/generation of a variable,
AstVarScope* vscp = nodep->varScopep();
UASSERT_OBJ(vscp, nodep, "Scope not assigned");
@ -109,19 +109,19 @@ private:
}
}
}
virtual void visit(AstActive* nodep) {
virtual void visit(AstActive* nodep) VL_OVERRIDE {
m_activep = nodep;
UASSERT_OBJ(nodep->sensesp(), nodep, "Unlinked");
iterateChildren(nodep->sensesp()); // iterateAndNext?
m_activep = NULL;
iterateChildren(nodep);
}
virtual void visit(AstCFunc* nodep) {
virtual void visit(AstCFunc* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
//-----
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:
@ -152,7 +152,7 @@ private:
AstNodeModule* m_topModp; // Top module
// VISITORS
virtual void visit(AstTopScope* nodep) {
virtual void visit(AstTopScope* nodep) VL_OVERRIDE {
AstNode::user1ClearTree(); // user1p() used on entire tree
iterateChildren(nodep);
{
@ -161,14 +161,14 @@ private:
GenClkRenameVisitor visitor (nodep, m_topModp);
}
}
virtual void visit(AstNodeModule* nodep) {
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
// Only track the top scopes, not lower level functions
if (nodep->isTop()) {
m_topModp = nodep;
iterateChildren(nodep);
}
}
virtual void visit(AstCCall* nodep) {
virtual void visit(AstCCall* nodep) VL_OVERRIDE {
iterateChildren(nodep);
if (!nodep->funcp()->entryPoint()) {
// Enter the function and trace it
@ -176,7 +176,7 @@ private:
iterate(nodep->funcp());
}
}
virtual void visit(AstCFunc* nodep) {
virtual void visit(AstCFunc* nodep) VL_OVERRIDE {
if (!m_tracingCall && !nodep->entryPoint()) {
// Only consider logic within a CFunc when looking
// at the call to it, and not when scanning whatever
@ -188,7 +188,7 @@ private:
}
//----
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
// Consumption/generation of a variable,
AstVarScope* vscp = nodep->varScopep();
UASSERT_OBJ(vscp, nodep, "Scope not assigned");
@ -203,13 +203,13 @@ private:
vscp->circular(true);
}
}
virtual void visit(AstNodeAssign* nodep) {
virtual void visit(AstNodeAssign* nodep) VL_OVERRIDE {
//UINFO(8,"ASS "<<nodep<<endl);
m_assignp = nodep;
iterateChildren(nodep);
m_assignp = NULL;
}
virtual void visit(AstActive* nodep) {
virtual void visit(AstActive* nodep) VL_OVERRIDE {
UINFO(8,"ACTIVE "<<nodep<<endl);
m_activep = nodep;
UASSERT_OBJ(nodep->sensesp(), nodep, "Unlinked");
@ -219,8 +219,8 @@ private:
}
//-----
virtual void visit(AstVar*) {} // Don't want varrefs under it
virtual void visit(AstNode* nodep) {
virtual void visit(AstVar*) VL_OVERRIDE {} // Don't want varrefs under it
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:

86
src/V3Global.cpp Normal file
View File

@ -0,0 +1,86 @@
// -*- mode: C++; c-file-style: "cc-mode" -*-
//*************************************************************************
// DESCRIPTION: Verilator: Common implemenetations
//
// Code available from: https://verilator.org
//
//*************************************************************************
//
// Copyright 2004-2020 by Wilson Snyder. This program is free software; you can
// redistribute it and/or modify it under the terms of either the GNU
// Lesser General Public License Version 3 or the Perl Artistic License
// Version 2.0.
//
// Verilator is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//*************************************************************************
#include "config_build.h"
#include "verilatedos.h"
#include "V3Global.h"
#include "V3Ast.h"
#include "V3File.h"
#include "V3LinkCells.h"
#include "V3Parse.h"
#include "V3ParseSym.h"
#include "V3Stats.h"
//######################################################################
// V3 Class -- top level
AstNetlist* V3Global::makeNetlist() {
AstNetlist* newp = new AstNetlist();
newp->addTypeTablep(new AstTypeTable(newp->fileline()));
return newp;
}
void V3Global::checkTree() { rootp()->checkTree(); }
void V3Global::clear() {
if (m_rootp) VL_DO_CLEAR(m_rootp->deleteTree(), m_rootp = NULL);
}
void V3Global::readFiles() {
// NODE STATE
// AstNode::user4p() // VSymEnt* Package and typedef symbol names
AstUser4InUse inuser4;
VInFilter filter(v3Global.opt.pipeFilter());
V3ParseSym parseSyms(v3Global.rootp()); // Symbol table must be common across all parsing
V3Parse parser(v3Global.rootp(), &filter, &parseSyms);
// Read top module
const V3StringList& vFiles = v3Global.opt.vFiles();
for (V3StringList::const_iterator it = vFiles.begin(); it != vFiles.end(); ++it) {
string filename = *it;
parser.parseFile(new FileLine(FileLine::commandLineFilename()), filename, false,
"Cannot find file containing module: ");
}
// Read libraries
// To be compatible with other simulators,
// this needs to be done after the top file is read
const V3StringSet& libraryFiles = v3Global.opt.libraryFiles();
for (V3StringSet::const_iterator it = libraryFiles.begin(); it != libraryFiles.end(); ++it) {
string filename = *it;
parser.parseFile(new FileLine(FileLine::commandLineFilename()), filename, true,
"Cannot find file containing library module: ");
}
// v3Global.rootp()->dumpTreeFile(v3Global.debugFilename("parse.tree"));
V3Error::abortIfErrors();
if (!v3Global.opt.preprocOnly()) {
// Resolve all modules cells refer to
V3LinkCells::link(v3Global.rootp(), &filter, &parseSyms);
}
}
void V3Global::dumpCheckGlobalTree(const string& stagename, int newNumber, bool doDump) {
v3Global.rootp()->dumpTreeFile(v3Global.debugFilename(stagename + ".tree", newNumber),
false, doDump);
if (v3Global.opt.stats()) V3Stats::statsStage(stagename);
}

View File

@ -104,6 +104,7 @@ public:
// METHODS
void clear(); // Empty it of all vertices/edges, as if making a new object
void clearColors();
bool empty() const { return m_vertices.empty(); }
V3GraphVertex* verticesBeginp() const { return m_vertices.begin(); }
@ -270,7 +271,7 @@ class V3GraphEdge {
// Wires/variables aren't edges. Edges have only a single to/from vertex
public:
// ENUMS
enum Cuttable { NOT_CUTABLE = false, CUTABLE = true }; // For passing to V3GraphEdge
enum Cutable { NOT_CUTABLE = false, CUTABLE = true }; // For passing to V3GraphEdge
protected:
friend class V3Graph; friend class V3GraphVertex;
friend class GraphAcyc; friend class GraphAcycEdge;

View File

@ -88,10 +88,10 @@ private:
//--------------------
// Default: Just iterate
virtual void visit(AstVar*) {}
virtual void visit(AstTypedef*) {}
virtual void visit(AstParamTypeDType*) {}
virtual void visit(AstNode* nodep) {
virtual void visit(AstVar*) VL_OVERRIDE {}
virtual void visit(AstTypedef*) VL_OVERRIDE {}
virtual void visit(AstParamTypeDType*) VL_OVERRIDE {}
virtual void visit(AstNode* nodep) VL_OVERRIDE {
nodeHashIterate(nodep);
}

View File

@ -100,7 +100,8 @@ private:
}
// VISITORS
virtual void visit(AstNodeModule* nodep) {
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
UASSERT_OBJ(!m_modp, nodep, "Unsupported: Recursive modules");
m_modp = nodep;
m_allMods.push_back(nodep);
m_modp->user2(CIL_MAYBE);
@ -115,12 +116,12 @@ private:
iterateChildren(nodep);
m_modp = NULL;
}
virtual void visit(AstCell* nodep) {
virtual void visit(AstCell* nodep) VL_OVERRIDE {
nodep->modp()->user3Inc(); // Inc refs
m_instances[m_modp][nodep->modp()]++;
iterateChildren(nodep);
}
virtual void visit(AstPragma* nodep) {
virtual void visit(AstPragma* nodep) VL_OVERRIDE {
if (nodep->pragType() == AstPragmaType::INLINE_MODULE) {
//UINFO(0,"PRAG MARK "<<m_modp<<endl);
if (!m_modp) {
@ -143,27 +144,27 @@ private:
iterateChildren(nodep);
}
}
virtual void visit(AstVarXRef* nodep) {
virtual void visit(AstVarXRef* nodep) VL_OVERRIDE {
// Cleanup link until V3LinkDot can correct it
nodep->varp(NULL);
}
virtual void visit(AstNodeFTaskRef* nodep) {
virtual void visit(AstNodeFTaskRef* nodep) VL_OVERRIDE {
// Cleanup link until V3LinkDot can correct it
if (!nodep->packagep()) nodep->taskp(NULL);
iterateChildren(nodep);
}
virtual void visit(AstAlways* nodep) {
virtual void visit(AstAlways* nodep) VL_OVERRIDE {
iterateChildren(nodep);
m_modp->user4Inc(); // statement count
}
virtual void visit(AstNodeAssign* nodep) {
virtual void visit(AstNodeAssign* nodep) VL_OVERRIDE {
// Don't count assignments, as they'll likely flatten out
// Still need to iterate though to nullify VarXRefs
int oldcnt = m_modp->user4();
iterateChildren(nodep);
m_modp->user4(oldcnt);
}
virtual void visit(AstNetlist* nodep) {
virtual void visit(AstNetlist* nodep) VL_OVERRIDE {
// Build user2, user3, and user4 for all modules.
// Also build m_allMods and m_instances.
iterateChildren(nodep);
@ -206,7 +207,7 @@ private:
}
//--------------------
// Default: Just iterate
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
if (m_modp) {
m_modp->user4Inc(); // Inc statement count
@ -242,13 +243,13 @@ private:
VL_DEBUG_FUNC; // Declare debug()
// VISITORS
virtual void visit(AstCell* nodep) {
virtual void visit(AstCell* nodep) VL_OVERRIDE {
nodep->user4p(nodep->clonep());
}
// Accelerate
virtual void visit(AstNodeStmt* nodep) {}
virtual void visit(AstNodeMath* nodep) {}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNodeStmt* nodep) VL_OVERRIDE {}
virtual void visit(AstNodeMath* nodep) VL_OVERRIDE {}
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
@ -280,7 +281,7 @@ private:
VL_DEBUG_FUNC; // Declare debug()
// VISITORS
virtual void visit(AstCellInline* nodep) {
virtual void visit(AstCellInline* nodep) VL_OVERRIDE {
// Inlined cell under the inline cell, need to move to avoid conflicts
nodep->unlinkFrBack();
m_modp->addInlinesp(nodep);
@ -291,17 +292,17 @@ private:
// Do CellInlines under this, but don't move them
iterateChildren(nodep);
}
virtual void visit(AstCell* nodep) {
virtual void visit(AstCell* nodep) VL_OVERRIDE {
// Cell under the inline cell, need to rename to avoid conflicts
string name = m_cellp->name() + "__DOT__" + nodep->name();
nodep->name(name);
iterateChildren(nodep);
}
virtual void visit(AstModule* nodep) {
virtual void visit(AstModule* nodep) VL_OVERRIDE {
m_renamedInterfaces.clear();
iterateChildren(nodep);
}
virtual void visit(AstVar* nodep) {
virtual void visit(AstVar* nodep) VL_OVERRIDE {
if (nodep->user2p()) {
// Make an assignment, so we'll trace it properly
// user2p is either a const or a var.
@ -385,17 +386,17 @@ private:
if (debug()>=9 && nodep->valuep()) { nodep->valuep()->dumpTree(cout, "varchangei:"); }
iterateChildren(nodep);
}
virtual void visit(AstNodeFTask* nodep) {
virtual void visit(AstNodeFTask* nodep) VL_OVERRIDE {
// Function under the inline cell, need to rename to avoid conflicts
nodep->name(m_cellp->name() + "__DOT__" + nodep->name());
iterateChildren(nodep);
}
virtual void visit(AstTypedef* nodep) {
virtual void visit(AstTypedef* nodep) VL_OVERRIDE {
// Typedef under the inline cell, need to rename to avoid conflicts
nodep->name(m_cellp->name() + "__DOT__" + nodep->name());
iterateChildren(nodep);
}
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
if (nodep->varp()->user2p() // It's being converted to an alias.
&& !nodep->varp()->user3()
&& !VN_IS(nodep->backp(), AssignAlias)) { // Don't constant propagate aliases (we just made)
@ -416,7 +417,7 @@ private:
nodep->name(nodep->varp()->name());
iterateChildren(nodep);
}
virtual void visit(AstVarXRef* nodep) {
virtual void visit(AstVarXRef* nodep) VL_OVERRIDE {
// Track what scope it was originally under so V3LinkDot can resolve it
string newdots = VString::dot(m_cellp->name(), ".", nodep->inlinedDots());
nodep->inlinedDots(newdots);
@ -435,7 +436,7 @@ private:
}
iterateChildren(nodep);
}
virtual void visit(AstNodeFTaskRef* nodep) {
virtual void visit(AstNodeFTaskRef* nodep) VL_OVERRIDE {
// Track what scope it was originally under so V3LinkDot can resolve it
string newdots = VString::dot(m_cellp->name(), ".", nodep->inlinedDots());
nodep->inlinedDots(newdots);
@ -447,9 +448,9 @@ private:
}
// Not needed, as V3LinkDot doesn't care about typedefs
//virtual void visit(AstRefDType* nodep) {}
//virtual void visit(AstRefDType* nodep) VL_OVERRIDE {}
virtual void visit(AstScopeName* nodep) {
virtual void visit(AstScopeName* nodep) VL_OVERRIDE {
// If there's a %m in the display text, we add a special node that will contain the name()
// Similar code in V3Begin
// To keep correct visual order, must add before other Text's
@ -463,12 +464,12 @@ private:
if (afterp) nodep->scopeEntrp(afterp);
iterateChildren(nodep);
}
virtual void visit(AstCoverDecl* nodep) {
virtual void visit(AstCoverDecl* nodep) VL_OVERRIDE {
// Fix path in coverage statements
nodep->hier(VString::dot(m_cellp->prettyName(), ".", nodep->hier()));
iterateChildren(nodep);
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
@ -512,11 +513,11 @@ private:
VL_DEBUG_FUNC; // Declare debug()
// VISITORS
virtual void visit(AstNetlist* nodep) {
virtual void visit(AstNetlist* nodep) VL_OVERRIDE {
// Iterate modules backwards, in bottom-up order. Required!
iterateChildrenBackwards(nodep);
}
virtual void visit(AstIfaceRefDType* nodep) {
virtual void visit(AstIfaceRefDType* nodep) VL_OVERRIDE {
if (nodep->user5()) {
// The cell has been removed so let's make sure we don't leave a reference to it
// This dtype may still be in use by the AstAssignVarScope created earlier
@ -524,11 +525,15 @@ private:
nodep->cellp(NULL);
}
}
virtual void visit(AstNodeModule* nodep) {
m_modp = nodep;
iterateChildren(nodep);
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
AstNodeModule* origModp = m_modp;
{
m_modp = nodep;
iterateChildren(nodep);
}
m_modp = origModp;
}
virtual void visit(AstCell* nodep) {
virtual void visit(AstCell* nodep) VL_OVERRIDE {
if (nodep->modp()->user1()) { // Marked with inline request
UINFO(5," Inline CELL "<<nodep<<endl);
UINFO(5," To MOD "<<m_modp<<endl);
@ -607,9 +612,9 @@ private:
}
//--------------------
virtual void visit(AstNodeMath* nodep) {} // Accelerate
virtual void visit(AstNodeStmt* nodep) {} // Accelerate
virtual void visit(AstNode* nodep) {
virtual void visit(AstNodeMath* nodep) VL_OVERRIDE {} // Accelerate
virtual void visit(AstNodeStmt* nodep) VL_OVERRIDE {} // Accelerate
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
@ -640,17 +645,17 @@ private:
VL_DEBUG_FUNC; // Declare debug()
// VISITORS
virtual void visit(AstNetlist* nodep) {
virtual void visit(AstNetlist* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
virtual void visit(AstModule* nodep) {
virtual void visit(AstModule* nodep) VL_OVERRIDE {
if (nodep->isTop()) {
iterateChildren(nodep);
}
}
virtual void visit(AstCell* nodep) {
virtual void visit(AstCell* nodep) VL_OVERRIDE {
string oldScope = m_scope;
if (m_scope.empty()) {
m_scope = nodep->name();
@ -686,7 +691,7 @@ private:
m_scope = oldScope;
}
virtual void visit(AstAssignVarScope* nodep) {
virtual void visit(AstAssignVarScope* nodep) VL_OVERRIDE {
// Reference
AstVarRef* reflp = VN_CAST(nodep->lhsp(), VarRef);
// What the reference refers to
@ -712,9 +717,9 @@ private:
}
//--------------------
virtual void visit(AstNodeMath*) {} // Accelerate
virtual void visit(AstNodeStmt*) {} // Accelerate
virtual void visit(AstNode* nodep) {
virtual void visit(AstNodeMath*) VL_OVERRIDE {} // Accelerate
virtual void visit(AstNodeStmt*) VL_OVERRIDE {} // Accelerate
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}

View File

@ -54,7 +54,7 @@ private:
VL_DEBUG_FUNC; // Declare debug()
// VISITORS
virtual void visit(AstCell* nodep) {
virtual void visit(AstCell* nodep) VL_OVERRIDE {
UINFO(4," CELL "<<nodep<<endl);
m_cellp = nodep;
//VV***** We reset user1p() on each cell!!!
@ -62,7 +62,7 @@ private:
iterateChildren(nodep);
m_cellp = NULL;
}
virtual void visit(AstPin* nodep) {
virtual void visit(AstPin* nodep) VL_OVERRIDE {
// PIN(p,expr) -> ASSIGNW(VARXREF(p),expr) (if sub's input)
// or ASSIGNW(expr,VARXREF(p)) (if sub's output)
UINFO(4," PIN "<<nodep<<endl);
@ -116,7 +116,7 @@ private:
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
}
virtual void visit(AstUdpTable* nodep) {
virtual void visit(AstUdpTable* nodep) VL_OVERRIDE {
if (!v3Global.opt.bboxUnsup()) {
// If we support primitives, update V3Undriven to remove special case
nodep->v3error("Unsupported: Verilog 1995 UDP Tables. Use --bbox-unsup to ignore tables.");
@ -124,13 +124,13 @@ private:
}
// Save some time
virtual void visit(AstNodeMath*) {}
virtual void visit(AstNodeAssign*) {}
virtual void visit(AstAlways*) {}
virtual void visit(AstNodeMath*) VL_OVERRIDE {}
virtual void visit(AstNodeAssign*) VL_OVERRIDE {}
virtual void visit(AstAlways*) VL_OVERRIDE {}
//--------------------
// Default: Just iterate
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:
@ -155,7 +155,7 @@ private:
VL_DEBUG_FUNC; // Declare debug()
// VISITORS
virtual void visit(AstVar* nodep) {
virtual void visit(AstVar* nodep) VL_OVERRIDE {
if (VN_IS(nodep->dtypep(), IfaceRefDType)) {
UINFO(8," dm-1-VAR "<<nodep<<endl);
insert(nodep);
@ -163,9 +163,9 @@ private:
iterateChildren(nodep);
}
// Save some time
virtual void visit(AstNodeMath*) {}
virtual void visit(AstNodeMath*) VL_OVERRIDE {}
// Default: Just iterate
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:
@ -213,7 +213,7 @@ private:
VL_DEBUG_FUNC; // Declare debug()
// VISITORS
virtual void visit(AstVar* nodep) {
virtual void visit(AstVar* nodep) VL_OVERRIDE {
if (VN_IS(nodep->dtypep(), UnpackArrayDType)
&& VN_IS(VN_CAST(nodep->dtypep(), UnpackArrayDType)->subDTypep(), IfaceRefDType)) {
UINFO(8," dv-vec-VAR "<<nodep<<endl);
@ -246,7 +246,7 @@ private:
iterateChildren(nodep);
}
virtual void visit(AstCell* nodep) {
virtual void visit(AstCell* nodep) VL_OVERRIDE {
UINFO(4," CELL "<<nodep<<endl);
// Find submodule vars
UASSERT_OBJ(nodep->modp(), nodep, "Unlinked");
@ -313,7 +313,7 @@ private:
}
}
virtual void visit(AstPin* nodep) {
virtual void visit(AstPin* nodep) VL_OVERRIDE {
// Any non-direct pins need reconnection with a part-select
if (!nodep->exprp()) return; // No-connect
if (m_cellRangep) {
@ -447,10 +447,10 @@ private:
}
// Save some time
virtual void visit(AstNodeMath*) {}
virtual void visit(AstNodeMath*) VL_OVERRIDE {}
//--------------------
// Default: Just iterate
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:

View File

@ -124,7 +124,7 @@ private:
}
// VISITORS
virtual void visit(AstNodeSel* nodep) {
virtual void visit(AstNodeSel* nodep) VL_OVERRIDE {
// This covers both AstArraySel and AstWordSel
//
// If some vector is a bazillion dwords long, and we're selecting 1
@ -135,7 +135,7 @@ private:
VisitBase vb(this, nodep);
iterateAndNextNull(nodep->bitp());
}
virtual void visit(AstSel* nodep) {
virtual void visit(AstSel* nodep) VL_OVERRIDE {
// Similar to AstNodeSel above, a small select into a large vector
// is not expensive. Count the cost of the AstSel itself (scales with
// its width) and the cost of the lsbp() and widthp() nodes, but not
@ -144,13 +144,13 @@ private:
iterateAndNextNull(nodep->lsbp());
iterateAndNextNull(nodep->widthp());
}
virtual void visit(AstSliceSel* nodep) {
virtual void visit(AstSliceSel* nodep) VL_OVERRIDE {
nodep->v3fatalSrc("AstSliceSel unhandled");
}
virtual void visit(AstMemberSel* nodep) {
virtual void visit(AstMemberSel* nodep) VL_OVERRIDE {
nodep->v3fatalSrc("AstMemberSel unhandled");
}
virtual void visit(AstConcat* nodep) {
virtual void visit(AstConcat* nodep) VL_OVERRIDE {
// Nop.
//
// Ignore concat. The problem with counting concat is that when we
@ -170,7 +170,7 @@ private:
// the widths of the operands (ignored here).
markCost(nodep);
}
virtual void visit(AstNodeIf* nodep) {
virtual void visit(AstNodeIf* nodep) VL_OVERRIDE {
VisitBase vb(this, nodep);
iterateAndNextNull(nodep->condp());
uint32_t savedCount = m_instrCount;
@ -195,7 +195,7 @@ private:
if (nodep->ifsp()) nodep->ifsp()->user4(0); // Don't dump it
}
}
virtual void visit(AstNodeCond* nodep) {
virtual void visit(AstNodeCond* nodep) VL_OVERRIDE {
// Just like if/else above, the ternary operator only evaluates
// one of the two expressions, so only count the max.
VisitBase vb(this, nodep);
@ -220,7 +220,7 @@ private:
if (nodep->expr2p()) nodep->expr2p()->user4(0); // Don't dump it
}
}
virtual void visit(AstActive* nodep) {
virtual void visit(AstActive* nodep) VL_OVERRIDE {
// You'd think that the OrderLogicVertex's would be disjoint trees
// of stuff in the AST, but it isn't so: V3Order makes an
// OrderLogicVertex for each ACTIVE, and then also makes an
@ -236,14 +236,14 @@ private:
markCost(nodep);
UASSERT_OBJ(nodep == m_startNodep, nodep, "Multiple actives, or not start node");
}
virtual void visit(AstCCall* nodep) {
virtual void visit(AstCCall* nodep) VL_OVERRIDE {
VisitBase vb(this, nodep);
iterateChildren(nodep);
m_tracingCall = true;
iterate(nodep->funcp());
UASSERT_OBJ(!m_tracingCall, nodep, "visit(AstCFunc) should have cleared m_tracingCall.");
}
virtual void visit(AstCFunc* nodep) {
virtual void visit(AstCFunc* nodep) VL_OVERRIDE {
// Don't count a CFunc other than by tracing a call or counting it
// from the root
UASSERT_OBJ(m_tracingCall || nodep == m_startNodep, nodep,
@ -257,7 +257,7 @@ private:
}
m_inCFunc = saved_inCFunc;
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
VisitBase vb(this, nodep);
iterateChildren(nodep);
}
@ -289,7 +289,7 @@ public:
private:
// METHODS
string indent() { return string(m_depth, ':')+" "; }
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
++m_depth;
if (unsigned costPlus1 = nodep->user4()) {
*m_osp <<" "<<indent()

View File

@ -296,7 +296,7 @@ private:
VL_DEBUG_FUNC; // Declare debug()
// VISITORS
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
// Consumption/generation of a variable,
// it's used so can't elim assignment before this use.
UASSERT_OBJ(nodep->varScopep(), nodep, "NULL");
@ -310,7 +310,7 @@ private:
VL_DO_DANGLING(m_lifep->varUsageReplace(vscp, nodep), nodep);
}
}
virtual void visit(AstNodeAssign* nodep) {
virtual void visit(AstNodeAssign* nodep) VL_OVERRIDE {
// Collect any used variables first, as lhs may also be on rhs
// Similar code in V3Dead
vluint64_t lastEdit = AstNode::editCountGbl(); // When it was last edited
@ -330,13 +330,13 @@ private:
iterateAndNextNull(nodep->lhsp());
}
}
virtual void visit(AstAssignDly* nodep) {
virtual void visit(AstAssignDly* nodep) VL_OVERRIDE {
// Don't treat as normal assign; V3Life doesn't understand time sense
iterateChildren(nodep);
}
//---- Track control flow changes
virtual void visit(AstNodeIf* nodep) {
virtual void visit(AstNodeIf* nodep) VL_OVERRIDE {
UINFO(4," IF "<<nodep<<endl);
// Condition is part of PREVIOUS block
iterateAndNextNull(nodep->condp());
@ -362,7 +362,7 @@ private:
VL_DO_DANGLING(delete elseLifep, elseLifep);
}
virtual void visit(AstWhile* nodep) {
virtual void visit(AstWhile* nodep) VL_OVERRIDE {
// While's are a problem, as we don't allow loops in the graph. We
// may go around the cond/body multiple times. Thus a
// lifelication just in the body is ok, but we can't delete an
@ -391,7 +391,7 @@ private:
VL_DO_DANGLING(delete condLifep, condLifep);
VL_DO_DANGLING(delete bodyLifep, bodyLifep);
}
virtual void visit(AstJumpLabel* nodep) {
virtual void visit(AstJumpLabel* nodep) VL_OVERRIDE {
// As with While's we can't predict if a JumpGo will kill us or not
// It's worse though as an IF(..., JUMPGO) may change the control flow.
// Just don't optimize blocks with labels; they're rare - so far.
@ -410,7 +410,7 @@ private:
bodyLifep->lifeToAbove();
VL_DO_DANGLING(delete bodyLifep, bodyLifep);
}
virtual void visit(AstCCall* nodep) {
virtual void visit(AstCCall* nodep) VL_OVERRIDE {
//UINFO(4," CCALL "<<nodep<<endl);
iterateChildren(nodep);
// Enter the function and trace it
@ -419,8 +419,8 @@ private:
iterate(nodep->funcp());
}
}
virtual void visit(AstCFunc* nodep) {
//UINFO(4," CCALL "<<nodep<<endl);
virtual void visit(AstCFunc* nodep) VL_OVERRIDE {
//UINFO(4," CFUNC "<<nodep<<endl);
if (!m_tracingCall && !nodep->entryPoint()) return;
m_tracingCall = false;
if (nodep->dpiImport() && !nodep->pure()) {
@ -428,17 +428,17 @@ private:
}
iterateChildren(nodep);
}
virtual void visit(AstUCFunc* nodep) {
virtual void visit(AstUCFunc* nodep) VL_OVERRIDE {
m_sideEffect = true; // If appears on assign RHS, don't ever delete the assignment
iterateChildren(nodep);
}
virtual void visit(AstCMath* nodep) {
virtual void visit(AstCMath* nodep) VL_OVERRIDE {
m_sideEffect = true; // If appears on assign RHS, don't ever delete the assignment
iterateChildren(nodep);
}
virtual void visit(AstVar*) {} // Don't want varrefs under it
virtual void visit(AstNode* nodep) {
virtual void visit(AstVar*) VL_OVERRIDE {} // Don't want varrefs under it
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
@ -472,28 +472,28 @@ private:
LifeState* m_statep; // Current state
// VISITORS
virtual void visit(AstCFunc* nodep) {
virtual void visit(AstCFunc* nodep) VL_OVERRIDE {
if (nodep->entryPoint()) {
// Usage model 1: Simulate all C code, doing lifetime analysis
LifeVisitor visitor (nodep, m_statep);
}
}
virtual void visit(AstAlways* nodep) {
virtual void visit(AstAlways* nodep) VL_OVERRIDE {
// Usage model 2: Cleanup basic blocks
LifeVisitor visitor (nodep, m_statep);
}
virtual void visit(AstInitial* nodep) {
virtual void visit(AstInitial* nodep) VL_OVERRIDE {
// Usage model 2: Cleanup basic blocks
LifeVisitor visitor (nodep, m_statep);
}
virtual void visit(AstFinal* nodep) {
virtual void visit(AstFinal* nodep) VL_OVERRIDE {
// Usage model 2: Cleanup basic blocks
LifeVisitor visitor (nodep, m_statep);
}
virtual void visit(AstVar*) {} // Accelerate
virtual void visit(AstNodeStmt*) {} // Accelerate
virtual void visit(AstNodeMath*) {} // Accelerate
virtual void visit(AstNode* nodep) {
virtual void visit(AstVar*) VL_OVERRIDE {} // Accelerate
virtual void visit(AstNodeStmt*) VL_OVERRIDE {} // Accelerate
virtual void visit(AstNodeMath*) VL_OVERRIDE {} // Accelerate
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:

View File

@ -58,7 +58,7 @@ private:
VL_DEBUG_FUNC; // Declare debug()
// VISITORS
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
AstVarScope* vscp = nodep->varScopep();
UASSERT_OBJ(vscp, nodep, "Scope not assigned");
if (AstVarScope* newvscp = reinterpret_cast<AstVarScope*>(vscp->user4p())) {
@ -68,11 +68,11 @@ private:
VL_DO_DANGLING(nodep->deleteTree(), nodep);
}
}
virtual void visit(AstNodeModule* nodep) {
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
// Only track the top scopes, not lower level functions
if (nodep->isTop()) iterateChildren(nodep);
}
virtual void visit(AstCCall* nodep) {
virtual void visit(AstCCall* nodep) VL_OVERRIDE {
iterateChildren(nodep);
if (!nodep->funcp()->entryPoint()) {
// Enter the function and trace it
@ -80,18 +80,18 @@ private:
iterate(nodep->funcp());
}
}
virtual void visit(AstExecGraph* nodep) {
virtual void visit(AstExecGraph* nodep) VL_OVERRIDE {
// Can just iterate across the MTask bodies in any order. Order
// isn't important for LifePostElimVisitor's simple substitution.
iterateChildren(nodep);
}
virtual void visit(AstCFunc* nodep) {
virtual void visit(AstCFunc* nodep) VL_OVERRIDE {
if (!m_tracingCall && !nodep->entryPoint()) return;
m_tracingCall = false;
iterateChildren(nodep);
}
virtual void visit(AstVar*) {} // Don't want varrefs under it
virtual void visit(AstNode* nodep) {
virtual void visit(AstVar*) VL_OVERRIDE {} // Don't want varrefs under it
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:
@ -259,7 +259,7 @@ private:
}
// VISITORS
virtual void visit(AstTopScope* nodep) {
virtual void visit(AstTopScope* nodep) VL_OVERRIDE {
AstNode::user4ClearTree(); // user4p() used on entire tree
// First, build maps of every location (mtask and sequence
@ -284,7 +284,7 @@ private:
// Replace any node4p varscopes with the new scope
LifePostElimVisitor visitor (nodep);
}
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
// Consumption/generation of a variable,
AstVarScope* vscp = nodep->varScopep();
UASSERT_OBJ(vscp, nodep, "Scope not assigned");
@ -296,14 +296,14 @@ private:
m_reads[vscp].insert(loc);
}
}
virtual void visit(AstAssignPre* nodep) {
virtual void visit(AstAssignPre* nodep) VL_OVERRIDE {
// Do not record varrefs within assign pre.
//
// The pre-assignment into the dly var should not count as its
// first write; we only want to consider reads and writes that
// would still happen if the dly var were eliminated.
}
virtual void visit(AstAssignPost* nodep) {
virtual void visit(AstAssignPost* nodep) VL_OVERRIDE {
// Don't record ASSIGNPOST in the read/write maps, record them in a
// separate map
if (AstVarRef* rhsp = VN_CAST(nodep->rhsp(), VarRef)) {
@ -315,11 +315,11 @@ private:
m_assignposts[dlyVarp] = LifePostLocation(loc, nodep);
}
}
virtual void visit(AstNodeModule* nodep) {
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
// Only track the top scopes, not lower level functions
if (nodep->isTop()) iterateChildren(nodep);
}
virtual void visit(AstCCall* nodep) {
virtual void visit(AstCCall* nodep) VL_OVERRIDE {
iterateChildren(nodep);
if (!nodep->funcp()->entryPoint()) {
// Enter the function and trace it
@ -327,7 +327,7 @@ private:
iterate(nodep->funcp());
}
}
virtual void visit(AstExecGraph* nodep) {
virtual void visit(AstExecGraph* nodep) VL_OVERRIDE {
// Treat the ExecGraph like a call to each mtask body
m_mtasksGraphp = nodep->depGraphp();
for (V3GraphVertex* mtaskVxp = m_mtasksGraphp->verticesBeginp();
@ -339,14 +339,14 @@ private:
}
m_execMTaskp = NULL;
}
virtual void visit(AstCFunc* nodep) {
virtual void visit(AstCFunc* nodep) VL_OVERRIDE {
if (!m_tracingCall && !nodep->entryPoint()) return;
m_tracingCall = false;
iterateChildren(nodep);
}
//-----
virtual void visit(AstVar*) {} // Don't want varrefs under it
virtual void visit(AstNode* nodep) {
virtual void visit(AstVar*) VL_OVERRIDE {} // Don't want varrefs under it
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:

View File

@ -158,7 +158,7 @@ private:
}
// VISITs
virtual void visit(AstNetlist* nodep) {
virtual void visit(AstNetlist* nodep) VL_OVERRIDE {
AstNode::user1ClearTree();
readModNames();
iterateChildren(nodep);
@ -190,45 +190,49 @@ private:
v3error("Specified --top-module '"<<v3Global.opt.topModule()<<"' was not found in design.");
}
}
virtual void visit(AstNodeModule* nodep) {
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
// Module: Pick up modnames, so we can resolve cells later
m_modp = nodep;
UINFO(2,"Link Module: "<<nodep<<endl);
if (nodep->fileline()->filebasenameNoExt() != nodep->prettyName()
&& !v3Global.opt.isLibraryFile(nodep->fileline()->filename())
&& !nodep->recursiveClone()
&& !nodep->internal()) {
// We only complain once per file, otherwise library-like files
// have a huge mess of warnings
if (m_declfnWarned.find(nodep->fileline()->filename()) == m_declfnWarned.end()) {
m_declfnWarned.insert(nodep->fileline()->filename());
nodep->v3warn(DECLFILENAME, "Filename '"<<nodep->fileline()->filebasenameNoExt()
<<"' does not match "<<nodep->typeName()
<<" name: "<<nodep->prettyNameQ());
AstNodeModule* oldModp = m_modp;
{
m_modp = nodep;
UINFO(2, "Link Module: " << nodep << endl);
if (nodep->fileline()->filebasenameNoExt() != nodep->prettyName()
&& !v3Global.opt.isLibraryFile(nodep->fileline()->filename())
&& !nodep->recursiveClone() && !nodep->internal()) {
// We only complain once per file, otherwise library-like files
// have a huge mess of warnings
if (m_declfnWarned.find(nodep->fileline()->filename()) == m_declfnWarned.end()) {
m_declfnWarned.insert(nodep->fileline()->filename());
nodep->v3warn(DECLFILENAME, "Filename '"
<< nodep->fileline()->filebasenameNoExt()
<< "' does not match " << nodep->typeName()
<< " name: " << nodep->prettyNameQ());
}
}
if (VN_IS(nodep, Iface) || VN_IS(nodep, Package)) {
nodep->inLibrary(true); // Interfaces can't be at top, unless asked
}
bool topMatch = (v3Global.opt.topModule() == nodep->prettyName());
if (topMatch) {
m_topVertexp = vertex(nodep);
UINFO(2, "Link --top-module: " << nodep << endl);
nodep->inLibrary(false); // Safer to make sure it doesn't disappear
}
if (v3Global.opt.topModule() == "" ? nodep->inLibrary() // Library cells are lower
: !topMatch) { // Any non-specified module is lower
// Put under a fake vertex so that the graph ranking won't indicate
// this is a top level module
if (!m_libVertexp) m_libVertexp = new LibraryVertex(&m_graph);
new V3GraphEdge(&m_graph, m_libVertexp, vertex(nodep), 1, false);
}
// Note AstBind also has iteration on cells
iterateChildren(nodep);
nodep->checkTree();
}
if (VN_IS(nodep, Iface) || VN_IS(nodep, Package)) nodep->inLibrary(true); // Interfaces can't be at top, unless asked
bool topMatch = (v3Global.opt.topModule()==nodep->prettyName());
if (topMatch) {
m_topVertexp = vertex(nodep);
UINFO(2,"Link --top-module: "<<nodep<<endl);
nodep->inLibrary(false); // Safer to make sure it doesn't disappear
}
if (v3Global.opt.topModule()==""
? nodep->inLibrary() // Library cells are lower
: !topMatch) { // Any non-specified module is lower
// Put under a fake vertex so that the graph ranking won't indicate
// this is a top level module
if (!m_libVertexp) m_libVertexp = new LibraryVertex(&m_graph);
new V3GraphEdge(&m_graph, m_libVertexp, vertex(nodep), 1, false);
}
// Note AstBind also has iteration on cells
iterateChildren(nodep);
nodep->checkTree();
m_modp = NULL;
m_modp = oldModp;
}
virtual void visit(AstIfaceRefDType* nodep) {
virtual void visit(AstIfaceRefDType* nodep) VL_OVERRIDE {
// Cell: Resolve its filename. If necessary, parse it.
UINFO(4,"Link IfaceRef: "<<nodep<<endl);
// Use findIdUpward instead of findIdFlat; it doesn't matter for now
@ -247,14 +251,14 @@ private:
// Note cannot do modport resolution here; modports are allowed underneath generates
}
virtual void visit(AstPackageImport* nodep) {
virtual void visit(AstPackageImport* nodep) VL_OVERRIDE {
// Package Import: We need to do the package before the use of a package
iterateChildren(nodep);
UASSERT_OBJ(nodep->packagep(), nodep, "Unlinked package"); // Parser should set packagep
new V3GraphEdge(&m_graph, vertex(m_modp), vertex(nodep->packagep()), 1, false);
}
virtual void visit(AstBind* nodep) {
virtual void visit(AstBind* nodep) VL_OVERRIDE {
// Bind: Has cells underneath that need to be put into the new
// module, and cells which need resolution
// TODO this doesn't allow bind to dotted hier names, that would require
@ -276,7 +280,7 @@ private:
pushDeletep(nodep->unlinkFrBack());
}
virtual void visit(AstCell* nodep) {
virtual void visit(AstCell* nodep) VL_OVERRIDE {
// Cell: Resolve its filename. If necessary, parse it.
// Execute only once. Complication is that cloning may result in
// user1 being set (for pre-clone) so check if user1() matches the
@ -448,8 +452,8 @@ private:
// Accelerate the recursion
// Must do statements to support Generates, math though...
virtual void visit(AstNodeMath* nodep) {}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNodeMath* nodep) VL_OVERRIDE {}
virtual void visit(AstNode* nodep) VL_OVERRIDE {
// Default: Just iterate
iterateChildren(nodep);
}

View File

@ -400,7 +400,7 @@ public:
VSymEnt* getScopeSym(AstScope* nodep) {
NameScopeSymMap::iterator it = m_nameScopeSymMap.find(nodep->name());
UASSERT_OBJ(it != m_nameScopeSymMap.end(), nodep,
"Scope never assigned a symbol entry?");
"Scope never assigned a symbol entry '" << nodep->name() << "'");
return it->second;
}
void implicitOkAdd(AstNodeModule* nodep, const string& varname) {
@ -726,7 +726,7 @@ class LinkDotFindVisitor : public AstNVisitor {
}
// VISITs
virtual void visit(AstNetlist* nodep) {
virtual void visit(AstNetlist* nodep) VL_OVERRIDE {
// Process $unit or other packages
// Not needed - dotted references not allowed from inside packages
//for (AstNodeModule* nodep = v3Global.rootp()->modulesp();
@ -758,8 +758,8 @@ class LinkDotFindVisitor : public AstNVisitor {
m_curSymp = m_modSymp = NULL;
}
}
virtual void visit(AstTypeTable* nodep) {}
virtual void visit(AstNodeModule* nodep) {
virtual void visit(AstTypeTable* nodep) VL_OVERRIDE {}
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
// Called on top module from Netlist, other modules from the cell creating them,
// and packages
UINFO(8," "<<nodep<<endl);
@ -821,12 +821,12 @@ class LinkDotFindVisitor : public AstNVisitor {
// Prep for next
m_packagep = NULL;
}
virtual void visit(AstScope* nodep) {
virtual void visit(AstScope* nodep) VL_OVERRIDE {
UASSERT_OBJ(m_statep->forScopeCreation(), nodep,
"Scopes should only exist right after V3Scope");
// Ignored. Processed in next step
}
virtual void visit(AstCell* nodep) {
virtual void visit(AstCell* nodep) VL_OVERRIDE {
UINFO(5," CELL under "<<m_scope<<" is "<<nodep<<endl);
// Process XREFs/etc inside pins
if (nodep->recursive() && m_inRecursion) return;
@ -867,7 +867,7 @@ class LinkDotFindVisitor : public AstNVisitor {
m_paramNum = oldParamNum;
m_inRecursion = oldRecursion;
}
virtual void visit(AstCellInline* nodep) {
virtual void visit(AstCellInline* nodep) VL_OVERRIDE {
UINFO(5," CELLINLINE under "<<m_scope<<" is "<<nodep<<endl);
VSymEnt* aboveSymp = m_curSymp;
// If baz__DOT__foo__DOT__bar, we need to find baz__DOT__foo and add bar to it.
@ -887,11 +887,11 @@ class LinkDotFindVisitor : public AstNVisitor {
m_statep->insertInline(aboveSymp, m_modSymp, nodep, nodep->name());
}
}
virtual void visit(AstDefParam* nodep) {
virtual void visit(AstDefParam* nodep) VL_OVERRIDE {
nodep->user1p(m_curSymp);
iterateChildren(nodep);
}
virtual void visit(AstGenerate* nodep) {
virtual void visit(AstGenerate* nodep) VL_OVERRIDE {
// Begin: ... blocks often replicate under genif/genfor, so simply
// suppress duplicate checks. See t_gen_forif.v for an example.
bool lastInGen = m_inGenerate;
@ -901,7 +901,7 @@ class LinkDotFindVisitor : public AstNVisitor {
}
m_inGenerate = lastInGen;
}
virtual void visit(AstBegin* nodep) {
virtual void visit(AstBegin* nodep) VL_OVERRIDE {
UINFO(5," "<<nodep<<endl);
// Rename "genblk"s to include a number
if (m_statep->forPrimary() && !nodep->user4SetOnce()) {
@ -943,7 +943,7 @@ class LinkDotFindVisitor : public AstNVisitor {
m_beginp = oldbegin;
m_beginNum = oldNum;
}
virtual void visit(AstNodeFTask* nodep) {
virtual void visit(AstNodeFTask* nodep) VL_OVERRIDE {
// NodeTask: Remember its name for later resolution
UINFO(5," "<<nodep<<endl);
UASSERT_OBJ(m_curSymp && m_modSymp, nodep, "Function/Task not under module?");
@ -979,7 +979,7 @@ class LinkDotFindVisitor : public AstNVisitor {
}
m_curSymp = oldCurSymp;
}
virtual void visit(AstVar* nodep) {
virtual void visit(AstVar* nodep) VL_OVERRIDE {
// Var: Remember its name for later resolution
UASSERT_OBJ(m_curSymp && m_modSymp, nodep, "Var not under module?");
iterateChildren(nodep);
@ -1097,22 +1097,21 @@ class LinkDotFindVisitor : public AstNVisitor {
}
}
}
virtual void visit(AstTypedef* nodep) {
// Remember its name for later resolution
UASSERT_OBJ(m_curSymp, nodep, "Typedef not under module?");
virtual void visit(AstTypedef* nodep) VL_OVERRIDE {
UASSERT_OBJ(m_curSymp, nodep, "Typedef not under module/package/$unit");
iterateChildren(nodep);
m_statep->insertSym(m_curSymp, nodep->name(), nodep, m_packagep);
}
virtual void visit(AstParamTypeDType* nodep) {
UASSERT_OBJ(m_curSymp, nodep, "Parameter type not under module?");
virtual void visit(AstParamTypeDType* nodep) VL_OVERRIDE {
UASSERT_OBJ(m_curSymp, nodep, "Parameter type not under module/package/$unit");
iterateChildren(nodep);
m_statep->insertSym(m_curSymp, nodep->name(), nodep, m_packagep);
}
virtual void visit(AstCFunc* nodep) {
virtual void visit(AstCFunc* nodep) VL_OVERRIDE {
// For dotted resolution, ignore all AstVars under functions, otherwise shouldn't exist
UASSERT_OBJ(!m_statep->forScopeCreation(), nodep, "No CFuncs expected in tree yet");
}
virtual void visit(AstEnumItem* nodep) {
virtual void visit(AstEnumItem* nodep) VL_OVERRIDE {
// EnumItem: Remember its name for later resolution
iterateChildren(nodep);
// Find under either a task or the module's vars
@ -1150,7 +1149,7 @@ class LinkDotFindVisitor : public AstNVisitor {
m_statep->insertSym(m_curSymp, nodep->name(), nodep, m_packagep);
}
}
virtual void visit(AstPackageImport* nodep) {
virtual void visit(AstPackageImport* nodep) VL_OVERRIDE {
UINFO(4," Link: "<<nodep<<endl);
VSymEnt* srcp = m_statep->getNodeSym(nodep->packagep());
if (nodep->name()=="*") {
@ -1168,7 +1167,7 @@ class LinkDotFindVisitor : public AstNVisitor {
UINFO(9," Link Done: "<<nodep<<endl);
// No longer needed, but can't delete until any multi-instantiated modules are expanded
}
virtual void visit(AstPackageExport* nodep) {
virtual void visit(AstPackageExport* nodep) VL_OVERRIDE {
UINFO(9," Link: "<<nodep<<endl);
VSymEnt* srcp = m_statep->getNodeSym(nodep->packagep());
if (nodep->name()!="*") {
@ -1182,13 +1181,13 @@ class LinkDotFindVisitor : public AstNVisitor {
UINFO(9," Link Done: "<<nodep<<endl);
// No longer needed, but can't delete until any multi-instantiated modules are expanded
}
virtual void visit(AstPackageExportStarStar* nodep) {
virtual void visit(AstPackageExportStarStar* nodep) VL_OVERRIDE {
UINFO(4," Link: "<<nodep<<endl);
m_curSymp->exportStarStar(m_statep->symsp());
// No longer needed, but can't delete until any multi-instantiated modules are expanded
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
// Default: Just iterate
iterateChildren(nodep);
}
@ -1253,8 +1252,8 @@ private:
}
// VISITs
virtual void visit(AstTypeTable* nodep) {}
virtual void visit(AstNodeModule* nodep) {
virtual void visit(AstTypeTable* nodep) VL_OVERRIDE {}
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
UINFO(5," "<<nodep<<endl);
if (nodep->dead() || !nodep->user4()) {
UINFO(4,"Mark dead module "<<nodep<<endl);
@ -1271,7 +1270,7 @@ private:
m_modp = NULL;
}
}
virtual void visit(AstPin* nodep) {
virtual void visit(AstPin* nodep) VL_OVERRIDE {
// Pin: Link to submodule's port
// Deal with implicit definitions - do before Resolve visitor as may
// be referenced above declaration
@ -1280,7 +1279,7 @@ private:
pinImplicitExprRecurse(nodep->exprp());
}
}
virtual void visit(AstDefParam* nodep) {
virtual void visit(AstDefParam* nodep) VL_OVERRIDE {
iterateChildren(nodep);
nodep->v3warn(DEFPARAM, "Suggest replace defparam assignment with Verilog 2001 #(."
<<nodep->prettyName()<<"(...etc...))");
@ -1302,7 +1301,7 @@ private:
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
}
}
virtual void visit(AstPort* nodep) {
virtual void visit(AstPort* nodep) VL_OVERRIDE {
// Port: Stash the pin number
// Need to set pin numbers after varnames are created
// But before we do the final resolution based on names
@ -1329,14 +1328,14 @@ private:
// Ports not needed any more
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
}
virtual void visit(AstAssignW* nodep) {
virtual void visit(AstAssignW* nodep) VL_OVERRIDE {
// Deal with implicit definitions
// We used to nodep->allowImplicit() here, but it turns out
// normal "assigns" can also make implicit wires. Yuk.
pinImplicitExprRecurse(nodep->lhsp());
iterateChildren(nodep);
}
virtual void visit(AstAssignAlias* nodep) {
virtual void visit(AstAssignAlias* nodep) VL_OVERRIDE {
// tran gates need implicit creation
// As VarRefs don't exist in forPrimary, sanity check
UASSERT_OBJ(!m_statep->forPrimary(), nodep, "Assign aliases unexpected pre-dot");
@ -1348,13 +1347,13 @@ private:
}
iterateChildren(nodep);
}
virtual void visit(AstImplicit* nodep) {
virtual void visit(AstImplicit* nodep) VL_OVERRIDE {
// Unsupported gates need implicit creation
pinImplicitExprRecurse(nodep);
// We're done with implicit gates
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
// Default: Just iterate
iterateChildren(nodep);
}
@ -1384,11 +1383,11 @@ class LinkDotScopeVisitor : public AstNVisitor {
int debug() { return LinkDotState::debug(); }
// VISITs
virtual void visit(AstNetlist* nodep) {
virtual void visit(AstNetlist* nodep) VL_OVERRIDE {
// Recurse..., backward as must do packages before using packages
iterateChildrenBackwards(nodep);
}
virtual void visit(AstScope* nodep) {
virtual void visit(AstScope* nodep) VL_OVERRIDE {
UINFO(8," SCOPE "<<nodep<<endl);
UASSERT_OBJ(m_statep->forScopeCreation(), nodep,
"Scopes should only exist right after V3Scope");
@ -1400,7 +1399,7 @@ class LinkDotScopeVisitor : public AstNVisitor {
m_modSymp = NULL;
m_scopep = NULL;
}
virtual void visit(AstVarScope* nodep) {
virtual void visit(AstVarScope* nodep) VL_OVERRIDE {
if (!nodep->varp()->isFuncLocal()) {
VSymEnt* varSymp = m_statep->insertSym(m_modSymp, nodep->varp()->name(), nodep, NULL);
if (nodep->varp()->isIfaceRef()
@ -1434,12 +1433,12 @@ class LinkDotScopeVisitor : public AstNVisitor {
}
}
}
virtual void visit(AstNodeFTask* nodep) {
virtual void visit(AstNodeFTask* nodep) VL_OVERRIDE {
VSymEnt* symp = m_statep->insertBlock(m_modSymp, nodep->name(), nodep, NULL);
symp->fallbackp(m_modSymp);
// No recursion, we don't want to pick up variables
}
virtual void visit(AstAssignAlias* nodep) {
virtual void visit(AstAssignAlias* nodep) VL_OVERRIDE {
// Track aliases created by V3Inline; if we get a VARXREF(aliased_from)
// we'll need to replace it with a VARXREF(aliased_to)
if (debug()>=9) nodep->dumpTree(cout, "- alias: ");
@ -1449,7 +1448,7 @@ class LinkDotScopeVisitor : public AstNVisitor {
fromVscp->user2p(toVscp);
iterateChildren(nodep);
}
virtual void visit(AstAssignVarScope* nodep) {
virtual void visit(AstAssignVarScope* nodep) VL_OVERRIDE {
UINFO(5,"ASSIGNVARSCOPE "<<nodep<<endl);
if (debug()>=9) nodep->dumpTree(cout, "- avs: ");
VSymEnt* rhsSymp;
@ -1501,10 +1500,10 @@ class LinkDotScopeVisitor : public AstNVisitor {
}
// For speed, don't recurse things that can't have scope
// Note we allow AstNodeStmt's as generates may be under them
virtual void visit(AstCell*) {}
virtual void visit(AstVar*) {}
virtual void visit(AstNodeMath*) {}
virtual void visit(AstNode* nodep) {
virtual void visit(AstCell*) VL_OVERRIDE {}
virtual void visit(AstVar*) VL_OVERRIDE {}
virtual void visit(AstNodeMath*) VL_OVERRIDE {}
virtual void visit(AstNode* nodep) VL_OVERRIDE {
// Default: Just iterate
iterateChildren(nodep);
}
@ -1534,7 +1533,7 @@ class LinkDotIfaceVisitor : public AstNVisitor {
int debug() { return LinkDotState::debug(); }
// VISITs
virtual void visit(AstModport* nodep) {
virtual void visit(AstModport* nodep) VL_OVERRIDE {
// Modport: Remember its name for later resolution
UINFO(5," fiv: "<<nodep<<endl);
VSymEnt* oldCurSymp = m_curSymp;
@ -1546,7 +1545,7 @@ class LinkDotIfaceVisitor : public AstNVisitor {
}
m_curSymp = oldCurSymp;
}
virtual void visit(AstModportFTaskRef* nodep) {
virtual void visit(AstModportFTaskRef* nodep) VL_OVERRIDE {
UINFO(5," fif: "<<nodep<<endl);
iterateChildren(nodep);
if (nodep->isExport()) nodep->v3error("Unsupported: modport export");
@ -1568,7 +1567,7 @@ class LinkDotIfaceVisitor : public AstNVisitor {
nodep->unlinkFrBack(); VL_DO_DANGLING(pushDeletep(nodep), nodep);
}
}
virtual void visit(AstModportVarRef* nodep) {
virtual void visit(AstModportVarRef* nodep) VL_OVERRIDE {
UINFO(5," fiv: "<<nodep<<endl);
iterateChildren(nodep);
VSymEnt* symp = m_curSymp->findIdFallback(nodep->name());
@ -1592,7 +1591,7 @@ class LinkDotIfaceVisitor : public AstNVisitor {
nodep->unlinkFrBack(); VL_DO_DANGLING(pushDeletep(nodep), nodep);
}
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
// Default: Just iterate
iterateChildren(nodep);
}
@ -1769,12 +1768,12 @@ private:
}
// VISITs
virtual void visit(AstNetlist* nodep) {
virtual void visit(AstNetlist* nodep) VL_OVERRIDE {
// Recurse..., backward as must do packages before using packages
iterateChildrenBackwards(nodep);
}
virtual void visit(AstTypeTable* nodep) {}
virtual void visit(AstNodeModule* nodep) {
virtual void visit(AstTypeTable* nodep) VL_OVERRIDE {}
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
if (nodep->dead()) return;
checkNoDot(nodep);
UINFO(8," "<<nodep<<endl);
@ -1787,7 +1786,7 @@ private:
m_modp = NULL;
m_ds.m_dotSymp = m_curSymp = m_modSymp = NULL;
}
virtual void visit(AstScope* nodep) {
virtual void visit(AstScope* nodep) VL_OVERRIDE {
UINFO(8," "<<nodep<<endl);
VSymEnt* oldModSymp = m_modSymp;
VSymEnt* oldCurSymp = m_curSymp;
@ -1798,13 +1797,13 @@ private:
m_modSymp = oldModSymp;
m_curSymp = oldCurSymp;
}
virtual void visit(AstCellInline* nodep) {
virtual void visit(AstCellInline* nodep) VL_OVERRIDE {
checkNoDot(nodep);
if (m_statep->forScopeCreation() && !v3Global.opt.vpi()) {
nodep->unlinkFrBack(); VL_DO_DANGLING(pushDeletep(nodep), nodep);
}
}
virtual void visit(AstCell* nodep) {
virtual void visit(AstCell* nodep) VL_OVERRIDE {
// Cell: Recurse inside or cleanup not founds
checkNoDot(nodep);
m_cellp = nodep;
@ -1833,7 +1832,7 @@ private:
// Parent module inherits child's publicity
// This is done bottom up in the LinkBotupVisitor stage
}
virtual void visit(AstPin* nodep) {
virtual void visit(AstPin* nodep) VL_OVERRIDE {
// Pin: Link to submodule's port
checkNoDot(nodep);
iterateChildren(nodep);
@ -1875,7 +1874,7 @@ private:
}
// Early return() above when deleted
}
virtual void visit(AstDot* nodep) {
virtual void visit(AstDot* nodep) VL_OVERRIDE {
// Legal under a DOT: AstDot, AstParseRef, AstPackageRef, AstNodeSel
// also a DOT can be part of an expression, but only above plus
// AstFTaskRef are legal children
@ -1941,7 +1940,7 @@ private:
m_ds.m_dotp = lastStates.m_dotp;
}
}
virtual void visit(AstParseRef* nodep) {
virtual void visit(AstParseRef* nodep) VL_OVERRIDE {
if (nodep->user3SetOnce()) return;
UINFO(9," linkPARSEREF "<<m_ds.ascii()<<" n="<<nodep<<endl);
// m_curSymp is symbol table of outer expression
@ -2175,7 +2174,7 @@ private:
m_ds = lastStates;
}
}
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
// VarRef: Resolve its reference
// ParseRefs are used the first pass (forPrimary) so we shouldn't get can't find
// errors here now that we have a VarRef.
@ -2194,7 +2193,7 @@ private:
}
}
}
virtual void visit(AstVarXRef* nodep) {
virtual void visit(AstVarXRef* nodep) VL_OVERRIDE {
// VarRef: Resolve its reference
// We always link even if varp() is set, because the module we choose may change
// due to creating new modules, flattening, etc.
@ -2268,11 +2267,11 @@ private:
}
}
}
virtual void visit(AstEnumItemRef* nodep) {
virtual void visit(AstEnumItemRef* nodep) VL_OVERRIDE {
// EnumItemRef may be under a dot. Should already be resolved.
iterateChildren(nodep);
}
virtual void visit(AstMethodCall* nodep) {
virtual void visit(AstMethodCall* nodep) VL_OVERRIDE {
// Created here so should already be resolved.
DotStates lastStates = m_ds;
{
@ -2281,7 +2280,7 @@ private:
}
m_ds = lastStates;
}
virtual void visit(AstVar* nodep) {
virtual void visit(AstVar* nodep) VL_OVERRIDE {
checkNoDot(nodep);
iterateChildren(nodep);
if (m_statep->forPrimary() && nodep->isIO() && !m_ftaskp && !nodep->user4()) {
@ -2289,7 +2288,7 @@ private:
<<nodep->prettyNameQ());
}
}
virtual void visit(AstNodeFTaskRef* nodep) {
virtual void visit(AstNodeFTaskRef* nodep) VL_OVERRIDE {
if (nodep->user3SetOnce()) return;
UINFO(8," "<<nodep<<endl);
if (m_ds.m_dotp && m_ds.m_dotPos == DP_PACKAGE) {
@ -2403,7 +2402,7 @@ private:
}
m_ds = lastStates;
}
virtual void visit(AstSelBit* nodep) {
virtual void visit(AstSelBit* nodep) VL_OVERRIDE {
if (nodep->user3SetOnce()) return;
iterateAndNextNull(nodep->lhsp());
if (m_ds.m_dotPos == DP_SCOPE) { // Already under dot, so this is {modulepart} DOT {modulepart}
@ -2428,7 +2427,7 @@ private:
nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep);
}
}
virtual void visit(AstNodePreSel* nodep) {
virtual void visit(AstNodePreSel* nodep) VL_OVERRIDE {
// Excludes simple AstSelBit, see above
if (nodep->user3SetOnce()) return;
if (m_ds.m_dotPos == DP_SCOPE) { // Already under dot, so this is {modulepart} DOT {modulepart}
@ -2446,11 +2445,11 @@ private:
}
m_ds = lastStates;
}
virtual void visit(AstMemberSel* nodep) {
virtual void visit(AstMemberSel* nodep) VL_OVERRIDE {
// checkNoDot not appropriate, can be under a dot
iterateChildren(nodep);
}
virtual void visit(AstBegin* nodep) {
virtual void visit(AstBegin* nodep) VL_OVERRIDE {
UINFO(5," "<<nodep<<endl);
checkNoDot(nodep);
VSymEnt* oldCurSymp = m_curSymp;
@ -2462,7 +2461,7 @@ private:
m_ds.m_dotSymp = m_curSymp = oldCurSymp;
UINFO(5," cur=se"<<cvtToHex(m_curSymp)<<endl);
}
virtual void visit(AstNodeFTask* nodep) {
virtual void visit(AstNodeFTask* nodep) VL_OVERRIDE {
UINFO(5," "<<nodep<<endl);
checkNoDot(nodep);
VSymEnt* oldCurSymp = m_curSymp;
@ -2474,7 +2473,7 @@ private:
m_ds.m_dotSymp = m_curSymp = oldCurSymp;
m_ftaskp = NULL;
}
virtual void visit(AstRefDType* nodep) {
virtual void visit(AstRefDType* nodep) VL_OVERRIDE {
// Resolve its reference
if (nodep->user3SetOnce()) return;
if (m_ds.m_dotp && m_ds.m_dotPos == DP_PACKAGE) {
@ -2488,7 +2487,8 @@ private:
} else {
checkNoDot(nodep);
}
if (!nodep->defp()) {
if (nodep->typeofp()) { // Really is a typeof not a reference
} else if (!nodep->defp()) {
VSymEnt* foundp;
if (nodep->packagep()) {
foundp = m_statep->getNodeSym(nodep->packagep())->findIdFlat(nodep->name());
@ -2510,7 +2510,7 @@ private:
}
iterateChildren(nodep);
}
virtual void visit(AstDpiExport* nodep) {
virtual void visit(AstDpiExport* nodep) VL_OVERRIDE {
// AstDpiExport: Make sure the function referenced exists, then dump it
iterateChildren(nodep);
checkNoDot(nodep);
@ -2527,35 +2527,35 @@ private:
}
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
}
virtual void visit(AstPackageImport* nodep) {
virtual void visit(AstPackageImport* nodep) VL_OVERRIDE {
// No longer needed
checkNoDot(nodep);
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
}
virtual void visit(AstPackageExport* nodep) {
virtual void visit(AstPackageExport* nodep) VL_OVERRIDE {
// No longer needed
checkNoDot(nodep);
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
}
virtual void visit(AstPackageExportStarStar* nodep) {
virtual void visit(AstPackageExportStarStar* nodep) VL_OVERRIDE {
// No longer needed
checkNoDot(nodep);
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
}
virtual void visit(AstCellRef* nodep) {
virtual void visit(AstCellRef* nodep) VL_OVERRIDE {
UINFO(5," AstCellRef: "<<nodep<<" "<<m_ds.ascii()<<endl);
iterateChildren(nodep);
}
virtual void visit(AstCellArrayRef* nodep) {
virtual void visit(AstCellArrayRef* nodep) VL_OVERRIDE {
UINFO(5," AstCellArrayRef: "<<nodep<<" "<<m_ds.ascii()<<endl);
// Expression already iterated
}
virtual void visit(AstUnlinkedRef* nodep) {
virtual void visit(AstUnlinkedRef* nodep) VL_OVERRIDE {
UINFO(5," AstCellArrayRef: "<<nodep<<" "<<m_ds.ascii()<<endl);
// No need to iterate, if we have a UnlinkedVarXRef, we're already done
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
// Default: Just iterate
checkNoDot(nodep);
iterateChildren(nodep);

View File

@ -49,7 +49,7 @@ private:
AstNodeFTask* m_ftaskp; // Current function/task
AstWhile* m_loopp; // Current loop
bool m_loopInc; // In loop increment
int m_repeatNum; // Repeat counter
int m_modRepeatNum; // Repeat counter
BeginStack m_beginStack; // All begin blocks above current node
// METHODS
@ -107,30 +107,35 @@ private:
}
// VISITORS
virtual void visit(AstNodeModule* nodep) {
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
if (nodep->dead()) return;
m_modp = nodep;
m_repeatNum = 0;
iterateChildren(nodep);
m_modp = NULL;
AstNodeModule* origModp = m_modp;
int origRepeatNum = m_modRepeatNum;
{
m_modp = nodep;
m_modRepeatNum = 0;
iterateChildren(nodep);
}
m_modp = origModp;
m_modRepeatNum = origRepeatNum;
}
virtual void visit(AstNodeFTask* nodep) {
virtual void visit(AstNodeFTask* nodep) VL_OVERRIDE {
m_ftaskp = nodep;
iterateChildren(nodep);
m_ftaskp = NULL;
}
virtual void visit(AstBegin* nodep) {
virtual void visit(AstBegin* nodep) VL_OVERRIDE {
UINFO(8," "<<nodep<<endl);
m_beginStack.push_back(nodep);
iterateChildren(nodep);
m_beginStack.pop_back();
}
virtual void visit(AstRepeat* nodep) {
virtual void visit(AstRepeat* nodep) VL_OVERRIDE {
// So later optimizations don't need to deal with them,
// REPEAT(count,body) -> loop=count,WHILE(loop>0) { body, loop-- }
// Note var can be signed or unsigned based on original number.
AstNode* countp = nodep->countp()->unlinkFrBackWithNext();
string name = string("__Vrepeat")+cvtToStr(m_repeatNum++);
string name = string("__Vrepeat")+cvtToStr(m_modRepeatNum++);
// Spec says value is integral, if negative is ignored
AstVar* varp = new AstVar(nodep->fileline(), AstVarType::BLOCKTEMP, name,
nodep->findSigned32DType());
@ -158,7 +163,7 @@ private:
nodep->replaceWith(newp);
VL_DO_DANGLING(nodep->deleteTree(), nodep);
}
virtual void visit(AstWhile* nodep) {
virtual void visit(AstWhile* nodep) VL_OVERRIDE {
// Don't need to track AstRepeat/AstFor as they have already been converted
AstWhile* lastLoopp = m_loopp;
bool lastInc = m_loopInc;
@ -172,7 +177,7 @@ private:
m_loopInc = lastInc;
m_loopp = lastLoopp;
}
virtual void visit(AstReturn* nodep) {
virtual void visit(AstReturn* nodep) VL_OVERRIDE {
iterateChildren(nodep);
AstFunc* funcp = VN_CAST(m_ftaskp, Func);
if (!m_ftaskp) {
@ -195,7 +200,7 @@ private:
}
nodep->unlinkFrBack(); VL_DO_DANGLING(pushDeletep(nodep), nodep);
}
virtual void visit(AstBreak* nodep) {
virtual void visit(AstBreak* nodep) VL_OVERRIDE {
iterateChildren(nodep);
if (!m_loopp) { nodep->v3error("break isn't underneath a loop"); }
else {
@ -205,7 +210,7 @@ private:
}
nodep->unlinkFrBack(); VL_DO_DANGLING(pushDeletep(nodep), nodep);
}
virtual void visit(AstContinue* nodep) {
virtual void visit(AstContinue* nodep) VL_OVERRIDE {
iterateChildren(nodep);
if (!m_loopp) { nodep->v3error("continue isn't underneath a loop"); }
else {
@ -216,7 +221,7 @@ private:
}
nodep->unlinkFrBack(); VL_DO_DANGLING(pushDeletep(nodep), nodep);
}
virtual void visit(AstDisable* nodep) {
virtual void visit(AstDisable* nodep) VL_OVERRIDE {
UINFO(8," DISABLE "<<nodep<<endl);
iterateChildren(nodep);
AstBegin* beginp = NULL;
@ -239,12 +244,12 @@ private:
nodep->unlinkFrBack(); VL_DO_DANGLING(pushDeletep(nodep), nodep);
//if (debug()>=9) { UINFO(0,"\n"); beginp->dumpTree(cout, " labelo: "); }
}
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
if (m_loopInc && nodep->varp()) nodep->varp()->usedLoopIdx(true);
}
virtual void visit(AstConst* nodep) {}
virtual void visit(AstNode* nodep) {
virtual void visit(AstConst* nodep) VL_OVERRIDE {}
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:
@ -254,7 +259,7 @@ public:
m_ftaskp = NULL;
m_loopp = NULL;
m_loopInc = false;
m_repeatNum = 0;
m_modRepeatNum = 0;
iterate(nodep);
}
virtual ~LinkJumpVisitor() {}

View File

@ -50,7 +50,7 @@ private:
// VISITs
// Result handing
virtual void visit(AstNodeVarRef* nodep) {
virtual void visit(AstNodeVarRef* nodep) VL_OVERRIDE {
// VarRef: LValue its reference
if (m_setRefLvalue) {
nodep->lvalue(true);
@ -66,7 +66,7 @@ private:
}
// Nodes that start propagating down lvalues
virtual void visit(AstPin* nodep) {
virtual void visit(AstPin* nodep) VL_OVERRIDE {
if (nodep->modVarp() && nodep->modVarp()->isWritable()) {
// When the varref's were created, we didn't know the I/O state
// Now that we do, and it's from a output, we know it's a lvalue
@ -77,7 +77,7 @@ private:
iterateChildren(nodep);
}
}
virtual void visit(AstNodeAssign* nodep) {
virtual void visit(AstNodeAssign* nodep) VL_OVERRIDE {
bool last_setRefLvalue = m_setRefLvalue;
{
m_setRefLvalue = true;
@ -87,7 +87,7 @@ private:
}
m_setRefLvalue = last_setRefLvalue;
}
virtual void visit(AstFOpen* nodep) {
virtual void visit(AstFOpen* nodep) VL_OVERRIDE {
bool last_setRefLvalue = m_setRefLvalue;
{
m_setRefLvalue = true;
@ -98,7 +98,7 @@ private:
}
m_setRefLvalue = last_setRefLvalue;
}
virtual void visit(AstFClose* nodep) {
virtual void visit(AstFClose* nodep) VL_OVERRIDE {
bool last_setRefLvalue = m_setRefLvalue;
{
m_setRefLvalue = true;
@ -106,7 +106,7 @@ private:
}
m_setRefLvalue = last_setRefLvalue;
}
virtual void visit(AstFFlush* nodep) {
virtual void visit(AstFFlush* nodep) VL_OVERRIDE {
bool last_setRefLvalue = m_setRefLvalue;
{
m_setRefLvalue = true;
@ -114,7 +114,7 @@ private:
}
m_setRefLvalue = last_setRefLvalue;
}
virtual void visit(AstFGetC* nodep) {
virtual void visit(AstFGetC* nodep) VL_OVERRIDE {
bool last_setRefLvalue = m_setRefLvalue;
{
m_setRefLvalue = true;
@ -122,7 +122,7 @@ private:
}
m_setRefLvalue = last_setRefLvalue;
}
virtual void visit(AstFGetS* nodep) {
virtual void visit(AstFGetS* nodep) VL_OVERRIDE {
bool last_setRefLvalue = m_setRefLvalue;
{
m_setRefLvalue = true;
@ -131,7 +131,7 @@ private:
}
m_setRefLvalue = last_setRefLvalue;
}
virtual void visit(AstFRead* nodep) {
virtual void visit(AstFRead* nodep) VL_OVERRIDE {
bool last_setRefLvalue = m_setRefLvalue;
{
m_setRefLvalue = true;
@ -140,7 +140,7 @@ private:
}
m_setRefLvalue = last_setRefLvalue;
}
virtual void visit(AstFScanF* nodep) {
virtual void visit(AstFScanF* nodep) VL_OVERRIDE {
bool last_setRefLvalue = m_setRefLvalue;
{
m_setRefLvalue = true;
@ -149,7 +149,7 @@ private:
}
m_setRefLvalue = last_setRefLvalue;
}
virtual void visit(AstFUngetC* nodep) {
virtual void visit(AstFUngetC* nodep) VL_OVERRIDE {
bool last_setRefLvalue = m_setRefLvalue;
{
m_setRefLvalue = true;
@ -157,7 +157,7 @@ private:
}
m_setRefLvalue = last_setRefLvalue;
}
virtual void visit(AstSScanF* nodep) {
virtual void visit(AstSScanF* nodep) VL_OVERRIDE {
bool last_setRefLvalue = m_setRefLvalue;
{
m_setRefLvalue = true;
@ -165,13 +165,13 @@ private:
}
m_setRefLvalue = last_setRefLvalue;
}
virtual void visit(AstSysIgnore* nodep) {
virtual void visit(AstSysIgnore* nodep) VL_OVERRIDE {
// Can't know if lvalue or not; presume so as stricter
bool last_setRefLvalue = m_setRefLvalue;
iterateChildren(nodep);
m_setRefLvalue = last_setRefLvalue;
}
virtual void visit(AstReadMem* nodep) {
virtual void visit(AstReadMem* nodep) VL_OVERRIDE {
bool last_setRefLvalue = m_setRefLvalue;
{
m_setRefLvalue = true;
@ -183,7 +183,7 @@ private:
}
m_setRefLvalue = last_setRefLvalue;
}
virtual void visit(AstValuePlusArgs* nodep) {
virtual void visit(AstValuePlusArgs* nodep) VL_OVERRIDE {
bool last_setRefLvalue = m_setRefLvalue;
{
m_setRefLvalue = false;
@ -193,7 +193,7 @@ private:
}
m_setRefLvalue = last_setRefLvalue;
}
virtual void visit(AstSFormat* nodep) {
virtual void visit(AstSFormat* nodep) VL_OVERRIDE {
bool last_setRefLvalue = m_setRefLvalue;
{
m_setRefLvalue = true;
@ -205,7 +205,7 @@ private:
}
// Nodes that change LValue state
virtual void visit(AstSel* nodep) {
virtual void visit(AstSel* nodep) VL_OVERRIDE {
bool last_setRefLvalue = m_setRefLvalue;
{
iterateAndNextNull(nodep->lhsp());
@ -216,7 +216,7 @@ private:
}
m_setRefLvalue = last_setRefLvalue;
}
virtual void visit(AstNodeSel* nodep) {
virtual void visit(AstNodeSel* nodep) VL_OVERRIDE {
bool last_setRefLvalue = m_setRefLvalue;
{ // Only set lvalues on the from
iterateAndNextNull(nodep->lhsp());
@ -225,7 +225,7 @@ private:
}
m_setRefLvalue = last_setRefLvalue;
}
virtual void visit(AstCellArrayRef* nodep) {
virtual void visit(AstCellArrayRef* nodep) VL_OVERRIDE {
bool last_setRefLvalue = m_setRefLvalue;
{ // selp is not an lvalue
m_setRefLvalue = false;
@ -233,7 +233,7 @@ private:
}
m_setRefLvalue = last_setRefLvalue;
}
virtual void visit(AstNodePreSel* nodep) {
virtual void visit(AstNodePreSel* nodep) VL_OVERRIDE {
bool last_setRefLvalue = m_setRefLvalue;
{ // Only set lvalues on the from
iterateAndNextNull(nodep->lhsp());
@ -243,12 +243,12 @@ private:
}
m_setRefLvalue = last_setRefLvalue;
}
virtual void visit(AstNodeFTask* nodep) {
virtual void visit(AstNodeFTask* nodep) VL_OVERRIDE {
m_ftaskp = nodep;
iterateChildren(nodep);
m_ftaskp = NULL;
}
virtual void visit(AstNodeFTaskRef* nodep) {
virtual void visit(AstNodeFTaskRef* nodep) VL_OVERRIDE {
AstNode* pinp = nodep->pinsp();
AstNodeFTask* taskp = nodep->taskp();
// We'll deal with mismatching pins later
@ -270,7 +270,7 @@ private:
}
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
// Default: Just iterate
iterateChildren(nodep);
}

View File

@ -106,7 +106,7 @@ private:
}
// VISITs
virtual void visit(AstNodeFTask* nodep) {
virtual void visit(AstNodeFTask* nodep) VL_OVERRIDE {
V3Config::applyFTask(m_modp, nodep);
if (!nodep->user1SetOnce()) { // Process only once.
@ -116,7 +116,7 @@ private:
m_ftaskp = NULL;
}
}
virtual void visit(AstNodeFTaskRef* nodep) {
virtual void visit(AstNodeFTaskRef* nodep) VL_OVERRIDE {
if (!nodep->user1SetOnce()) { // Process only once.
cleanFileline(nodep);
UINFO(5," "<<nodep<<endl);
@ -126,22 +126,22 @@ private:
m_valueModp = upperValueModp;
}
}
virtual void visit(AstNodeDType* nodep) {
virtual void visit(AstNodeDType* nodep) VL_OVERRIDE {
visitIterateNodeDType(nodep);
}
virtual void visit(AstEnumDType* nodep) {
virtual void visit(AstEnumDType* nodep) VL_OVERRIDE {
if (nodep->name() == "") {
nodep->name(nameFromTypedef(nodep)); // Might still remain ""
}
visitIterateNodeDType(nodep);
}
virtual void visit(AstNodeUOrStructDType* nodep) {
virtual void visit(AstNodeUOrStructDType* nodep) VL_OVERRIDE {
if (nodep->name() == "") {
nodep->name(nameFromTypedef(nodep)); // Might still remain ""
}
visitIterateNodeDType(nodep);
}
virtual void visit(AstEnumItem* nodep) {
virtual void visit(AstEnumItem* nodep) VL_OVERRIDE {
// Expand ranges
cleanFileline(nodep);
iterateChildren(nodep);
@ -173,7 +173,7 @@ private:
}
}
virtual void visit(AstVar* nodep) {
virtual void visit(AstVar* nodep) VL_OVERRIDE {
cleanFileline(nodep);
if (VN_IS(nodep->subDTypep(), ParseTypeDType)) {
// It's a parameter type. Use a different node type for this.
@ -255,7 +255,7 @@ private:
}
}
virtual void visit(AstAttrOf* nodep) {
virtual void visit(AstAttrOf* nodep) VL_OVERRIDE {
cleanFileline(nodep);
iterateChildren(nodep);
if (nodep->attrType() == AstAttrType::DT_PUBLIC) {
@ -322,7 +322,7 @@ private:
}
}
virtual void visit(AstAlwaysPublic* nodep) {
virtual void visit(AstAlwaysPublic* nodep) VL_OVERRIDE {
// AlwaysPublic was attached under a var, but it's a statement that should be
// at the same level as the var
cleanFileline(nodep);
@ -337,7 +337,7 @@ private:
}
}
virtual void visit(AstDefImplicitDType* nodep) {
virtual void visit(AstDefImplicitDType* nodep) VL_OVERRIDE {
cleanFileline(nodep);
UINFO(8," DEFIMPLICIT "<<nodep<<endl);
// Must remember what names we've already created, and combine duplicates
@ -376,14 +376,14 @@ private:
VL_DO_DANGLING(nodep->deleteTree(), nodep);
}
virtual void visit(AstTypedefFwd* nodep) {
virtual void visit(AstTypedefFwd* nodep) VL_OVERRIDE {
// We only needed the forward declaration in order to parse correctly.
// We won't even check it was ever really defined, as it might have been in a header
// file referring to a module we never needed
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
}
virtual void visit(AstForeach* nodep) {
virtual void visit(AstForeach* nodep) VL_OVERRIDE {
// FOREACH(array,loopvars,body)
// -> BEGIN(declare vars, loopa=lowest; WHILE(loopa<=highest, ... body))
//nodep->dumpTree(cout, "-foreach-old:");
@ -443,17 +443,20 @@ private:
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
}
virtual void visit(AstNodeModule* nodep) {
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
V3Config::applyModule(nodep);
// Module: Create sim table for entire module and iterate
cleanFileline(nodep);
//
m_modp = nodep;
AstNodeModule* origModp = m_modp;
{
// Module: Create sim table for entire module and iterate
cleanFileline(nodep);
//
m_modp = nodep;
m_valueModp = nodep;
iterateChildren(nodep);
}
m_modp = origModp;
m_valueModp = nodep;
iterateChildren(nodep);
m_modp = NULL;
m_valueModp = NULL;
}
void visitIterateNoValueMod(AstNode* nodep) {
// Iterate a node which shouldn't have any local variables moved to an Initial
@ -464,36 +467,36 @@ private:
iterateChildren(nodep);
m_valueModp = upperValueModp;
}
virtual void visit(AstInitial* nodep) {
virtual void visit(AstInitial* nodep) VL_OVERRIDE {
visitIterateNoValueMod(nodep);
}
virtual void visit(AstFinal* nodep) {
virtual void visit(AstFinal* nodep) VL_OVERRIDE {
visitIterateNoValueMod(nodep);
}
virtual void visit(AstAlways* nodep) {
virtual void visit(AstAlways* nodep) VL_OVERRIDE {
m_inAlways = true;
visitIterateNoValueMod(nodep);
m_inAlways = false;
}
virtual void visit(AstCover* nodep) {
virtual void visit(AstCover* nodep) VL_OVERRIDE {
visitIterateNoValueMod(nodep);
}
virtual void visit(AstRestrict* nodep) {
virtual void visit(AstRestrict* nodep) VL_OVERRIDE {
visitIterateNoValueMod(nodep);
}
virtual void visit(AstBegin* nodep) {
virtual void visit(AstBegin* nodep) VL_OVERRIDE {
V3Config::applyCoverageBlock(m_modp, nodep);
cleanFileline(nodep);
iterateChildren(nodep);
}
virtual void visit(AstCase* nodep) {
virtual void visit(AstCase* nodep) VL_OVERRIDE {
V3Config::applyCase(nodep);
cleanFileline(nodep);
iterateChildren(nodep);
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
// Default: Just iterate
cleanFileline(nodep);
iterateChildren(nodep);

View File

@ -65,16 +65,21 @@ private:
// TODO: Most of these visitors are here for historical reasons.
// TODO: ExpectDecriptor can move to data type resolution, and the rest
// TODO: could move to V3LinkParse to get them out of the way of elaboration
virtual void visit(AstNodeModule* nodep) {
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
// Module: Create sim table for entire module and iterate
UINFO(8,"MODULE "<<nodep<<endl);
if (nodep->dead()) return;
m_modp = nodep;
m_senitemCvtNum = 0;
iterateChildren(nodep);
m_modp = NULL;
AstNodeModule* origModp = m_modp;
int origSenitemCvtNum = m_senitemCvtNum;
{
m_modp = nodep;
m_senitemCvtNum = 0;
iterateChildren(nodep);
}
m_modp = origModp;
m_senitemCvtNum = origSenitemCvtNum;
}
virtual void visit(AstInitial* nodep) {
virtual void visit(AstInitial* nodep) VL_OVERRIDE {
iterateChildren(nodep);
// Initial assignments under function/tasks can just be simple
// assignments without the initial
@ -82,14 +87,14 @@ private:
VL_DO_DANGLING(nodep->replaceWith(nodep->bodysp()->unlinkFrBackWithNext()), nodep);
}
}
virtual void visit(AstNodeCoverOrAssert* nodep) {
virtual void visit(AstNodeCoverOrAssert* nodep) VL_OVERRIDE {
if (m_assertp) nodep->v3error("Assert not allowed under another assert");
m_assertp = nodep;
iterateChildren(nodep);
m_assertp = NULL;
}
virtual void visit(AstVar* nodep) {
virtual void visit(AstVar* nodep) VL_OVERRIDE {
iterateChildren(nodep);
if (m_ftaskp) nodep->funcLocal(true);
if (nodep->isSigModPublic()) {
@ -98,7 +103,7 @@ private:
}
}
virtual void visit(AstNodeVarRef* nodep) {
virtual void visit(AstNodeVarRef* nodep) VL_OVERRIDE {
// VarRef: Resolve its reference
if (nodep->varp()) {
nodep->varp()->usedParam(true);
@ -106,7 +111,7 @@ private:
iterateChildren(nodep);
}
virtual void visit(AstNodeFTask* nodep) {
virtual void visit(AstNodeFTask* nodep) VL_OVERRIDE {
// NodeTask: Remember its name for later resolution
// Remember the existing symbol table scope
m_ftaskp = nodep;
@ -116,14 +121,14 @@ private:
nodep->scopeNamep(new AstScopeName(nodep->fileline()));
}
}
virtual void visit(AstNodeFTaskRef* nodep) {
virtual void visit(AstNodeFTaskRef* nodep) VL_OVERRIDE {
iterateChildren(nodep);
if (nodep->taskp() && (nodep->taskp()->dpiContext() || nodep->taskp()->dpiExport())) {
nodep->scopeNamep(new AstScopeName(nodep->fileline()));
}
}
virtual void visit(AstSenItem* nodep) {
virtual void visit(AstSenItem* nodep) VL_OVERRIDE {
// Remove bit selects, and bark if it's not a simple variable
iterateChildren(nodep);
if (nodep->isClocked()) {
@ -190,11 +195,11 @@ private:
nodep->v3error("Unsupported: Complex statement in sensitivity list");
}
}
virtual void visit(AstSenGate* nodep) {
virtual void visit(AstSenGate* nodep) VL_OVERRIDE {
nodep->v3fatalSrc("SenGates shouldn't be in tree yet");
}
virtual void visit(AstNodePreSel* nodep) {
virtual void visit(AstNodePreSel* nodep) VL_OVERRIDE {
if (!nodep->attrp()) {
iterateChildren(nodep);
// Constification may change the fromp() to a constant, which will lose the
@ -226,7 +231,7 @@ private:
}
}
virtual void visit(AstCaseItem* nodep) {
virtual void visit(AstCaseItem* nodep) VL_OVERRIDE {
// Move default caseItems to the bottom of the list
// That saves us from having to search each case list twice, for non-defaults and defaults
iterateChildren(nodep);
@ -238,7 +243,7 @@ private:
}
}
virtual void visit(AstPragma* nodep) {
virtual void visit(AstPragma* nodep) VL_OVERRIDE {
if (nodep->pragType() == AstPragmaType::PUBLIC_MODULE) {
UASSERT_OBJ(m_modp, nodep, "PUBLIC_MODULE not under a module");
m_modp->modPublic(true);
@ -359,31 +364,31 @@ private:
if (filep && filep->varp()) filep->varp()->attrFileDescr(true);
}
virtual void visit(AstFOpen* nodep) {
virtual void visit(AstFOpen* nodep) VL_OVERRIDE {
iterateChildren(nodep);
expectDescriptor(nodep, VN_CAST(nodep->filep(), NodeVarRef));
}
virtual void visit(AstFClose* nodep) {
virtual void visit(AstFClose* nodep) VL_OVERRIDE {
iterateChildren(nodep);
expectDescriptor(nodep, VN_CAST(nodep->filep(), NodeVarRef));
}
virtual void visit(AstFEof* nodep) {
virtual void visit(AstFEof* nodep) VL_OVERRIDE {
iterateChildren(nodep);
expectDescriptor(nodep, VN_CAST(nodep->filep(), NodeVarRef));
}
virtual void visit(AstFRead* nodep) {
virtual void visit(AstFRead* nodep) VL_OVERRIDE {
iterateChildren(nodep);
expectDescriptor(nodep, VN_CAST(nodep->filep(), NodeVarRef));
}
virtual void visit(AstFScanF* nodep) {
virtual void visit(AstFScanF* nodep) VL_OVERRIDE {
iterateChildren(nodep);
expectFormat(nodep, nodep->text(), nodep->exprsp(), true);
}
virtual void visit(AstSScanF* nodep) {
virtual void visit(AstSScanF* nodep) VL_OVERRIDE {
iterateChildren(nodep);
expectFormat(nodep, nodep->text(), nodep->exprsp(), true);
}
virtual void visit(AstSFormatF* nodep) {
virtual void visit(AstSFormatF* nodep) VL_OVERRIDE {
iterateChildren(nodep);
// Cleanup old-school displays without format arguments
if (!nodep->hasFormat()) {
@ -405,7 +410,7 @@ private:
}
}
virtual void visit(AstUdpTable* nodep) {
virtual void visit(AstUdpTable* nodep) VL_OVERRIDE {
UINFO(5,"UDPTABLE "<<nodep<<endl);
if (!v3Global.opt.bboxUnsup()) {
// We don't warn until V3Inst, so that UDPs that are in libraries and
@ -436,23 +441,23 @@ private:
}
}
virtual void visit(AstScCtor* nodep) {
virtual void visit(AstScCtor* nodep) VL_OVERRIDE {
// Constructor info means the module must remain public
m_modp->modPublic(true);
iterateChildren(nodep);
}
virtual void visit(AstScDtor* nodep) {
virtual void visit(AstScDtor* nodep) VL_OVERRIDE {
// Destructor info means the module must remain public
m_modp->modPublic(true);
iterateChildren(nodep);
}
virtual void visit(AstScInt* nodep) {
virtual void visit(AstScInt* nodep) VL_OVERRIDE {
// Special class info means the module must remain public
m_modp->modPublic(true);
iterateChildren(nodep);
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
// Default: Just iterate
iterateChildren(nodep);
}
@ -484,24 +489,27 @@ private:
VL_DEBUG_FUNC; // Declare debug()
// VISITs
virtual void visit(AstNetlist* nodep) {
virtual void visit(AstNetlist* nodep) VL_OVERRIDE {
// Iterate modules backwards, in bottom-up order.
iterateChildrenBackwards(nodep);
}
virtual void visit(AstNodeModule* nodep) {
m_modp = nodep;
iterateChildren(nodep);
m_modp = NULL;
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
AstNodeModule* origModp = m_modp;
{
m_modp = nodep;
iterateChildren(nodep);
}
m_modp = origModp;
}
virtual void visit(AstCell* nodep) {
virtual void visit(AstCell* nodep) VL_OVERRIDE {
// Parent module inherits child's publicity
if (nodep->modp()->modPublic()) m_modp->modPublic(true);
//** No iteration for speed
}
virtual void visit(AstNodeMath* nodep) {
virtual void visit(AstNodeMath* nodep) VL_OVERRIDE {
// Speedup
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
// Default: Just iterate
iterateChildren(nodep);
}

View File

@ -77,14 +77,14 @@ private:
// See above
// METHODS
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
VarFlags flags (nodep->varp());
if (flags.m_done) {
nodep->hiername(""); // Remove this->
nodep->hierThis(true);
}
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:
@ -151,11 +151,11 @@ private:
}
// VISITORS
virtual void visit(AstNetlist* nodep) {
virtual void visit(AstNetlist* nodep) VL_OVERRIDE {
iterateChildren(nodep);
moveVars();
}
virtual void visit(AstCFunc* nodep) {
virtual void visit(AstCFunc* nodep) VL_OVERRIDE {
UINFO(4," CFUNC "<<nodep<<endl);
m_cfuncp = nodep;
searchFuncStmts(nodep->argsp());
@ -186,7 +186,7 @@ private:
}
}
virtual void visit(AstVar* nodep) {
virtual void visit(AstVar* nodep) VL_OVERRIDE {
if (!nodep->isSigPublic()
&& !nodep->isPrimaryIO()
&& !m_cfuncp) { // Not already inside a function
@ -195,7 +195,7 @@ private:
}
// No iterate; Don't want varrefs under it
}
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
if (!VarFlags(nodep->varp()).m_notOpt) {
if (!m_cfuncp) { // Not in function, can't optimize
clearOptimizable(nodep->varp(), "BVnofunc");
@ -224,7 +224,7 @@ private:
}
// No iterate; Don't want varrefs under it
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:

View File

@ -59,6 +59,7 @@ private:
if (addPvt) {
string newname = string("__PVT__")+nodep->name();
nodep->name(newname);
nodep->editCountInc();
} else {
string rsvd = m_words.isKeyword(nodep->name());
if (rsvd != "") {
@ -66,6 +67,7 @@ private:
+": "<<nodep->prettyNameQ());
string newname = string("__SYM__")+nodep->name();
nodep->name(newname);
nodep->editCountInc();
}
}
nodep->user1(1);
@ -73,50 +75,53 @@ private:
}
// VISITORS
virtual void visit(AstNodeModule* nodep) {
m_modp = nodep;
iterateChildren(nodep);
m_modp = NULL;
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
AstNodeModule* origModp = m_modp;
{
m_modp = nodep;
iterateChildren(nodep);
}
m_modp = origModp;
}
// Add __PVT__ to names of local signals
virtual void visit(AstVar* nodep) {
virtual void visit(AstVar* nodep) VL_OVERRIDE {
// Don't iterate... Don't need temps for RANGES under the Var.
rename(nodep, (!m_modp->isTop()
&& !nodep->isSigPublic()
&& !nodep->isFuncLocal() // Isn't exposed, and would mess up dpi import wrappers
&& !nodep->isTemp())); // Don't bother to rename internal signals
}
virtual void visit(AstCFunc* nodep) {
virtual void visit(AstCFunc* nodep) VL_OVERRIDE {
if (!nodep->user1()) {
iterateChildren(nodep);
rename(nodep, false);
}
}
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
if (nodep->varp()) {
iterate(nodep->varp());
nodep->name(nodep->varp()->name());
}
}
virtual void visit(AstCell* nodep) {
virtual void visit(AstCell* nodep) VL_OVERRIDE {
if (!nodep->user1()) {
rename(nodep, !nodep->modp()->modPublic());
iterateChildren(nodep);
}
}
virtual void visit(AstMemberDType* nodep) {
virtual void visit(AstMemberDType* nodep) VL_OVERRIDE {
if (!nodep->user1()) {
rename(nodep, false);
iterateChildren(nodep);
}
}
virtual void visit(AstMemberSel* nodep) {
virtual void visit(AstMemberSel* nodep) VL_OVERRIDE {
if (!nodep->user1()) {
rename(nodep, false);
iterateChildren(nodep);
}
}
virtual void visit(AstScope* nodep) {
virtual void visit(AstScope* nodep) VL_OVERRIDE {
if (!nodep->user1SetOnce()) {
if (nodep->aboveScopep()) iterate(nodep->aboveScopep());
if (nodep->aboveCellp()) iterate(nodep->aboveCellp());
@ -129,7 +134,7 @@ private:
}
//--------------------
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:

View File

@ -32,7 +32,6 @@
#include <iomanip>
#define MAX_SPRINTF_DOUBLE_SIZE 100 // Maximum characters with a sprintf %e/%f/%g (probably < 30)
#define MAX_WIDTH 5*1024 // Maximum width before error
// Number operations build output in-place so can't call e.g. foo.opX(foo)
#define NUM_ASSERT_OP_ARGS1(arg1) \
@ -125,10 +124,11 @@ void V3Number::V3NumberCreate(AstNode* nodep, const char* sourcep, FileLine* fl)
value_startp = cp;
if (atoi(widthn.c_str())) {
if (atoi(widthn.c_str()) < 0 || atoi(widthn.c_str()) > MAX_WIDTH) {
if (atoi(widthn.c_str()) < 0 || atoi(widthn.c_str()) > v3Global.opt.maxNumWidth()) {
// atoi might convert large number to negative, so can't tell which
v3error("Unsupported: Width of number exceeds implementation limit: "<<sourcep);
width(MAX_WIDTH, true);
v3error("Unsupported: Width of number exceeds implementation limit: "
<< sourcep << " (IEEE 2017 6.9.1)");
width(v3Global.opt.maxNumWidth(), true);
} else {
width(atoi(widthn.c_str()), true);
}

View File

@ -948,6 +948,10 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char
fl->v3fatal("Unknown --make system specified: '"<<argv[i]<<"'");
}
}
else if (!strcmp(sw, "-max-num-width")) {
shift;
m_maxNumWidth = atoi(argv[i]);
}
else if (!strcmp(sw, "-no-l2name")) { // Historical and undocumented
m_l2Name = "";
}
@ -1518,6 +1522,7 @@ V3Options::V3Options() {
m_gateStmts = 100;
m_ifDepth = 0;
m_inlineMult = 2000;
m_maxNumWidth = 65536;
m_moduleRecursion = 100;
m_outputSplit = 0;
m_outputSplitCFuncs = 0;

View File

@ -201,6 +201,7 @@ class V3Options {
int m_ifDepth; // main switch: --if-depth
int m_inlineMult; // main switch: --inline-mult
VOptionBool m_makeDepend; // main switch: -MMD
int m_maxNumWidth; // main switch: --max-num-width
int m_moduleRecursion;// main switch: --module-recursion-depth
int m_outputSplit; // main switch: --output-split
int m_outputSplitCFuncs;// main switch: --output-split-cfuncs
@ -376,6 +377,7 @@ class V3Options {
int ifDepth() const { return m_ifDepth; }
int inlineMult() const { return m_inlineMult; }
VOptionBool makeDepend() const { return m_makeDepend; }
int maxNumWidth() const { return m_maxNumWidth; }
int moduleRecursionDepth() const { return m_moduleRecursion; }
int outputSplit() const { return m_outputSplit; }
int outputSplitCFuncs() const { return m_outputSplitCFuncs; }

View File

@ -275,7 +275,7 @@ private:
// METHODS
VL_DEBUG_FUNC; // Declare debug()
virtual void visit(AstNodeAssign* nodep) {
virtual void visit(AstNodeAssign* nodep) VL_OVERRIDE {
m_hasClk = false;
if (AstVarRef* varrefp = VN_CAST(nodep->rhsp(), VarRef)) {
this->visit(varrefp);
@ -316,7 +316,7 @@ private:
}
}
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
if (m_inAss && nodep->varp()->attrClocker() == VVarAttrClocker::CLOCKER_YES) {
if (m_inClocked) {
nodep->v3warn(CLKDATA,
@ -329,7 +329,7 @@ private:
}
}
}
virtual void visit(AstConcat* nodep) {
virtual void visit(AstConcat* nodep) VL_OVERRIDE {
if (m_inAss) {
iterateAndNextNull(nodep->lhsp());
int lw = m_childClkWidth;
@ -338,20 +338,20 @@ private:
m_childClkWidth = lw + rw; // Pass up
}
}
virtual void visit(AstNodeSel* nodep) {
virtual void visit(AstNodeSel* nodep) VL_OVERRIDE {
if (m_inAss) {
iterateChildren(nodep);
// Pass up result width
if (m_childClkWidth > nodep->width()) m_childClkWidth = nodep->width();
}
}
virtual void visit(AstSel* nodep) {
virtual void visit(AstSel* nodep) VL_OVERRIDE {
if (m_inAss) {
iterateChildren(nodep);
if (m_childClkWidth > nodep->width()) m_childClkWidth = nodep->width();
}
}
virtual void visit(AstReplicate* nodep) {
virtual void visit(AstReplicate* nodep) VL_OVERRIDE {
if (m_inAss) {
iterateChildren(nodep);
if (VN_IS(nodep->rhsp(), Const)) {
@ -361,12 +361,12 @@ private:
}
}
}
virtual void visit(AstActive* nodep) {
virtual void visit(AstActive* nodep) VL_OVERRIDE {
m_inClocked = nodep->hasClocked();
iterateChildren(nodep);
m_inClocked = false;
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
@ -394,7 +394,7 @@ private:
bool m_clkAss; // There is signals marked as clocker in the assignment
// METHODS
VL_DEBUG_FUNC; // Declare debug()
virtual void visit(AstNodeAssign* nodep) {
virtual void visit(AstNodeAssign* nodep) VL_OVERRIDE {
if (const AstVarRef* varrefp = VN_CAST(nodep->lhsp(), VarRef)) {
if (varrefp->varp()->attrClocker() == VVarAttrClocker::CLOCKER_YES) {
m_clkAss = true;
@ -403,13 +403,13 @@ private:
}
iterateChildren(nodep->rhsp());
}
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
// Previous versions checked attrClocker() here, but this breaks
// the updated t_clocker VCD test.
// If reenable this visitor note AstNodeMath short circuit below
}
virtual void visit(AstNodeMath* nodep) {} // Accelerate
virtual void visit(AstNode* nodep) {
virtual void visit(AstNodeMath* nodep) VL_OVERRIDE {} // Accelerate
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:
@ -973,7 +973,7 @@ private:
}
}
// VISITORS
virtual void visit(AstNetlist* nodep) {
virtual void visit(AstNetlist* nodep) VL_OVERRIDE {
{
AstUser4InUse m_inuser4; // Used only when building tree, so below
iterateChildren(nodep);
@ -981,7 +981,7 @@ private:
// We're finished, complete the topscopes
if (m_topScopep) { process(); m_topScopep=NULL; }
}
virtual void visit(AstTopScope* nodep) {
virtual void visit(AstTopScope* nodep) VL_OVERRIDE {
// Process the last thing we're finishing
UASSERT_OBJ(!m_topScopep, nodep, "Only one topscope should ever be created");
UINFO(2," Loading tree...\n");
@ -1020,12 +1020,15 @@ private:
AstNode::user3ClearTree();
AstNode::user4ClearTree();
}
virtual void visit(AstNodeModule* nodep) {
m_modp = nodep;
iterateChildren(nodep);
m_modp = NULL;
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
AstNodeModule* origModp = m_modp;
{
m_modp = nodep;
iterateChildren(nodep);
}
m_modp = origModp;
}
virtual void visit(AstScope* nodep) {
virtual void visit(AstScope* nodep) VL_OVERRIDE {
UINFO(4," SCOPE "<<nodep<<endl);
m_scopep = nodep;
m_logicVxp = NULL;
@ -1035,7 +1038,7 @@ private:
iterateChildren(nodep);
m_scopep = NULL;
}
virtual void visit(AstActive* nodep) {
virtual void visit(AstActive* nodep) VL_OVERRIDE {
// Create required activation blocks and add to module
UINFO(4," ACTIVE "<<nodep<<endl);
m_activep = nodep;
@ -1051,14 +1054,15 @@ private:
m_activeSenVxp = NULL;
m_inClocked = false;
}
virtual void visit(AstVarScope* nodep) {
virtual void visit(AstVarScope* nodep) VL_OVERRIDE {
// Create links to all input signals
UASSERT_OBJ(m_modp, nodep, "Scope not under module");
if (m_modp->isTop() && nodep->varp()->isNonOutput()) {
OrderVarVertex* varVxp = newVarUserVertex(nodep, WV_STD);
new OrderEdge(&m_graph, m_inputsVxp, varVxp, WEIGHT_INPUT);
}
}
virtual void visit(AstNodeVarRef* nodep) {
virtual void visit(AstNodeVarRef* nodep) VL_OVERRIDE {
if (m_scopep) {
AstVarScope* varscp = nodep->varScopep();
UASSERT_OBJ(varscp, nodep, "Var didn't get varscoped in V3Scope.cpp");
@ -1187,7 +1191,7 @@ private:
}
}
}
virtual void visit(AstSenTree* nodep) {
virtual void visit(AstSenTree* nodep) VL_OVERRIDE {
// Having a node derived from the sentree isn't required for
// correctness, it merely makes the graph better connected
// and improves graph algorithmic performance
@ -1202,27 +1206,27 @@ private:
m_inSenTree = false;
}
}
virtual void visit(AstAlways* nodep) {
virtual void visit(AstAlways* nodep) VL_OVERRIDE {
iterateNewStmt(nodep);
}
virtual void visit(AstAlwaysPost* nodep) {
virtual void visit(AstAlwaysPost* nodep) VL_OVERRIDE {
m_inPost = true;
iterateNewStmt(nodep);
m_inPost = false;
}
virtual void visit(AstAlwaysPublic* nodep) {
virtual void visit(AstAlwaysPublic* nodep) VL_OVERRIDE {
iterateNewStmt(nodep);
}
virtual void visit(AstAssignAlias* nodep) {
virtual void visit(AstAssignAlias* nodep) VL_OVERRIDE {
iterateNewStmt(nodep);
}
virtual void visit(AstAssignW* nodep) {
virtual void visit(AstAssignW* nodep) VL_OVERRIDE {
OrderClkAssVisitor visitor(nodep);
m_inClkAss = visitor.isClkAss();
iterateNewStmt(nodep);
m_inClkAss = false;
}
virtual void visit(AstAssignPre* nodep) {
virtual void visit(AstAssignPre* nodep) VL_OVERRIDE {
OrderClkAssVisitor visitor(nodep);
m_inClkAss = visitor.isClkAss();
m_inPre = true;
@ -1230,7 +1234,7 @@ private:
m_inPre = false;
m_inClkAss = false;
}
virtual void visit(AstAssignPost* nodep) {
virtual void visit(AstAssignPost* nodep) VL_OVERRIDE {
OrderClkAssVisitor visitor(nodep);
m_inClkAss = visitor.isClkAss();
m_inPost = true;
@ -1238,15 +1242,15 @@ private:
m_inPost = false;
m_inClkAss = false;
}
virtual void visit(AstCoverToggle* nodep) {
virtual void visit(AstCoverToggle* nodep) VL_OVERRIDE {
iterateNewStmt(nodep);
}
virtual void visit(AstInitial* nodep) {
virtual void visit(AstInitial* nodep) VL_OVERRIDE {
// We use initials to setup parameters and static consts's which may be referenced
// in user initial blocks. So use ordering to sort them all out.
iterateNewStmt(nodep);
}
virtual void visit(AstCFunc*) {
virtual void visit(AstCFunc*) VL_OVERRIDE {
// Ignore for now
// We should detect what variables are set in the function, and make
// settlement code for them, then set a global flag, so we call "settle"
@ -1254,7 +1258,7 @@ private:
}
//--------------------
// Default
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:
@ -1479,7 +1483,7 @@ void OrderVisitor::processCircular() {
for (V3GraphEdge* edgep = vvertexp->outBeginp(); edgep; edgep=edgep->outNextp()) {
if (edgep->weight()==0) { // was cut
OrderEdge* oedgep = dynamic_cast<OrderEdge*>(edgep);
UASSERT_OBJ(oedgep, vvertexp->varScp(), "Cuttable edge not of proper type");
UASSERT_OBJ(oedgep, vvertexp->varScp(), "Cutable edge not of proper type");
UINFO(6," CutCircularO: "<<vvertexp->name()<<endl);
nodeMarkCircular(vvertexp, oedgep);
}
@ -1487,7 +1491,7 @@ void OrderVisitor::processCircular() {
for (V3GraphEdge* edgep = vvertexp->inBeginp(); edgep; edgep = edgep->inNextp()) {
if (edgep->weight()==0) { // was cut
OrderEdge* oedgep = dynamic_cast<OrderEdge*>(edgep);
UASSERT_OBJ(oedgep, vvertexp->varScp(), "Cuttable edge not of proper type");
UASSERT_OBJ(oedgep, vvertexp->varScp(), "Cutable edge not of proper type");
UINFO(6," CutCircularI: "<<vvertexp->name()<<endl);
nodeMarkCircular(vvertexp, oedgep);
}

View File

@ -266,11 +266,11 @@ private:
}
// VISITORS
virtual void visit(AstNetlist* nodep) {
virtual void visit(AstNetlist* nodep) VL_OVERRIDE {
// Modules must be done in top-down-order
iterateChildren(nodep);
}
virtual void visit(AstNodeModule* nodep) {
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
if (nodep->dead()) {
UINFO(4," MOD-dead. "<<nodep<<endl); // Marked by LinkDot
} else if (nodep->recursiveClone()) {
@ -288,7 +288,7 @@ private:
UINFO(4," MOD-dead? "<<nodep<<endl); // Should have been done by now, if not dead
}
}
virtual void visit(AstCell* nodep) {
virtual void visit(AstCell* nodep) VL_OVERRIDE {
// Must do ifaces first, so push to list and do in proper order
string* genHierNamep = new string(m_generateHierName);
nodep->user5p(genHierNamep);
@ -296,7 +296,7 @@ private:
}
// Make sure all parameters are constantified
virtual void visit(AstVar* nodep) {
virtual void visit(AstVar* nodep) VL_OVERRIDE {
if (!nodep->user5SetOnce()) { // Process once
iterateChildren(nodep);
if (nodep->isParam()) {
@ -322,7 +322,7 @@ private:
}
}
// Make sure varrefs cause vars to constify before things above
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
if (nodep->varp()) iterate(nodep->varp());
}
bool ifaceParamReplace(AstVarXRef* nodep, AstNode* candp) {
@ -342,7 +342,7 @@ private:
}
return false;
}
virtual void visit(AstVarXRef* nodep) {
virtual void visit(AstVarXRef* nodep) VL_OVERRIDE {
// Check to see if the scope is just an interface because interfaces are special
string dotted = nodep->dotted();
if (!dotted.empty() && nodep->varp() && nodep->varp()->isParam()) {
@ -382,7 +382,7 @@ private:
nodep->varp(NULL); // Needs relink, as may remove pointed-to var
}
virtual void visit(AstUnlinkedRef* nodep) {
virtual void visit(AstUnlinkedRef* nodep) VL_OVERRIDE {
AstVarXRef* varxrefp = VN_CAST(nodep->op1p(), VarXRef);
AstNodeFTaskRef* taskrefp = VN_CAST(nodep->op1p(), NodeFTaskRef);
if (varxrefp) {
@ -403,7 +403,7 @@ private:
nodep->replaceWith(nodep->op1p()->unlinkFrBack());
VL_DO_DANGLING(pushDeletep(nodep), nodep);
}
virtual void visit(AstCellArrayRef* nodep) {
virtual void visit(AstCellArrayRef* nodep) VL_OVERRIDE {
V3Const::constifyParamsEdit(nodep->selp());
if (const AstConst* constp = VN_CAST(nodep->selp(), Const)) {
string index = AstNode::encodeNumber(constp->toSInt());
@ -424,7 +424,7 @@ private:
}
// Generate Statements
virtual void visit(AstGenerate* nodep) {
virtual void visit(AstGenerate* nodep) VL_OVERRIDE {
if (debug()>=9) nodep->dumpTree(cout, "-genin: ");
iterateChildren(nodep);
// After expanding the generate, all statements under it can be moved
@ -438,7 +438,7 @@ private:
}
VL_DO_DANGLING(nodep->deleteTree(), nodep);
}
virtual void visit(AstGenIf* nodep) {
virtual void visit(AstGenIf* nodep) VL_OVERRIDE {
UINFO(9," GENIF "<<nodep<<endl);
iterateAndNextNull(nodep->condp());
// We suppress errors when widthing params since short-circuiting in
@ -468,7 +468,7 @@ private:
//! @todo Unlike generated IF, we don't have to worry about short-circuiting the conditional
//! expression, since this is currently restricted to simple comparisons. If we ever do
//! move to more generic constant expressions, such code will be needed here.
virtual void visit(AstBegin* nodep) {
virtual void visit(AstBegin* nodep) VL_OVERRIDE {
if (nodep->genforp()) {
AstGenFor* forp = VN_CAST(nodep->genforp(), GenFor);
UASSERT_OBJ(forp, nodep, "Non-GENFOR under generate-for BEGIN");
@ -477,7 +477,7 @@ private:
UINFO(9," BEGIN "<<nodep<<endl);
UINFO(9," GENFOR "<<forp<<endl);
V3Width::widthParamsEdit(forp); // Param typed widthing will NOT recurse the body
// Outer wrapper around generate used to hold genvar, and to insure genvar
// Outer wrapper around generate used to hold genvar, and to ensure genvar
// doesn't conflict in V3LinkDot resolution with other genvars
// Now though we need to change BEGIN("zzz", GENFOR(...)) to
// a BEGIN("zzz__BRA__{loop#}__KET__")
@ -501,10 +501,10 @@ private:
m_generateHierName = rootHierName;
}
}
virtual void visit(AstGenFor* nodep) {
virtual void visit(AstGenFor* nodep) VL_OVERRIDE {
nodep->v3fatalSrc("GENFOR should have been wrapped in BEGIN");
}
virtual void visit(AstGenCase* nodep) {
virtual void visit(AstGenCase* nodep) VL_OVERRIDE {
UINFO(9," GENCASE "<<nodep<<endl);
AstNode* keepp = NULL;
iterateAndNextNull(nodep->exprp());
@ -557,7 +557,7 @@ private:
}
// Default: Just iterate
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}

View File

@ -1766,7 +1766,7 @@ private:
// METHODS
VL_DEBUG_FUNC;
virtual void visit(AstCFunc* nodep) {
virtual void visit(AstCFunc* nodep) VL_OVERRIDE {
if (!m_tracingCall) return;
m_tracingCall = false;
if (nodep->dpiImportWrapper()) {
@ -1777,13 +1777,13 @@ private:
}
iterateChildren(nodep);
}
virtual void visit(AstCCall* nodep) {
virtual void visit(AstCCall* nodep) VL_OVERRIDE {
iterateChildren(nodep);
// Enter the function and trace it
m_tracingCall = true;
iterate(nodep->funcp());
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}

View File

@ -55,14 +55,14 @@ private:
VL_DEBUG_FUNC; // Declare debug()
// VISITORS
virtual void visit(AstNodeAssign* nodep) {
virtual void visit(AstNodeAssign* nodep) VL_OVERRIDE {
//AstNode::user4ClearTree(); // Implied by AstUser4InUse
// LHS first as fewer varrefs
iterateAndNextNull(nodep->lhsp());
// Now find vars marked as lhs
iterateAndNextNull(nodep->rhsp());
}
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
// it's LHS var is used so need a deep temporary
if (nodep->lvalue()) {
nodep->varp()->user4(true);
@ -73,7 +73,7 @@ private:
}
}
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
@ -197,14 +197,17 @@ private:
}
// VISITORS
virtual void visit(AstNodeModule* nodep) {
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
UINFO(4," MOD "<<nodep<<endl);
m_modp = nodep;
m_funcp = NULL;
iterateChildren(nodep);
m_modp = NULL;
AstNodeModule* origModp = m_modp;
{
m_modp = nodep;
m_funcp = NULL;
iterateChildren(nodep);
}
m_modp = origModp;
}
virtual void visit(AstCFunc* nodep) {
virtual void visit(AstCFunc* nodep) VL_OVERRIDE {
m_funcp = nodep;
iterateChildren(nodep);
m_funcp = NULL;
@ -213,7 +216,7 @@ private:
m_assignLhs = false;
if (m_funcp) m_stmtp = nodep;
}
virtual void visit(AstWhile* nodep) {
virtual void visit(AstWhile* nodep) VL_OVERRIDE {
UINFO(4," WHILE "<<nodep<<endl);
startStatement(nodep);
iterateAndNextNull(nodep->precondsp());
@ -226,7 +229,7 @@ private:
iterateAndNextNull(nodep->incsp());
m_stmtp = NULL;
}
virtual void visit(AstNodeAssign* nodep) {
virtual void visit(AstNodeAssign* nodep) VL_OVERRIDE {
startStatement(nodep);
{
bool noopt = PremitAssignVisitor(nodep).noOpt();
@ -242,7 +245,7 @@ private:
m_assignLhs = false;
m_stmtp = NULL;
}
virtual void visit(AstNodeStmt* nodep) {
virtual void visit(AstNodeStmt* nodep) VL_OVERRIDE {
if (!nodep->isStatement()) {
iterateChildren(nodep);
return;
@ -252,7 +255,7 @@ private:
iterateChildren(nodep);
m_stmtp = NULL;
}
virtual void visit(AstTraceInc* nodep) {
virtual void visit(AstTraceInc* nodep) VL_OVERRIDE {
startStatement(nodep);
m_inTracep = nodep;
iterateChildren(nodep);
@ -306,29 +309,29 @@ private:
}
iterateChildren(nodep); checkNode(nodep);
}
virtual void visit(AstShiftL* nodep) {
virtual void visit(AstShiftL* nodep) VL_OVERRIDE {
visitShift(nodep);
}
virtual void visit(AstShiftR* nodep) {
virtual void visit(AstShiftR* nodep) VL_OVERRIDE {
visitShift(nodep);
}
virtual void visit(AstShiftRS* nodep) {
virtual void visit(AstShiftRS* nodep) VL_OVERRIDE {
visitShift(nodep);
}
// Operators
virtual void visit(AstNodeTermop* nodep) {
virtual void visit(AstNodeTermop* nodep) VL_OVERRIDE {
iterateChildren(nodep); checkNode(nodep);
}
virtual void visit(AstNodeUniop* nodep) {
virtual void visit(AstNodeUniop* nodep) VL_OVERRIDE {
iterateChildren(nodep); checkNode(nodep);
}
virtual void visit(AstNodeBiop* nodep) {
virtual void visit(AstNodeBiop* nodep) VL_OVERRIDE {
iterateChildren(nodep); checkNode(nodep);
}
virtual void visit(AstUCFunc* nodep) {
virtual void visit(AstUCFunc* nodep) VL_OVERRIDE {
iterateChildren(nodep); checkNode(nodep);
}
virtual void visit(AstSel* nodep) {
virtual void visit(AstSel* nodep) VL_OVERRIDE {
iterateAndNextNull(nodep->fromp());
{ // Only the 'from' is part of the assignment LHS
bool prevAssign = m_assignLhs;
@ -339,7 +342,7 @@ private:
}
checkNode(nodep);
}
virtual void visit(AstArraySel* nodep) {
virtual void visit(AstArraySel* nodep) VL_OVERRIDE {
iterateAndNextNull(nodep->fromp());
{ // Only the 'from' is part of the assignment LHS
bool prevAssign = m_assignLhs;
@ -349,7 +352,7 @@ private:
}
checkNode(nodep);
}
virtual void visit(AstAssocSel* nodep) {
virtual void visit(AstAssocSel* nodep) VL_OVERRIDE {
iterateAndNextNull(nodep->fromp());
{ // Only the 'from' is part of the assignment LHS
bool prevAssign = m_assignLhs;
@ -359,10 +362,10 @@ private:
}
checkNode(nodep);
}
virtual void visit(AstConst* nodep) {
virtual void visit(AstConst* nodep) VL_OVERRIDE {
iterateChildren(nodep); checkNode(nodep);
}
virtual void visit(AstNodeCond* nodep) {
virtual void visit(AstNodeCond* nodep) VL_OVERRIDE {
iterateChildren(nodep);
if (nodep->expr1p()->isWide()
&& !VN_IS(nodep->condp(), Const)
@ -375,7 +378,7 @@ private:
}
// Autoflush
virtual void visit(AstDisplay* nodep) {
virtual void visit(AstDisplay* nodep) VL_OVERRIDE {
startStatement(nodep);
iterateChildren(nodep);
m_stmtp = NULL;
@ -393,7 +396,7 @@ private:
}
}
}
virtual void visit(AstSFormatF* nodep) {
virtual void visit(AstSFormatF* nodep) VL_OVERRIDE {
iterateChildren(nodep);
// Any strings sent to a display must be var of string data type,
// to avoid passing a pointer to a temporary.
@ -408,8 +411,8 @@ private:
//--------------------
// Default: Just iterate
virtual void visit(AstVar* nodep) {} // Don't hit varrefs under vars
virtual void visit(AstNode* nodep) {
virtual void visit(AstVar* nodep) VL_OVERRIDE {} // Don't hit varrefs under vars
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}

View File

@ -68,7 +68,7 @@ class ProtectVisitor : public AstNVisitor {
bool m_foundTop; // Have seen the top module
// VISITORS
virtual void visit(AstNetlist* nodep) {
virtual void visit(AstNetlist* nodep) VL_OVERRIDE {
m_vfilep = new AstVFile(nodep->fileline(),
v3Global.opt.makeDir()+"/"+m_libName+".sv");
nodep->addFilesp(m_vfilep);
@ -78,7 +78,7 @@ class ProtectVisitor : public AstNVisitor {
iterateChildren(nodep);
}
virtual void visit(AstNodeModule* nodep) {
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
if (!nodep->isTop()) {
return;
} else {
@ -347,7 +347,7 @@ class ProtectVisitor : public AstNVisitor {
m_cfilep->tblockp(txtp);
}
virtual void visit(AstVar* nodep) {
virtual void visit(AstVar* nodep) VL_OVERRIDE {
if (!nodep->isIO()) return;
if (VN_IS(nodep->dtypep(), UnpackArrayDType)) {
nodep->v3error("Unsupported: unpacked arrays with protect-lib on "<<nodep->prettyNameQ());
@ -366,7 +366,7 @@ class ProtectVisitor : public AstNVisitor {
}
}
virtual void visit(AstNode* nodep) { }
virtual void visit(AstNode* nodep) VL_OVERRIDE { }
string cInputConnection(AstVar* varp) {
string frstmt;

View File

@ -148,12 +148,12 @@ private:
}
// VISITORS
virtual void visit(AstCFunc* nodep) {
virtual void visit(AstCFunc* nodep) VL_OVERRIDE {
m_cfuncp = nodep;
iterateChildren(nodep);
m_cfuncp = NULL;
}
virtual void visit(AstNodeAssign* nodep) {
virtual void visit(AstNodeAssign* nodep) VL_OVERRIDE {
if (!m_cfuncp) return;
// Left select WordSel or ArraySel
@ -227,9 +227,9 @@ private:
}
//--------------------
// Default: Just iterate
virtual void visit(AstVar* nodep) {} // Speedup
virtual void visit(AstNodeMath* nodep) {} // Speedup
virtual void visit(AstNode* nodep) {
virtual void visit(AstVar* nodep) VL_OVERRIDE {} // Speedup
virtual void visit(AstNodeMath* nodep) VL_OVERRIDE {} // Speedup
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}

View File

@ -88,7 +88,7 @@ private:
}
// VISITORS
virtual void visit(AstNetlist* nodep) {
virtual void visit(AstNetlist* nodep) VL_OVERRIDE {
AstNodeModule* modp = nodep->topModulep();
if (!modp) { nodep->v3error("No top level module found"); return; }
// Operate starting at the top of the hierarchy
@ -97,7 +97,7 @@ private:
iterate(modp);
cleanupVarRefs();
}
virtual void visit(AstNodeModule* nodep) {
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
// Create required blocks and add to module
string scopename;
if (!m_aboveScopep) scopename = "TOP";
@ -151,13 +151,13 @@ private:
// ***Note m_scopep is passed back to the caller of the routine (above)
}
virtual void visit(AstCellInline* nodep) {
virtual void visit(AstCellInline* nodep) VL_OVERRIDE {
nodep->scopep(m_scopep);
}
virtual void visit(AstActive* nodep) {
virtual void visit(AstActive* nodep) VL_OVERRIDE {
nodep->v3fatalSrc("Actives now made after scoping");
}
virtual void visit(AstInitial* nodep) {
virtual void visit(AstInitial* nodep) VL_OVERRIDE {
// Add to list of blocks under this scope
UINFO(4," Move "<<nodep<<endl);
AstInitial* clonep = nodep->cloneTree(false);
@ -165,7 +165,7 @@ private:
m_scopep->addActivep(clonep);
iterateChildren(clonep); // We iterate under the *clone*
}
virtual void visit(AstFinal* nodep) {
virtual void visit(AstFinal* nodep) VL_OVERRIDE {
// Add to list of blocks under this scope
UINFO(4," Move "<<nodep<<endl);
AstFinal* clonep = nodep->cloneTree(false);
@ -173,7 +173,7 @@ private:
m_scopep->addActivep(clonep);
iterateChildren(clonep); // We iterate under the *clone*
}
virtual void visit(AstAssignAlias* nodep) {
virtual void visit(AstAssignAlias* nodep) VL_OVERRIDE {
// Add to list of blocks under this scope
UINFO(4," Move "<<nodep<<endl);
AstNode* clonep = nodep->cloneTree(false);
@ -181,7 +181,7 @@ private:
m_scopep->addActivep(clonep);
iterateChildren(clonep); // We iterate under the *clone*
}
virtual void visit(AstAssignVarScope* nodep) {
virtual void visit(AstAssignVarScope* nodep) VL_OVERRIDE {
// Copy under the scope but don't recurse
UINFO(4," Move "<<nodep<<endl);
AstNode* clonep = nodep->cloneTree(false);
@ -189,7 +189,7 @@ private:
m_scopep->addActivep(clonep);
iterateChildren(clonep); // We iterate under the *clone*
}
virtual void visit(AstAssignW* nodep) {
virtual void visit(AstAssignW* nodep) VL_OVERRIDE {
// Add to list of blocks under this scope
UINFO(4," Move "<<nodep<<endl);
AstNode* clonep = nodep->cloneTree(false);
@ -197,7 +197,7 @@ private:
m_scopep->addActivep(clonep);
iterateChildren(clonep); // We iterate under the *clone*
}
virtual void visit(AstAlways* nodep) {
virtual void visit(AstAlways* nodep) VL_OVERRIDE {
// Add to list of blocks under this scope
UINFO(4," Move "<<nodep<<endl);
AstNode* clonep = nodep->cloneTree(false);
@ -205,7 +205,7 @@ private:
m_scopep->addActivep(clonep);
iterateChildren(clonep); // We iterate under the *clone*
}
virtual void visit(AstAlwaysPublic* nodep) {
virtual void visit(AstAlwaysPublic* nodep) VL_OVERRIDE {
// Add to list of blocks under this scope
UINFO(4," Move "<<nodep<<endl);
AstNode* clonep = nodep->cloneTree(false);
@ -213,7 +213,7 @@ private:
m_scopep->addActivep(clonep);
iterateChildren(clonep); // We iterate under the *clone*
}
virtual void visit(AstCoverToggle* nodep) {
virtual void visit(AstCoverToggle* nodep) VL_OVERRIDE {
// Add to list of blocks under this scope
UINFO(4," Move "<<nodep<<endl);
AstNode* clonep = nodep->cloneTree(false);
@ -221,7 +221,7 @@ private:
m_scopep->addActivep(clonep);
iterateChildren(clonep); // We iterate under the *clone*
}
virtual void visit(AstCFunc* nodep) {
virtual void visit(AstCFunc* nodep) VL_OVERRIDE {
// Add to list of blocks under this scope
UINFO(4," CFUNC "<<nodep<<endl);
AstCFunc* clonep = nodep->cloneTree(false);
@ -231,7 +231,7 @@ private:
// We iterate under the *clone*
iterateChildren(clonep);
}
virtual void visit(AstNodeFTask* nodep) {
virtual void visit(AstNodeFTask* nodep) VL_OVERRIDE {
// Add to list of blocks under this scope
UINFO(4," FTASK "<<nodep<<endl);
AstNodeFTask* clonep = nodep->cloneTree(false);
@ -240,7 +240,7 @@ private:
// We iterate under the *clone*
iterateChildren(clonep);
}
virtual void visit(AstVar* nodep) {
virtual void visit(AstVar* nodep) VL_OVERRIDE {
// Make new scope variable
// This is called cross-module by AstVar, so we cannot trust any m_ variables
if (!nodep->user1p()) {
@ -259,7 +259,7 @@ private:
m_scopep->addVarp(varscp);
}
}
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
// VarRef needs to point to VarScope
// Make sure variable has made user1p.
UASSERT_OBJ(nodep->varp(), nodep, "Unlinked");
@ -272,7 +272,7 @@ private:
m_varRefScopes.insert(make_pair(nodep, m_scopep));
}
}
virtual void visit(AstScopeName* nodep) {
virtual void visit(AstScopeName* nodep) VL_OVERRIDE {
// If there's a %m in the display text, we add a special node that will contain the name()
string prefix = string("__DOT__")+m_scopep->name();
// TOP and above will be the user's name().
@ -288,13 +288,13 @@ private:
if (afterp) nodep->scopeEntrp(afterp);
iterateChildren(nodep);
}
virtual void visit(AstScope* nodep) {
virtual void visit(AstScope* nodep) VL_OVERRIDE {
// Scope that was made by this module for different cell;
// Want to ignore blocks under it, so just do nothing
}
//--------------------
// Default
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:
@ -322,7 +322,7 @@ private:
VL_DEBUG_FUNC; // Declare debug()
// VISITORS
virtual void visit(AstScope* nodep) {
virtual void visit(AstScope* nodep) VL_OVERRIDE {
// Want to ignore blocks under it
m_scopep = nodep;
iterateChildren(nodep);
@ -341,42 +341,42 @@ private:
}
}
virtual void visit(AstInitial* nodep) {
virtual void visit(AstInitial* nodep) VL_OVERRIDE {
movedDeleteOrIterate(nodep);
}
virtual void visit(AstFinal* nodep) {
virtual void visit(AstFinal* nodep) VL_OVERRIDE {
movedDeleteOrIterate(nodep);
}
virtual void visit(AstAssignAlias* nodep) {
virtual void visit(AstAssignAlias* nodep) VL_OVERRIDE {
movedDeleteOrIterate(nodep);
}
virtual void visit(AstAssignVarScope* nodep) {
virtual void visit(AstAssignVarScope* nodep) VL_OVERRIDE {
movedDeleteOrIterate(nodep);
}
virtual void visit(AstAssignW* nodep) {
virtual void visit(AstAssignW* nodep) VL_OVERRIDE {
movedDeleteOrIterate(nodep);
}
virtual void visit(AstAlways* nodep) {
virtual void visit(AstAlways* nodep) VL_OVERRIDE {
movedDeleteOrIterate(nodep);
}
virtual void visit(AstAlwaysPublic* nodep) {
virtual void visit(AstAlwaysPublic* nodep) VL_OVERRIDE {
movedDeleteOrIterate(nodep);
}
virtual void visit(AstCoverToggle* nodep) {
virtual void visit(AstCoverToggle* nodep) VL_OVERRIDE {
movedDeleteOrIterate(nodep);
}
virtual void visit(AstNodeFTask* nodep) {
virtual void visit(AstNodeFTask* nodep) VL_OVERRIDE {
movedDeleteOrIterate(nodep);
}
virtual void visit(AstCFunc* nodep) {
virtual void visit(AstCFunc* nodep) VL_OVERRIDE {
movedDeleteOrIterate(nodep);
}
virtual void visit(AstVarXRef* nodep) {
virtual void visit(AstVarXRef* nodep) VL_OVERRIDE {
// The crossrefs are dealt with in V3LinkDot
nodep->varp(NULL);
}
virtual void visit(AstNodeFTaskRef* nodep) {
virtual void visit(AstNodeFTaskRef* nodep) VL_OVERRIDE {
// The crossrefs are dealt with in V3LinkDot
UINFO(9," Old pkg-taskref "<<nodep<<endl);
if (nodep->packagep()) {
@ -392,7 +392,7 @@ private:
}
iterateChildren(nodep);
}
virtual void visit(AstModportFTaskRef* nodep) {
virtual void visit(AstModportFTaskRef* nodep) VL_OVERRIDE {
// The crossrefs are dealt with in V3LinkDot
nodep->ftaskp(NULL);
iterateChildren(nodep);
@ -400,7 +400,7 @@ private:
//--------------------
// Default
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:

View File

@ -105,29 +105,29 @@ private:
// VISITORS
VL_DEBUG_FUNC; // Declare debug()
virtual void visit(AstNodeModule* nodep) {
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
// Only do the top
if (nodep->isTop()) {
iterateChildren(nodep);
}
}
virtual void visit(AstTopScope* nodep) {
virtual void visit(AstTopScope* nodep) VL_OVERRIDE {
m_topscopep = nodep;
iterateChildren(nodep);
// Don't clear topscopep, the namer persists beyond this visit
}
virtual void visit(AstScope* nodep) {
virtual void visit(AstScope* nodep) VL_OVERRIDE {
// But no SenTrees under TopScope's scope
}
// Memorize existing block names
virtual void visit(AstActive* nodep) {
virtual void visit(AstActive* nodep) VL_OVERRIDE {
// Don't grab SenTrees under Actives, only those that are global (under Scope directly)
iterateChildren(nodep);
}
virtual void visit(AstSenTree* nodep) { m_trees.add(nodep); }
virtual void visit(AstSenTree* nodep) VL_OVERRIDE { m_trees.add(nodep); }
// Empty visitors, speed things up
virtual void visit(AstNodeStmt* nodep) { }
virtual void visit(AstNode* nodep) {
virtual void visit(AstNodeStmt* nodep) VL_OVERRIDE { }
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
// METHODS

View File

@ -378,15 +378,15 @@ private:
}
// VISITORS
virtual void visit(AstAlways* nodep) {
virtual void visit(AstAlways* nodep) VL_OVERRIDE {
if (jumpingOver(nodep)) return;
checkNodeInfo(nodep);
iterateChildren(nodep);
}
virtual void visit(AstSenTree* nodep) {
virtual void visit(AstSenTree* nodep) VL_OVERRIDE {
// Sensitivities aren't inputs per se; we'll keep our tree under the same sens.
}
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
if (jumpingOver(nodep)) return;
if (!optimizable()) return; // Accelerate
UASSERT_OBJ(nodep->varp(), nodep, "Unlinked");
@ -451,12 +451,12 @@ private:
}
}
}
virtual void visit(AstVarXRef* nodep) {
virtual void visit(AstVarXRef* nodep) VL_OVERRIDE {
if (jumpingOver(nodep)) return;
if (m_scoped) { badNodeType(nodep); return; }
else { clearOptimizable(nodep, "Language violation: Dotted hierarchical references not allowed in constant functions"); }
}
virtual void visit(AstNodeFTask* nodep) {
virtual void visit(AstNodeFTask* nodep) VL_OVERRIDE {
if (jumpingOver(nodep)) return;
if (!m_params) { badNodeType(nodep); return; }
if (nodep->dpiImport()) {
@ -465,7 +465,7 @@ private:
checkNodeInfo(nodep);
iterateChildren(nodep);
}
virtual void visit(AstNodeIf* nodep) {
virtual void visit(AstNodeIf* nodep) VL_OVERRIDE {
if (jumpingOver(nodep)) return;
UINFO(5, " IF "<<nodep<<endl);
checkNodeInfo(nodep);
@ -482,19 +482,19 @@ private:
}
}
}
virtual void visit(AstConst* nodep) {
virtual void visit(AstConst* nodep) VL_OVERRIDE {
checkNodeInfo(nodep);
if (!m_checkOnly && optimizable()) {
newValue(nodep, nodep);
}
}
virtual void visit(AstInitArray* nodep) {
virtual void visit(AstInitArray* nodep) VL_OVERRIDE {
checkNodeInfo(nodep);
if (!m_checkOnly && optimizable()) {
newValue(nodep, nodep);
}
}
virtual void visit(AstEnumItemRef* nodep) {
virtual void visit(AstEnumItemRef* nodep) VL_OVERRIDE {
checkNodeInfo(nodep);
UASSERT_OBJ(nodep->itemp(), nodep, "Not linked");
if (!m_checkOnly && optimizable()) {
@ -509,7 +509,7 @@ private:
}
}
}
virtual void visit(AstNodeUniop* nodep) {
virtual void visit(AstNodeUniop* nodep) VL_OVERRIDE {
if (!optimizable()) return; // Accelerate
checkNodeInfo(nodep);
iterateChildren(nodep);
@ -518,7 +518,7 @@ private:
fetchConst(nodep->lhsp())->num());
}
}
virtual void visit(AstNodeBiop* nodep) {
virtual void visit(AstNodeBiop* nodep) VL_OVERRIDE {
if (!optimizable()) return; // Accelerate
checkNodeInfo(nodep);
iterateChildren(nodep);
@ -528,7 +528,7 @@ private:
fetchConst(nodep->rhsp())->num());
}
}
virtual void visit(AstNodeTriop* nodep) {
virtual void visit(AstNodeTriop* nodep) VL_OVERRIDE {
if (!optimizable()) return; // Accelerate
checkNodeInfo(nodep);
iterateChildren(nodep);
@ -539,7 +539,7 @@ private:
fetchConst(nodep->thsp())->num());
}
}
virtual void visit(AstLogAnd* nodep) {
virtual void visit(AstLogAnd* nodep) VL_OVERRIDE {
// Need to short circuit
if (!optimizable()) return; // Accelerate
checkNodeInfo(nodep);
@ -557,7 +557,7 @@ private:
}
}
}
virtual void visit(AstLogOr* nodep) {
virtual void visit(AstLogOr* nodep) VL_OVERRIDE {
// Need to short circuit
if (!optimizable()) return; // Accelerate
checkNodeInfo(nodep);
@ -575,7 +575,7 @@ private:
}
}
}
virtual void visit(AstLogIf* nodep) {
virtual void visit(AstLogIf* nodep) VL_OVERRIDE {
// Need to short circuit, same as (!A || B)
if (!optimizable()) return; // Accelerate
checkNodeInfo(nodep);
@ -594,7 +594,7 @@ private:
}
}
}
virtual void visit(AstNodeCond* nodep) {
virtual void visit(AstNodeCond* nodep) VL_OVERRIDE {
// We could use above visit(AstNodeTriop), but need to do short circuiting.
// It's also slower even O(n^2) to evaluate both sides when we
// really only need to evaluate one side.
@ -716,7 +716,7 @@ private:
}
}
virtual void visit(AstNodeAssign* nodep) {
virtual void visit(AstNodeAssign* nodep) VL_OVERRIDE {
if (jumpingOver(nodep)) return;
if (!optimizable()) return; // Accelerate
if (VN_IS(nodep, AssignDly)) {
@ -751,7 +751,7 @@ private:
}
m_inDlyAssign = false;
}
virtual void visit(AstArraySel* nodep) {
virtual void visit(AstArraySel* nodep) VL_OVERRIDE {
checkNodeInfo(nodep);
iterateChildren(nodep);
if (AstInitArray* initp = VN_CAST(fetchValueNull(nodep->fromp()), InitArray)) {
@ -768,11 +768,11 @@ private:
clearOptimizable(nodep, "Array select of non-array");
}
}
virtual void visit(AstBegin* nodep) {
virtual void visit(AstBegin* nodep) VL_OVERRIDE {
checkNodeInfo(nodep);
iterateChildren(nodep);
}
virtual void visit(AstNodeCase* nodep) {
virtual void visit(AstNodeCase* nodep) VL_OVERRIDE {
if (jumpingOver(nodep)) return;
UINFO(5, " CASE "<<nodep<<endl);
checkNodeInfo(nodep);
@ -810,16 +810,16 @@ private:
}
}
virtual void visit(AstCaseItem* nodep) {
virtual void visit(AstCaseItem* nodep) VL_OVERRIDE {
// Real handling is in AstNodeCase
if (jumpingOver(nodep)) return;
checkNodeInfo(nodep);
iterateChildren(nodep);
}
virtual void visit(AstComment*) {}
virtual void visit(AstComment*) VL_OVERRIDE {}
virtual void visit(AstJumpGo* nodep) {
virtual void visit(AstJumpGo* nodep) VL_OVERRIDE {
if (jumpingOver(nodep)) return;
checkNodeInfo(nodep);
if (!m_checkOnly) {
@ -827,7 +827,7 @@ private:
m_jumpp = nodep;
}
}
virtual void visit(AstJumpLabel* nodep) {
virtual void visit(AstJumpLabel* nodep) VL_OVERRIDE {
if (jumpingOver(nodep)) return;
checkNodeInfo(nodep);
iterateChildren(nodep);
@ -836,7 +836,7 @@ private:
m_jumpp = NULL;
}
}
virtual void visit(AstStop* nodep) {
virtual void visit(AstStop* nodep) VL_OVERRIDE {
if (jumpingOver(nodep)) return;
if (m_params) { // This message seems better than an obscure $stop
// The spec says $stop is just ignored, it seems evil to ignore assertions
@ -845,7 +845,7 @@ private:
checkNodeInfo(nodep);
}
virtual void visit(AstNodeFor* nodep) {
virtual void visit(AstNodeFor* nodep) VL_OVERRIDE {
// Doing lots of Whiles is slow, so only for parameters
UINFO(5, " FOR "<<nodep<<endl);
if (!m_params) { badNodeType(nodep); return; }
@ -874,7 +874,7 @@ private:
}
}
virtual void visit(AstWhile* nodep) {
virtual void visit(AstWhile* nodep) VL_OVERRIDE {
// Doing lots of Whiles is slow, so only for parameters
if (jumpingOver(nodep)) return;
UINFO(5, " WHILE "<<nodep<<endl);
@ -909,7 +909,7 @@ private:
}
}
virtual void visit(AstFuncRef* nodep) {
virtual void visit(AstFuncRef* nodep) VL_OVERRIDE {
if (jumpingOver(nodep)) return;
if (!optimizable()) return; // Accelerate
UINFO(5, " FUNCREF "<<nodep<<endl);
@ -956,17 +956,17 @@ private:
}
}
virtual void visit(AstVar* nodep) {
virtual void visit(AstVar* nodep) VL_OVERRIDE {
if (jumpingOver(nodep)) return;
if (!m_params) { badNodeType(nodep); return; }
}
virtual void visit(AstScopeName* nodep) {
virtual void visit(AstScopeName* nodep) VL_OVERRIDE {
if (jumpingOver(nodep)) return;
// Ignore
}
virtual void visit(AstSFormatF* nodep) {
virtual void visit(AstSFormatF* nodep) VL_OVERRIDE {
if (jumpingOver(nodep)) return;
if (!optimizable()) return; // Accelerate
iterateChildren(nodep);
@ -1017,7 +1017,7 @@ private:
}
}
virtual void visit(AstDisplay* nodep) {
virtual void visit(AstDisplay* nodep) VL_OVERRIDE {
if (jumpingOver(nodep)) return;
if (!optimizable()) return; // Accelerate
iterateChildren(nodep);
@ -1039,7 +1039,7 @@ private:
// These types are definitely not reducible
// AstCoverInc, AstFinish,
// AstRand, AstTime, AstUCFunc, AstCCall, AstCStmt, AstUCStmt
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
if (jumpingOver(nodep)) return;
badNodeType(nodep);
}

View File

@ -124,7 +124,7 @@ class SliceVisitor : public AstNVisitor {
return newp;
}
virtual void visit(AstNodeAssign* nodep) {
virtual void visit(AstNodeAssign* nodep) VL_OVERRIDE {
// Called recursively on newly created assignments
if (!nodep->user1()
&& !VN_IS(nodep, AssignAlias)) {
@ -157,7 +157,7 @@ class SliceVisitor : public AstNVisitor {
}
}
virtual void visit(AstInitArray* nodep) {
virtual void visit(AstInitArray* nodep) VL_OVERRIDE {
UASSERT_OBJ(!m_assignp, nodep,
"Array initialization should have been removed earlier");
}
@ -171,11 +171,11 @@ class SliceVisitor : public AstNVisitor {
if (AstUnpackArrayDType* adtypep = VN_CAST(fromDtp, UnpackArrayDType)) {
AstNodeBiop* logp = NULL;
if (!VN_IS(nodep->lhsp()->dtypep()->skipRefp(), NodeArrayDType)) {
nodep->lhsp()->v3error("Slice operatator "<<nodep->lhsp()->prettyTypeName()
nodep->lhsp()->v3error("Slice operator "<<nodep->lhsp()->prettyTypeName()
<<" on non-slicable (e.g. non-vector) left-hand-side operand");
}
else if (!VN_IS(nodep->rhsp()->dtypep()->skipRefp(), NodeArrayDType)) {
nodep->rhsp()->v3error("Slice operatator "<<nodep->rhsp()->prettyTypeName()
nodep->rhsp()->v3error("Slice operator "<<nodep->rhsp()->prettyTypeName()
<<" on non-slicable (e.g. non-vector) right-hand-side operand");
}
else {
@ -216,20 +216,20 @@ class SliceVisitor : public AstNVisitor {
iterateChildren(nodep);
}
}
virtual void visit(AstEq* nodep) {
virtual void visit(AstEq* nodep) VL_OVERRIDE {
expandBiOp(nodep);
}
virtual void visit(AstNeq* nodep) {
virtual void visit(AstNeq* nodep) VL_OVERRIDE {
expandBiOp(nodep);
}
virtual void visit(AstEqCase* nodep) {
virtual void visit(AstEqCase* nodep) VL_OVERRIDE {
expandBiOp(nodep);
}
virtual void visit(AstNeqCase* nodep) {
virtual void visit(AstNeqCase* nodep) VL_OVERRIDE {
expandBiOp(nodep);
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
// Default: Just iterate
iterateChildren(nodep);
}

View File

@ -346,19 +346,19 @@ protected:
virtual void makeRvalueEdges(SplitVarStdVertex* vstdp) = 0;
// VISITORS
virtual void visit(AstAlways* nodep) = 0;
virtual void visit(AstNodeIf* nodep) = 0;
virtual void visit(AstAlways* nodep) VL_OVERRIDE = 0;
virtual void visit(AstNodeIf* nodep) VL_OVERRIDE = 0;
// We don't do AstNodeFor/AstWhile loops, due to the standard question
// of what is before vs. after
virtual void visit(AstAssignDly* nodep) {
virtual void visit(AstAssignDly* nodep) VL_OVERRIDE {
m_inDly = true;
UINFO(4," ASSIGNDLY "<<nodep<<endl);
iterateChildren(nodep);
m_inDly = false;
}
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
if (!m_stmtStackps.empty()) {
AstVarScope* vscp = nodep->varScopep();
UASSERT_OBJ(vscp, nodep, "Not linked");
@ -422,7 +422,7 @@ protected:
}
}
virtual void visit(AstJumpGo* nodep) {
virtual void visit(AstJumpGo* nodep) VL_OVERRIDE {
// Jumps will disable reordering at all levels
// This is overly pessimistic; we could treat jumps as barriers, and
// reorder everything between jumps/labels, however jumps are rare
@ -434,7 +434,7 @@ protected:
//--------------------
// Default
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
// **** SPECIAL default type that sets PLI_ORDERING
if (!m_stmtStackps.empty() && !nodep->isPure()) {
UINFO(9," NotSplittable "<<nodep<<endl);
@ -457,7 +457,7 @@ public:
// METHODS
protected:
void makeRvalueEdges(SplitVarStdVertex* vstdp) {
virtual void makeRvalueEdges(SplitVarStdVertex* vstdp) VL_OVERRIDE {
for (VStack::iterator it = m_stmtStackps.begin(); it != m_stmtStackps.end(); ++it) {
new SplitRVEdge(&m_graph, *it, vstdp);
}
@ -606,7 +606,7 @@ protected:
firstp->user3p(oldBlockUser3);
}
virtual void visit(AstAlways* nodep) {
virtual void visit(AstAlways* nodep) VL_OVERRIDE {
UINFO(4," ALW "<<nodep<<endl);
if (debug()>=9) nodep->dumpTree(cout, " alwIn:: ");
scoreboardClear();
@ -614,7 +614,7 @@ protected:
if (debug()>=9) nodep->dumpTree(cout, " alwOut: ");
}
virtual void visit(AstNodeIf* nodep) {
virtual void visit(AstNodeIf* nodep) VL_OVERRIDE {
UINFO(4," IF "<<nodep<<endl);
iterateAndNextNull(nodep->condp());
processBlock(nodep->ifsp());
@ -672,13 +672,13 @@ private:
}
protected:
virtual void visit(AstNodeIf* nodep) {
virtual void visit(AstNodeIf* nodep) VL_OVERRIDE {
m_ifStack.push_back(nodep);
trackNode(nodep);
iterateChildren(nodep);
m_ifStack.pop_back();
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
trackNode(nodep);
iterateChildren(nodep);
}
@ -746,7 +746,7 @@ protected:
return new AstSplitPlaceholder(m_origAlwaysp->fileline());
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
// Anything that's not an if/else we assume is a leaf
// (that is, something we won't split.) Don't visit further
// into the leaf.
@ -768,7 +768,7 @@ protected:
m_addAfter[color] = clonedp;
}
virtual void visit(AstNodeIf* nodep) {
virtual void visit(AstNodeIf* nodep) VL_OVERRIDE {
const ColorSet& colors = m_ifColorp->colors(nodep);
typedef vl_unordered_map<uint32_t, AstNodeIf*> CloneMap;
CloneMap clones;
@ -829,10 +829,10 @@ public:
}
}
virtual ~RemovePlaceholdersVisitor() {}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
virtual void visit(AstSplitPlaceholder* nodep) {
virtual void visit(AstSplitPlaceholder* nodep) VL_OVERRIDE {
m_removeSet.insert(nodep);
}
private:
@ -876,7 +876,7 @@ public:
// METHODS
protected:
void makeRvalueEdges(SplitVarStdVertex* vstdp) {
virtual void makeRvalueEdges(SplitVarStdVertex* vstdp) VL_OVERRIDE {
// Each 'if' depends on rvalues in its own conditional ONLY,
// not rvalues in the if/else bodies.
for (VStack::const_iterator it = m_stmtStackps.begin(); it != m_stmtStackps.end(); ++it) {
@ -955,7 +955,7 @@ protected:
if (debug()>=9) m_graph.dumpDotFilePrefixed("splitg_colored", false);
}
virtual void visit(AstAlways* nodep) {
virtual void visit(AstAlways* nodep) VL_OVERRIDE {
// build the scoreboard
scoreboardClear();
scanBlock(nodep->bodysp());
@ -988,7 +988,7 @@ protected:
emitSplit.go();
}
}
virtual void visit(AstNodeIf* nodep) {
virtual void visit(AstNodeIf* nodep) VL_OVERRIDE {
UINFO(4," IF "<<nodep<<endl);
m_curIfConditional = nodep;
iterateAndNextNull(nodep->condp());

View File

@ -55,13 +55,13 @@ private:
AstVarScope* m_splitVscp; // Variable we want to split
// METHODS
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
if (nodep->lvalue() && !m_splitVscp
&& nodep->varp()->attrIsolateAssign()) {
m_splitVscp = nodep->varScopep();
}
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:
@ -87,7 +87,7 @@ private:
bool m_matches; // Statement below has matching lvalue reference
// METHODS
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
if (nodep->lvalue()) {
if (nodep->varScopep()==m_splitVscp) {
UINFO(6," CL VAR "<<nodep<<endl);
@ -95,7 +95,7 @@ private:
}
}
}
virtual void visit(AstNodeStmt* nodep) {
virtual void visit(AstNodeStmt* nodep) VL_OVERRIDE {
if (!nodep->isStatement()) {
iterateChildren(nodep);
return;
@ -121,7 +121,7 @@ private:
m_keepStmt = oldKeep || m_keepStmt;
UINFO(9," upKeep="<<m_keepStmt<<" STMT "<<nodep<<endl);
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:
@ -168,7 +168,7 @@ private:
}
}
virtual void visit(AstAlways* nodep) {
virtual void visit(AstAlways* nodep) VL_OVERRIDE {
// Are there any lvalue references below this?
// There could be more than one. So, we process the first one found first.
AstVarScope* lastSplitVscp = NULL;
@ -194,9 +194,9 @@ private:
}
// Speedup; no always under math
virtual void visit(AstNodeMath* nodep) {}
virtual void visit(AstNodeMath* nodep) VL_OVERRIDE {}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}

View File

@ -82,7 +82,7 @@ private:
}
// VISITORS
virtual void visit(AstNodeModule* nodep) {
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
allNodes(nodep);
if (!m_fast) {
// Count all CFuncs below this module
@ -91,7 +91,7 @@ private:
// Else we recursively trace fast CFuncs from the top _eval
// func, see visit(AstNetlist*)
}
virtual void visit(AstVar* nodep) {
virtual void visit(AstVar* nodep) VL_OVERRIDE {
allNodes(nodep);
iterateChildrenConst(nodep);
if (m_counting && nodep->dtypep()) {
@ -114,7 +114,7 @@ private:
}
}
}
virtual void visit(AstVarScope* nodep) {
virtual void visit(AstVarScope* nodep) VL_OVERRIDE {
allNodes(nodep);
iterateChildrenConst(nodep);
if (m_counting) {
@ -123,7 +123,7 @@ private:
}
}
}
virtual void visit(AstNodeIf* nodep) {
virtual void visit(AstNodeIf* nodep) VL_OVERRIDE {
UINFO(4," IF i="<<m_instrs<<" "<<nodep<<endl);
allNodes(nodep);
// Condition is part of cost allocated to PREVIOUS block
@ -175,9 +175,9 @@ private:
}
}
// While's we assume evaluate once.
//virtual void visit(AstWhile* nodep) {
//virtual void visit(AstWhile* nodep) VL_OVERRIDE {
virtual void visit(AstCCall* nodep) {
virtual void visit(AstCCall* nodep) VL_OVERRIDE {
allNodes(nodep);
iterateChildrenConst(nodep);
if (m_fast && !nodep->funcp()->entryPoint()) {
@ -186,7 +186,7 @@ private:
iterate(nodep->funcp());
}
}
virtual void visit(AstCFunc* nodep) {
virtual void visit(AstCFunc* nodep) VL_OVERRIDE {
if (m_fast) {
if (!m_tracingCall && !nodep->entryPoint()) return;
m_tracingCall = false;
@ -196,11 +196,11 @@ private:
iterateChildrenConst(nodep);
m_cfuncp = NULL;
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
allNodes(nodep);
iterateChildrenConst(nodep);
}
virtual void visit(AstNetlist* nodep) {
virtual void visit(AstNetlist* nodep) VL_OVERRIDE {
if (m_fast && nodep->evalp()) {
m_instrs = 0;
m_counting = true;

View File

@ -193,7 +193,7 @@ private:
return reinterpret_cast<SubstVarEntry*>(nodep->varp()->user1p()); // Might be NULL
}
// VISITORS
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
SubstVarEntry* entryp = findEntryp(nodep);
if (entryp) {
// Don't sweat it. We assign a new temp variable for every new assignment,
@ -206,8 +206,8 @@ private:
}
}
}
virtual void visit(AstConst* nodep) {} // Accelerate
virtual void visit(AstNode* nodep) {
virtual void visit(AstConst* nodep) VL_OVERRIDE {} // Accelerate
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:
@ -261,7 +261,7 @@ private:
}
// VISITORS
virtual void visit(AstNodeAssign* nodep) {
virtual void visit(AstNodeAssign* nodep) VL_OVERRIDE {
m_ops = 0;
m_assignStep++;
iterateAndNextNull(nodep->rhsp());
@ -311,7 +311,7 @@ private:
VL_DO_DANGLING(pushDeletep(nodep), nodep);
++m_statSubsts;
}
virtual void visit(AstWordSel* nodep) {
virtual void visit(AstWordSel* nodep) VL_OVERRIDE {
iterate(nodep->rhsp());
AstVarRef* varrefp = VN_CAST(nodep->lhsp(), VarRef);
AstConst* constp = VN_CAST(nodep->rhsp(), Const);
@ -338,7 +338,7 @@ private:
iterate(nodep->lhsp());
}
}
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
// Any variable
if (nodep->lvalue()) {
m_assignStep++;
@ -366,9 +366,9 @@ private:
}
}
}
virtual void visit(AstVar* nodep) {}
virtual void visit(AstConst* nodep) {}
virtual void visit(AstNode* nodep) {
virtual void visit(AstVar* nodep) VL_OVERRIDE {}
virtual void visit(AstConst* nodep) VL_OVERRIDE {}
virtual void visit(AstNode* nodep) VL_OVERRIDE {
m_ops++;
if (!nodep->isSubstOptimizable()) {
m_ops = SUBST_MAX_OPS_NA;

View File

@ -80,7 +80,8 @@ private:
// State cleared on each module
AstNodeModule* m_modp; // Current MODULE
int m_modTables; // Number of tables created in this module
std::deque<AstVarScope*> m_modTableVscs; // All tables created
typedef std::deque<AstVarScope*> ModTableVector;
ModTableVector m_modTableVscs; // All tables created
// State cleared on each scope
AstScope* m_scopep; // Current SCOPE
@ -423,37 +424,44 @@ private:
// VISITORS
virtual void visit(AstNetlist* nodep) {
virtual void visit(AstNetlist* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
virtual void visit(AstNodeModule* nodep) {
m_modTables = 0;
m_modTableVscs.clear();
m_modp = nodep;
iterateChildren(nodep);
m_modp = NULL;
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
AstNodeModule* origModp = m_modp;
int origModTables = m_modTables;
ModTableVector origModTableVscs = m_modTableVscs;
{
m_modp = nodep;
m_modTables = 0;
m_modTableVscs.clear();
iterateChildren(nodep);
}
m_modp = origModp;
m_modTables = origModTables;
m_modTableVscs = origModTableVscs;
}
virtual void visit(AstScope* nodep) {
virtual void visit(AstScope* nodep) VL_OVERRIDE {
UINFO(4," SCOPE "<<nodep<<endl);
m_scopep = nodep;
iterateChildren(nodep);
m_scopep = NULL;
}
virtual void visit(AstAlways* nodep) {
virtual void visit(AstAlways* nodep) VL_OVERRIDE {
UINFO(4," ALWAYS "<<nodep<<endl);
if (treeTest(nodep)) {
// Well, then, I'll be a memory hog.
VL_DO_DANGLING(createTable(nodep), nodep);
}
}
virtual void visit(AstAssignAlias* nodep) {}
virtual void visit(AstAssignW* nodep) {
virtual void visit(AstAssignAlias* nodep) VL_OVERRIDE {}
virtual void visit(AstAssignW* nodep) VL_OVERRIDE {
// It's nearly impossible to have a large enough assign to make this worthwhile
// For now we won't bother.
// Accelerated: no iterate
}
// default
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:

View File

@ -163,7 +163,7 @@ private:
}
// VISITORS
virtual void visit(AstScope* nodep) {
virtual void visit(AstScope* nodep) VL_OVERRIDE {
// Each FTask is unique per-scope, so AstNodeFTaskRefs do not need
// pointers to what scope the FTask is to be invoked under.
// However, to create variables, we need to track the scopes involved.
@ -184,12 +184,12 @@ private:
}
iterateChildren(nodep);
}
virtual void visit(AstAssignW* nodep) {
virtual void visit(AstAssignW* nodep) VL_OVERRIDE {
m_assignwp = nodep;
VL_DO_DANGLING(iterateChildren(nodep), nodep); // May delete nodep.
m_assignwp = NULL;
}
virtual void visit(AstNodeFTaskRef* nodep) {
virtual void visit(AstNodeFTaskRef* nodep) VL_OVERRIDE {
if (m_assignwp) {
// Wire assigns must become always statements to deal with insertion
// of multiple statements. Perhaps someday make all wassigns into always's?
@ -201,7 +201,7 @@ private:
UASSERT_OBJ(nodep->taskp(), nodep, "Unlinked task");
new TaskEdge(&m_callGraph, m_curVxp, getFTaskVertex(nodep->taskp()));
}
virtual void visit(AstNodeFTask* nodep) {
virtual void visit(AstNodeFTask* nodep) VL_OVERRIDE {
UINFO(9," TASK "<<nodep<<endl);
TaskBaseVertex* lastVxp = m_curVxp;
m_curVxp = getFTaskVertex(nodep);
@ -209,7 +209,7 @@ private:
iterateChildren(nodep);
m_curVxp = lastVxp;
}
virtual void visit(AstPragma* nodep) {
virtual void visit(AstPragma* nodep) VL_OVERRIDE {
if (nodep->pragType() == AstPragmaType::NO_INLINE_TASK) {
// Just mark for the next steps, and we're done with it.
m_curVxp->noInline(true);
@ -219,11 +219,11 @@ private:
iterateChildren(nodep);
}
}
virtual void visit(AstVar* nodep) {
virtual void visit(AstVar* nodep) VL_OVERRIDE {
iterateChildren(nodep);
nodep->user4p(m_curVxp); // Remember what task it's under
}
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
iterateChildren(nodep);
if (nodep->varp()->user4u().toGraphVertex() != m_curVxp) {
if (m_curVxp->pure()
@ -234,7 +234,7 @@ private:
}
//--------------------
// Default: Just iterate
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:
@ -264,7 +264,7 @@ private:
// AstVar::user2p // AstVarScope* to replace varref with
// VISITORS
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
// Similar code in V3Inline
if (nodep->varp()->user2p()) { // It's being converted to an alias.
UINFO(9, " relinkVar "<<cvtToHex(nodep->varp()->user2p())<<" "<<nodep<<endl);
@ -278,7 +278,7 @@ private:
}
//--------------------
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:
@ -1127,24 +1127,29 @@ private:
}
// VISITORS
virtual void visit(AstNodeModule* nodep) {
m_modp = nodep;
m_insStmtp = NULL;
m_modNCalls = 0;
iterateChildren(nodep);
m_modp = NULL;
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
AstNodeModule* origModp = m_modp;
int origNCalls = m_modNCalls;
{
m_modp = nodep;
m_insStmtp = NULL;
m_modNCalls = 0;
iterateChildren(nodep);
}
m_modp = origModp;
m_modNCalls = origNCalls;
}
virtual void visit(AstTopScope* nodep) {
virtual void visit(AstTopScope* nodep) VL_OVERRIDE {
m_topScopep = nodep;
iterateChildren(nodep);
}
virtual void visit(AstScope* nodep) {
virtual void visit(AstScope* nodep) VL_OVERRIDE {
m_scopep = nodep;
m_insStmtp = NULL;
iterateChildren(nodep);
m_scopep = NULL;
}
virtual void visit(AstNodeFTaskRef* nodep) {
virtual void visit(AstNodeFTaskRef* nodep) VL_OVERRIDE {
UASSERT_OBJ(nodep->taskp(), nodep, "Unlinked?");
iterateIntoFTask(nodep->taskp()); // First, do hierarchical funcs
UINFO(4," FTask REF "<<nodep<<endl);
@ -1190,7 +1195,7 @@ private:
// Visit nodes that normal iteration won't find
if (visitp) iterateAndNextNull(visitp);
}
virtual void visit(AstNodeFTask* nodep) {
virtual void visit(AstNodeFTask* nodep) VL_OVERRIDE {
UINFO(4," Inline "<<nodep<<endl);
InsertMode prevInsMode = m_insMode;
AstNode* prevInsStmtp = m_insStmtp;
@ -1251,7 +1256,7 @@ private:
m_insMode = prevInsMode;
m_insStmtp = prevInsStmtp;
}
virtual void visit(AstWhile* nodep) {
virtual void visit(AstWhile* nodep) VL_OVERRIDE {
// Special, as statements need to be put in different places
// Preconditions insert first just before themselves (the normal
// rule for other statement types)
@ -1268,10 +1273,10 @@ private:
// Done the loop
m_insStmtp = NULL; // Next thing should be new statement
}
virtual void visit(AstNodeFor* nodep) {
virtual void visit(AstNodeFor* nodep) VL_OVERRIDE {
nodep->v3fatalSrc("For statements should have been converted to while statements in V3Begin.cpp");
}
virtual void visit(AstNodeStmt* nodep) {
virtual void visit(AstNodeStmt* nodep) VL_OVERRIDE {
if (!nodep->isStatement()) {
iterateChildren(nodep);
return;
@ -1283,7 +1288,7 @@ private:
}
//--------------------
// Default: Just iterate
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}

View File

@ -613,7 +613,7 @@ private:
}
// VISITORS
virtual void visit(AstNetlist* nodep) {
virtual void visit(AstNetlist* nodep) VL_OVERRIDE {
m_code = 1; // Multiple TopScopes will require fixing how code#s
// are assigned as duplicate varscopes must result in the same tracing code#.
@ -641,17 +641,17 @@ private:
assignActivity();
putTracesIntoTree();
}
virtual void visit(AstNodeModule* nodep) {
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
if (nodep->isTop()) m_topModp = nodep;
iterateChildren(nodep);
}
virtual void visit(AstTopScope* nodep) {
virtual void visit(AstTopScope* nodep) VL_OVERRIDE {
AstScope* scopep = nodep->scopep();
UASSERT_OBJ(scopep, nodep, "No scope found on top level");
m_highScopep = scopep;
iterateChildren(nodep);
}
virtual void visit(AstCCall* nodep) {
virtual void visit(AstCCall* nodep) VL_OVERRIDE {
UINFO(8," CCALL "<<nodep<<endl);
if (!m_finding && !nodep->user2()) {
// See if there are other calls in same statement list;
@ -669,7 +669,7 @@ private:
}
iterateChildren(nodep);
}
virtual void visit(AstCFunc* nodep) {
virtual void visit(AstCFunc* nodep) VL_OVERRIDE {
UINFO(8," CFUNC "<<nodep<<endl);
if (nodep->funcType() == AstCFuncType::TRACE_INIT) {
m_initFuncp = nodep;
@ -693,7 +693,7 @@ private:
iterateChildren(nodep);
m_funcp = NULL;
}
virtual void visit(AstTraceInc* nodep) {
virtual void visit(AstTraceInc* nodep) VL_OVERRIDE {
UINFO(8," TRACE "<<nodep<<endl);
UASSERT_OBJ(!m_finding, nodep, "Traces should have been removed in prev step.");
nodep->unlinkFrBack();
@ -706,7 +706,7 @@ private:
iterateChildren(nodep);
m_tracep = NULL;
}
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
if (m_tracep) {
UASSERT_OBJ(nodep->varScopep(), nodep, "No var scope?");
UASSERT_OBJ(!nodep->lvalue(), nodep, "Lvalue in trace? Should be const.");
@ -732,7 +732,7 @@ private:
}
}
//--------------------
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}

View File

@ -143,7 +143,7 @@ private:
}
// VISITORS
virtual void visit(AstTopScope* nodep) {
virtual void visit(AstTopScope* nodep) VL_OVERRIDE {
m_scopetopp = nodep->scopep();
// Make containers for TRACEDECLs first
m_initFuncp = newCFunc(AstCFuncType::TRACE_INIT, "traceInitThis", true);
@ -154,7 +154,7 @@ private:
// And find variables
iterateChildren(nodep);
}
virtual void visit(AstScope* nodep) {
virtual void visit(AstScope* nodep) VL_OVERRIDE {
AstCell* cellp = VN_CAST(nodep->aboveCellp(), Cell);
if (cellp && VN_IS(cellp->modp(), Iface)) {
AstCFunc* origSubFunc = m_initSubFuncp;
@ -192,7 +192,7 @@ private:
iterateChildren(nodep);
}
}
virtual void visit(AstVarScope* nodep) {
virtual void visit(AstVarScope* nodep) VL_OVERRIDE {
iterateChildren(nodep);
// Prefilter - things that get through this if will either get
// traced or get a comment as to why not traced.
@ -224,7 +224,7 @@ private:
else m_traValuep = new AstVarRef(nodep->fileline(), nodep, false);
{
// Recurse into data type of the signal; the visitors will call addTraceDecl()
iterate(varp->dtypeSkipRefp());
iterate(varp->dtypep()->skipRefToEnump());
}
// Cleanup
if (m_traValuep) VL_DO_CLEAR(m_traValuep->deleteTree(), m_traValuep = NULL);
@ -235,33 +235,33 @@ private:
}
}
// VISITORS - Data types when tracing
virtual void visit(AstConstDType* nodep) {
virtual void visit(AstConstDType* nodep) VL_OVERRIDE {
if (m_traVscp) {
iterate(nodep->subDTypep()->skipRefp());
iterate(nodep->subDTypep()->skipRefToEnump());
}
}
virtual void visit(AstRefDType* nodep) {
virtual void visit(AstRefDType* nodep) VL_OVERRIDE {
if (m_traVscp) {
iterate(nodep->subDTypep()->skipRefp());
iterate(nodep->subDTypep()->skipRefToEnump());
}
}
virtual void visit(AstUnpackArrayDType* nodep) {
virtual void visit(AstUnpackArrayDType* nodep) VL_OVERRIDE {
// Note more specific dtypes above
if (m_traVscp) {
if (static_cast<int>(nodep->arrayUnpackedElements()) > v3Global.opt.traceMaxArray()) {
addIgnore("Wide memory > --trace-max-array ents");
} else if (VN_IS(nodep->subDTypep()->skipRefp(), BasicDType) // Nothing lower than this array
&& m_traVscp->dtypep()->skipRefp() == nodep) { // Nothing above this array
} else if (VN_IS(nodep->subDTypep()->skipRefToEnump(), BasicDType) // Nothing lower than this array
&& m_traVscp->dtypep()->skipRefToEnump() == nodep) { // Nothing above this array
// Simple 1-D array, use existing V3EmitC runtime loop rather than unrolling
// This will put "(index)" at end of signal name for us
if (m_traVscp->dtypep()->skipRefp()->isString()) {
if (m_traVscp->dtypep()->skipRefToEnump()->isString()) {
addIgnore("Unsupported: strings");
} else {
addTraceDecl(nodep->declRange(), 0);
}
} else {
// Unroll now, as have no other method to get right signal names
AstNodeDType* subtypep = nodep->subDTypep()->skipRefp();
AstNodeDType* subtypep = nodep->subDTypep()->skipRefToEnump();
for (int i=nodep->lsb(); i<=nodep->msb(); ++i) {
string oldShowname = m_traShowname;
AstNode* oldValuep = m_traValuep;
@ -271,6 +271,7 @@ private:
m_traValuep->cloneTree(true),
i - nodep->lsb());
m_traValuep->dtypep(subtypep);
iterate(subtypep);
VL_DO_CLEAR(m_traValuep->deleteTree(), m_traValuep = NULL);
}
@ -280,7 +281,7 @@ private:
}
}
}
virtual void visit(AstPackArrayDType* nodep) {
virtual void visit(AstPackArrayDType* nodep) VL_OVERRIDE {
if (m_traVscp) {
if (!v3Global.opt.traceStructs()) {
// Everything downstream is packed, so deal with as one trace unit.
@ -288,7 +289,7 @@ private:
// a much faster way to trace
addTraceDecl(VNumRange(), nodep->width());
} else {
AstNodeDType* subtypep = nodep->subDTypep()->skipRefp();
AstNodeDType* subtypep = nodep->subDTypep()->skipRefToEnump();
for (int i=nodep->lsb(); i<=nodep->msb(); ++i) {
string oldShowname = m_traShowname;
AstNode* oldValuep = m_traValuep;
@ -297,6 +298,7 @@ private:
m_traValuep = new AstSel(nodep->fileline(), m_traValuep->cloneTree(true),
(i - nodep->lsb())*subtypep->width(),
subtypep->width());
m_traValuep->dtypep(subtypep);
iterate(subtypep);
VL_DO_CLEAR(m_traValuep->deleteTree(), m_traValuep = NULL);
}
@ -306,7 +308,7 @@ private:
}
}
}
virtual void visit(AstNodeUOrStructDType* nodep) {
virtual void visit(AstNodeUOrStructDType* nodep) VL_OVERRIDE {
if (m_traVscp) {
if (nodep->packed() && !v3Global.opt.traceStructs()) {
// Everything downstream is packed, so deal with as one trace unit
@ -319,7 +321,7 @@ private:
} else {
for (AstMemberDType* itemp = nodep->membersp();
itemp; itemp=VN_CAST(itemp->nextp(), MemberDType)) {
AstNodeDType* subtypep = itemp->subDTypep()->skipRefp();
AstNodeDType* subtypep = itemp->subDTypep()->skipRefToEnump();
string oldShowname = m_traShowname;
AstNode* oldValuep = m_traValuep;
{
@ -328,6 +330,7 @@ private:
m_traValuep = new AstSel(nodep->fileline(),
m_traValuep->cloneTree(true),
itemp->lsb(), subtypep->width());
m_traValuep->dtypep(subtypep);
iterate(subtypep);
VL_DO_CLEAR(m_traValuep->deleteTree(), m_traValuep = NULL);
} else { // Else union, replicate fields
@ -341,7 +344,7 @@ private:
}
}
}
virtual void visit(AstBasicDType* nodep) {
virtual void visit(AstBasicDType* nodep) VL_OVERRIDE {
if (m_traVscp) {
if (nodep->isString()) {
addIgnore("Unsupported: strings");
@ -350,14 +353,17 @@ private:
}
}
}
virtual void visit(AstNodeDType* nodep) {
virtual void visit(AstEnumDType* nodep) VL_OVERRIDE {
iterate(nodep->skipRefp());
}
virtual void visit(AstNodeDType* nodep) VL_OVERRIDE {
// Note more specific dtypes above
if (!m_traVscp) return;
addIgnore("Unsupported: data type");
}
//--------------------
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}

View File

@ -136,6 +136,7 @@ public:
// CONSTRUCTORS
TristateGraph() { clear(); }
virtual ~TristateGraph() { clear(); }
VL_UNCOPYABLE(TristateGraph);
private:
// METHODS
@ -212,6 +213,7 @@ private:
public:
// METHODS
bool empty() const { return m_graph.empty(); }
void clear() {
for (V3GraphVertex* itp = m_graph.verticesBeginp(); itp; itp=itp->verticesNextp()) {
TristateVertex* vvertexp = static_cast<TristateVertex*>(itp);
@ -286,7 +288,7 @@ class TristatePinVisitor : public TristateBaseVisitor {
TristateGraph& m_tgraph;
bool m_lvalue; // Flip to be an LVALUE
// VISITORS
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
if (m_lvalue && !nodep->lvalue()) {
UINFO(9," Flip-to-LValue "<<nodep<<endl);
nodep->lvalue(true);
@ -298,17 +300,17 @@ class TristatePinVisitor : public TristateBaseVisitor {
m_tgraph.setTristate(nodep->varp());
}
}
virtual void visit(AstArraySel* nodep) {
virtual void visit(AstArraySel* nodep) VL_OVERRIDE {
// Doesn't work because we'd set lvalue on the array index's var
UASSERT_OBJ(!m_lvalue, nodep, "ArraySel conversion to output, under tristate node");
iterateChildren(nodep);
}
virtual void visit(AstSliceSel* nodep) {
virtual void visit(AstSliceSel* nodep) VL_OVERRIDE {
// Doesn't work because we'd set lvalue on the array index's var
UASSERT_OBJ(!m_lvalue, nodep, "SliceSel conversion to output, under tristate node");
iterateChildren(nodep);
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:
@ -646,7 +648,7 @@ class TristateVisitor : public TristateBaseVisitor {
}
// VISITORS
virtual void visit(AstConst* nodep) {
virtual void visit(AstConst* nodep) VL_OVERRIDE {
UINFO(9,dbgState()<<nodep<<endl);
if (m_graphing) {
if (!m_alhs && nodep->num().hasZ()) {
@ -682,7 +684,7 @@ class TristateVisitor : public TristateBaseVisitor {
}
}
virtual void visit(AstCond* nodep) {
virtual void visit(AstCond* nodep) VL_OVERRIDE {
if (m_graphing) {
iterateChildren(nodep);
if (m_alhs) {
@ -725,7 +727,7 @@ class TristateVisitor : public TristateBaseVisitor {
}
}
virtual void visit(AstSel* nodep) {
virtual void visit(AstSel* nodep) VL_OVERRIDE {
if (m_graphing) {
iterateChildren(nodep);
if (m_alhs) {
@ -763,7 +765,7 @@ class TristateVisitor : public TristateBaseVisitor {
}
}
virtual void visit(AstConcat* nodep) {
virtual void visit(AstConcat* nodep) VL_OVERRIDE {
if (m_graphing) {
iterateChildren(nodep);
if (m_alhs) {
@ -813,7 +815,7 @@ class TristateVisitor : public TristateBaseVisitor {
}
}
virtual void visit(AstBufIf1* nodep) {
virtual void visit(AstBufIf1* nodep) VL_OVERRIDE {
// For BufIf1, the enable is the LHS expression
iterateChildren(nodep);
UINFO(9,dbgState()<<nodep<<endl);
@ -899,10 +901,10 @@ class TristateVisitor : public TristateBaseVisitor {
expr2p->user1p(NULL);
}
}
virtual void visit(AstAnd* nodep) {
virtual void visit(AstAnd* nodep) VL_OVERRIDE {
visitAndOr(nodep, true);
}
virtual void visit(AstOr* nodep) {
virtual void visit(AstOr* nodep) VL_OVERRIDE {
visitAndOr(nodep, false);
}
@ -939,10 +941,10 @@ class TristateVisitor : public TristateBaseVisitor {
m_alhs = false;
}
}
virtual void visit(AstAssignW* nodep) {
virtual void visit(AstAssignW* nodep) VL_OVERRIDE {
visitAssign(nodep);
}
virtual void visit(AstAssign* nodep) {
virtual void visit(AstAssign* nodep) VL_OVERRIDE {
visitAssign(nodep);
}
@ -993,20 +995,20 @@ class TristateVisitor : public TristateBaseVisitor {
return;
}
}
virtual void visit(AstEqCase* nodep) {
virtual void visit(AstEqCase* nodep) VL_OVERRIDE {
visitCaseEq(nodep, false);
}
virtual void visit(AstNeqCase* nodep) {
virtual void visit(AstNeqCase* nodep) VL_OVERRIDE {
visitCaseEq(nodep, true);
}
virtual void visit(AstEqWild* nodep) {
virtual void visit(AstEqWild* nodep) VL_OVERRIDE {
visitEqNeqWild(nodep);
}
virtual void visit(AstNeqWild* nodep) {
virtual void visit(AstNeqWild* nodep) VL_OVERRIDE {
visitEqNeqWild(nodep);
}
virtual void visit(AstPull* nodep) {
virtual void visit(AstPull* nodep) VL_OVERRIDE {
UINFO(9,dbgState()<<nodep<<endl);
AstVarRef* varrefp = NULL;
if (VN_IS(nodep->lhsp(), VarRef)) {
@ -1083,7 +1085,7 @@ class TristateVisitor : public TristateBaseVisitor {
// __out(to-resolver-only)
// const inout Spec says illegal
// const output Unsupported; Illegal?
virtual void visit(AstPin* nodep) {
virtual void visit(AstPin* nodep) VL_OVERRIDE {
if (m_graphing) {
if (nodep->user2() & U2_GRAPHING) return; // This pin is already expanded
nodep->user2(U2_GRAPHING);
@ -1238,7 +1240,7 @@ class TristateVisitor : public TristateBaseVisitor {
}
}
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
UINFO(9,dbgState()<<nodep<<endl);
if (m_graphing) {
if (nodep->lvalue()) {
@ -1272,7 +1274,7 @@ class TristateVisitor : public TristateBaseVisitor {
}
}
virtual void visit(AstVar* nodep) {
virtual void visit(AstVar* nodep) VL_OVERRIDE {
iterateChildren(nodep);
UINFO(9,dbgState()<<nodep<<endl);
if (m_graphing) {
@ -1305,53 +1307,64 @@ class TristateVisitor : public TristateBaseVisitor {
}
}
virtual void visit(AstNodeModule* nodep) {
UINFO(8, nodep<<endl);
UASSERT_OBJ(!m_graphing, nodep,
"Modules under modules not supported"); // Lots of per-module state breaks
// Clear state
m_tgraph.clear();
m_unique = 0;
m_logicp = NULL;
m_lhsmap.clear();
m_modp = nodep;
// Walk the graph, finding all variables and tristate constructs
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
UINFO(8, nodep << endl);
AstNodeModule* origModp = m_modp;
bool origGraphing = m_graphing;
int origUnique = m_unique;
VarMap origLhsmap = m_lhsmap;
// Not preserved, needs pointer instead: TristateGraph origTgraph = m_tgraph;
UASSERT_OBJ(m_tgraph.empty(), nodep, "Unsupported: NodeModule under NodeModule");
{
m_graphing = true;
iterateChildren(nodep);
// Clear state
m_graphing = false;
m_tgraph.clear();
m_unique = 0;
m_logicp = NULL;
m_lhsmap.clear();
m_modp = nodep;
// Walk the graph, finding all variables and tristate constructs
{
m_graphing = true;
iterateChildren(nodep);
m_graphing = false;
}
// Use graph to find tristate signals
m_tgraph.graphWalk(nodep);
// Build the LHS drivers map for this module
iterateChildren(nodep);
// Insert new logic for all tristates
insertTristates(nodep);
}
// Use graph to find tristate signals
m_tgraph.graphWalk(nodep);
// Build the LHS drivers map for this module
iterateChildren(nodep);
// Insert new logic for all tristates
insertTristates(nodep);
m_modp = NULL;
m_modp = origModp;
m_graphing = origGraphing;
m_unique = origUnique;
m_lhsmap = origLhsmap;
m_tgraph.clear(); // Recursion not supported
}
virtual void visit(AstNodeFTask* nodep) {
virtual void visit(AstNodeFTask* nodep) VL_OVERRIDE {
// don't deal with functions
}
virtual void visit(AstCaseItem* nodep) {
virtual void visit(AstCaseItem* nodep) VL_OVERRIDE {
// don't deal with casez compare '???? values
iterateAndNextNull(nodep->bodysp());
}
virtual void visit(AstCell* nodep) {
virtual void visit(AstCell* nodep) VL_OVERRIDE {
m_cellp = nodep;
m_alhs = false;
iterateChildren(nodep);
m_cellp = NULL;
}
virtual void visit(AstNetlist* nodep) {
virtual void visit(AstNetlist* nodep) VL_OVERRIDE {
iterateChildrenBackwards(nodep);
}
// Default: Just iterate
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
checkUnhandled(nodep);
}

View File

@ -274,7 +274,7 @@ private:
}
// VISITORS
virtual void visit(AstVar* nodep) {
virtual void visit(AstVar* nodep) VL_OVERRIDE {
for (int usr=1; usr<(m_alwaysCombp?3:2); ++usr) {
// For assigns and non-combo always, do just usr==1, to look
// for module-wide undriven etc.
@ -299,15 +299,15 @@ private:
// Discover variables used in bit definitions, etc
iterateChildren(nodep);
}
virtual void visit(AstArraySel* nodep) {
virtual void visit(AstArraySel* nodep) VL_OVERRIDE {
// Arrays are rarely constant assigned, so for now we punt and do all entries
iterateChildren(nodep);
}
virtual void visit(AstSliceSel* nodep) {
virtual void visit(AstSliceSel* nodep) VL_OVERRIDE {
// Arrays are rarely constant assigned, so for now we punt and do all entries
iterateChildren(nodep);
}
virtual void visit(AstSel* nodep) {
virtual void visit(AstSel* nodep) VL_OVERRIDE {
AstNodeVarRef* varrefp = VN_CAST(nodep->fromp(), NodeVarRef);
AstConst* constp = VN_CAST(nodep->lsbp(), Const);
if (varrefp && constp && !constp->num().isFourState()) {
@ -330,7 +330,7 @@ private:
iterateChildren(nodep);
}
}
virtual void visit(AstNodeVarRef* nodep) {
virtual void visit(AstNodeVarRef* nodep) VL_OVERRIDE {
// Any variable
if (nodep->lvalue()
&& !VN_IS(nodep, VarXRef)) { // Ignore interface variables and similar ugly items
@ -363,14 +363,14 @@ private:
}
// Don't know what black boxed calls do, assume in+out
virtual void visit(AstSysIgnore* nodep) {
virtual void visit(AstSysIgnore* nodep) VL_OVERRIDE {
bool prevMark = m_inBBox;
m_inBBox = true;
iterateChildren(nodep);
m_inBBox = prevMark;
}
virtual void visit(AstAssign* nodep) {
virtual void visit(AstAssign* nodep) VL_OVERRIDE {
bool prevProc = m_inProcAssign;
{
m_inProcAssign = true;
@ -378,7 +378,7 @@ private:
}
m_inProcAssign = prevProc;
}
virtual void visit(AstAssignDly* nodep) {
virtual void visit(AstAssignDly* nodep) VL_OVERRIDE {
bool prevProc = m_inProcAssign;
{
m_inProcAssign = true;
@ -386,7 +386,7 @@ private:
}
m_inProcAssign = prevProc;
}
virtual void visit(AstAssignW* nodep) {
virtual void visit(AstAssignW* nodep) VL_OVERRIDE {
bool prevCont = m_inContAssign;
{
m_inContAssign = true;
@ -394,7 +394,7 @@ private:
}
m_inContAssign = prevCont;
}
virtual void visit(AstAlways* nodep) {
virtual void visit(AstAlways* nodep) VL_OVERRIDE {
AstAlways* prevAlwp = m_alwaysCombp;
{
AstNode::user2ClearTree();
@ -407,7 +407,7 @@ private:
m_alwaysCombp = prevAlwp;
}
virtual void visit(AstNodeFTask* nodep) {
virtual void visit(AstNodeFTask* nodep) VL_OVERRIDE {
AstNodeFTask* prevTaskp = m_taskp;
m_taskp = nodep;
iterateChildren(nodep);
@ -415,18 +415,18 @@ private:
}
// Until we support tables, primitives will have undriven and unused I/Os
virtual void visit(AstPrimitive* nodep) {}
virtual void visit(AstPrimitive* nodep) VL_OVERRIDE {}
// Coverage artifacts etc shouldn't count as a sink
virtual void visit(AstCoverDecl* nodep) {}
virtual void visit(AstCoverInc* nodep) {}
virtual void visit(AstCoverToggle* nodep) {}
virtual void visit(AstTraceDecl* nodep) {}
virtual void visit(AstTraceInc* nodep) {}
virtual void visit(AstCoverDecl* nodep) VL_OVERRIDE {}
virtual void visit(AstCoverInc* nodep) VL_OVERRIDE {}
virtual void visit(AstCoverToggle* nodep) VL_OVERRIDE {}
virtual void visit(AstTraceDecl* nodep) VL_OVERRIDE {}
virtual void visit(AstTraceInc* nodep) VL_OVERRIDE {}
// iterate
virtual void visit(AstConst* nodep) {}
virtual void visit(AstNode* nodep) {
virtual void visit(AstConst* nodep) VL_OVERRIDE {}
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
public:

View File

@ -145,30 +145,33 @@ private:
}
// VISITORS
virtual void visit(AstNodeModule* nodep) {
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
UINFO(4," MOD "<<nodep<<endl);
m_modp = nodep;
m_constXCvt = true;
iterateChildren(nodep);
m_modp = NULL;
AstNodeModule* origModp = m_modp;
{
m_modp = nodep;
m_constXCvt = true;
iterateChildren(nodep);
}
m_modp = origModp;
}
virtual void visit(AstAssignDly* nodep) {
virtual void visit(AstAssignDly* nodep) VL_OVERRIDE {
m_assigndlyp = nodep;
VL_DO_DANGLING(iterateChildren(nodep), nodep); // May delete nodep.
m_assigndlyp = NULL;
}
virtual void visit(AstAssignW* nodep) {
virtual void visit(AstAssignW* nodep) VL_OVERRIDE {
m_assignwp = nodep;
VL_DO_DANGLING(iterateChildren(nodep), nodep); // May delete nodep.
m_assignwp = NULL;
}
virtual void visit(AstCaseItem* nodep) {
virtual void visit(AstCaseItem* nodep) VL_OVERRIDE {
m_constXCvt = false; // Avoid losing the X's in casex
iterateAndNextNull(nodep->condsp());
m_constXCvt = true;
iterateAndNextNull(nodep->bodysp());
}
virtual void visit(AstNodeDType* nodep) {
virtual void visit(AstNodeDType* nodep) VL_OVERRIDE {
m_constXCvt = false; // Avoid losing the X's in casex
iterateChildren(nodep);
m_constXCvt = true;
@ -240,19 +243,19 @@ private:
}
}
virtual void visit(AstEqCase* nodep) {
virtual void visit(AstEqCase* nodep) VL_OVERRIDE {
visitEqNeqCase(nodep);
}
virtual void visit(AstNeqCase* nodep) {
virtual void visit(AstNeqCase* nodep) VL_OVERRIDE {
visitEqNeqCase(nodep);
}
virtual void visit(AstEqWild* nodep) {
virtual void visit(AstEqWild* nodep) VL_OVERRIDE {
visitEqNeqWild(nodep);
}
virtual void visit(AstNeqWild* nodep) {
virtual void visit(AstNeqWild* nodep) VL_OVERRIDE {
visitEqNeqWild(nodep);
}
virtual void visit(AstIsUnknown* nodep) {
virtual void visit(AstIsUnknown* nodep) VL_OVERRIDE {
iterateChildren(nodep);
// Ahh, we're two state, so this is easy
UINFO(4," ISUNKNOWN->0 "<<nodep<<endl);
@ -260,7 +263,7 @@ private:
nodep->replaceWith(newp);
VL_DO_DANGLING(nodep->deleteTree(), nodep);
}
virtual void visit(AstConst* nodep) {
virtual void visit(AstConst* nodep) VL_OVERRIDE {
if (m_constXCvt
&& nodep->num().isFourState()) {
UINFO(4," CONST4 "<<nodep<<endl);
@ -324,7 +327,7 @@ private:
}
}
virtual void visit(AstSel* nodep) {
virtual void visit(AstSel* nodep) VL_OVERRIDE {
iterateChildren(nodep);
if (!nodep->user1SetOnce()) {
// Guard against reading/writing past end of bit vector array
@ -376,7 +379,7 @@ private:
// visit(AstSliceSel) not needed as its bounds are constant and checked
// in V3Width.
virtual void visit(AstArraySel* nodep) {
virtual void visit(AstArraySel* nodep) VL_OVERRIDE {
iterateChildren(nodep);
if (!nodep->user1SetOnce()) {
if (debug()==9) nodep->dumpTree(cout, "-in: ");
@ -454,7 +457,7 @@ private:
}
//--------------------
// Default: Just iterate
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}

View File

@ -124,6 +124,12 @@ private:
if (VN_IS(nodep, GenFor) && !m_forVarp->isGenVar()) {
nodep->v3error("Non-genvar used in generate for: "<<m_forVarp->prettyNameQ()<<endl);
}
else if (!VN_IS(nodep, GenFor) && m_forVarp->isGenVar()) {
nodep->v3error("Genvar not legal in non-generate for (IEEE 2017 27.4): "
<< m_forVarp->prettyNameQ() << endl
<< nodep->warnMore()
<< "... Suggest move for loop upwards to generate-level scope.");
}
if (m_generate) V3Const::constifyParamsEdit(initAssp->rhsp()); // rhsp may change
// This check shouldn't be needed when using V3Simulate
@ -367,7 +373,7 @@ private:
return true;
}
virtual void visit(AstWhile* nodep) {
virtual void visit(AstWhile* nodep) VL_OVERRIDE {
iterateChildren(nodep);
if (m_varModeCheck || m_varModeReplace) {
} else {
@ -396,7 +402,7 @@ private:
}
}
}
virtual void visit(AstGenFor* nodep) {
virtual void visit(AstGenFor* nodep) VL_OVERRIDE {
if (!m_generate || m_varModeReplace) {
iterateChildren(nodep);
} // else V3Param will recursively call each for loop to be unrolled for us
@ -424,7 +430,7 @@ private:
}
}
}
virtual void visit(AstNodeFor* nodep) {
virtual void visit(AstNodeFor* nodep) VL_OVERRIDE {
if (m_generate) { // Ignore for's when expanding genfor's
iterateChildren(nodep);
} else {
@ -432,7 +438,7 @@ private:
}
}
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) VL_OVERRIDE {
if (m_varModeCheck
&& nodep->varp() == m_forVarp
&& nodep->varScopep() == m_forVscp
@ -453,7 +459,7 @@ private:
//--------------------
// Default: Just iterate
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
if (m_varModeCheck && nodep == m_ignoreIncp) {
// Ignore subtree that is the increment
} else {

File diff suppressed because it is too large Load Diff

View File

@ -39,13 +39,13 @@
class WidthRemoveVisitor : public AstNVisitor {
private:
// VISITORS
virtual void visit(AstSigned* nodep) {
virtual void visit(AstSigned* nodep) VL_OVERRIDE {
VL_DO_DANGLING(replaceWithSignedVersion(nodep, nodep->lhsp()->unlinkFrBack()), nodep);
}
virtual void visit(AstUnsigned* nodep) {
virtual void visit(AstUnsigned* nodep) VL_OVERRIDE {
VL_DO_DANGLING(replaceWithSignedVersion(nodep, nodep->lhsp()->unlinkFrBack()), nodep);
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
void replaceWithSignedVersion(AstNode* nodep, AstNode* newp) {
@ -114,7 +114,7 @@ private:
return nodep;
}
// VISITORS
virtual void visit(AstConst* nodep) {
virtual void visit(AstConst* nodep) VL_OVERRIDE {
UASSERT_OBJ(nodep->dtypep(), nodep, "No dtype");
iterate(nodep->dtypep()); // Do datatype first
if (AstConst* newp = newIfConstCommitSize(nodep)) {
@ -126,15 +126,15 @@ private:
}
editDType(nodep);
}
virtual void visit(AstNodeDType* nodep) {
virtual void visit(AstNodeDType* nodep) VL_OVERRIDE {
visitIterateNodeDType(nodep);
}
virtual void visit(AstNodeUOrStructDType* nodep) {
virtual void visit(AstNodeUOrStructDType* nodep) VL_OVERRIDE {
if (nodep->user1SetOnce()) return; // Process once
visitIterateNodeDType(nodep);
nodep->clearCache();
}
virtual void visit(AstParamTypeDType* nodep) {
virtual void visit(AstParamTypeDType* nodep) VL_OVERRIDE {
if (nodep->user1SetOnce()) return; // Process once
visitIterateNodeDType(nodep);
// Move to type table as all dtype pointers must resolve there
@ -153,11 +153,11 @@ private:
nodep->virtRefDTypep(editOneDType(nodep->virtRefDTypep()));
nodep->virtRefDType2p(editOneDType(nodep->virtRefDType2p()));
}
virtual void visit(AstNodePreSel* nodep) { // LCOV_EXCL_LINE
virtual void visit(AstNodePreSel* nodep) VL_OVERRIDE { // LCOV_EXCL_LINE
// This check could go anywhere after V3Param
nodep->v3fatalSrc("Presels should have been removed before this point");
}
virtual void visit(AstNode* nodep) {
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
editDType(nodep);
}

Some files were not shown because too many files have changed in this diff Show More