mirror of
https://github.com/verilator/verilator.git
synced 2026-10-03 08:33:21 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0607edd191 | ||
|
|
96c7abdb39 | ||
|
|
6835aecdce | ||
|
|
8174c1ad02 | ||
|
|
6129452681 | ||
|
|
be1a3f427e | ||
|
|
18dc947fa9 | ||
|
|
348c43de63 | ||
|
|
cd9b15b2a6 | ||
|
|
8b20d777b0 | ||
|
|
ec0947ef7e | ||
|
|
02e6005fa9 | ||
|
|
a32caac3c1 | ||
|
|
2aa618ce98 | ||
|
|
96b23f6edd | ||
|
|
02d162858f | ||
|
|
82844a5591 | ||
|
|
46fb5a852f | ||
|
|
10a3aa18bc | ||
|
|
3c395c26be | ||
|
|
ea78520220 | ||
|
|
92fbec2294 | ||
|
|
b9be4ae4e8 |
@@ -3,6 +3,32 @@ Revision history for Verilator
|
||||
The contributors that suggested a given feature are shown in []. [by ...]
|
||||
indicates the contributor was also the author of the fix; Thanks!
|
||||
|
||||
* Verilator 3.712 2009/07/14
|
||||
|
||||
** Patching SystemC is no longer required to trace sc_bvs.
|
||||
|
||||
*** Support zero-width constants in concatenations. [Jeff Winston]
|
||||
|
||||
*** Add verilator --pins-uint8 option to use sc_in<uint8_t/uint16_t>.
|
||||
|
||||
*** Add verilator -V option, to show verbose version.
|
||||
|
||||
*** On WIDTH warnings, show variable name causing error. [Jeff Winston]
|
||||
|
||||
**** Add BLKLOOPINIT error code, and describe --unroll-count. [Jeff Winston]
|
||||
|
||||
* Verilator 3.711 2009/06/23
|
||||
|
||||
**** Support decimal constants of arbitrary widths. [Mark Marshall]
|
||||
|
||||
**** Fix error on case statement with all duplicate items, bug99. [Gary Thomas]
|
||||
|
||||
**** Fix segfault on unrolling for's with bad inits, bug90. [Andreas Olofsson]
|
||||
|
||||
**** Fix tristates causing "Assigned pin is neither...". [by Lane Brooks]
|
||||
|
||||
**** Fix compiler errors under Fedora release candidate 11. [Chitlesh Goorah]
|
||||
|
||||
* Verilator 3.710 2009/05/19
|
||||
|
||||
** Verilator is now licensed under LGPL v3 and/or Artistic v2.0.
|
||||
|
||||
+8
-2
@@ -87,6 +87,9 @@ pkgdatadir = @pkgdatadir@
|
||||
# Directory in which to install data across multiple architectures
|
||||
datarootdir = @datarootdir@
|
||||
|
||||
# Compile options
|
||||
CFG_WITH_DEFENV = @CFG_WITH_DEFENV@
|
||||
|
||||
#### End of system configuration section. ####
|
||||
######################################################################
|
||||
|
||||
@@ -106,8 +109,7 @@ DISTFILES_INC = $(INFOS) .gitignore Artistic COPYING *.in *.ac \
|
||||
MANIFEST.SKIP \
|
||||
bin/* \
|
||||
install-sh configure mkinstalldirs *.texi \
|
||||
include/verilated.[chv]* \
|
||||
include/verilatedos.[chv]* \
|
||||
include/verilated*.[chv]* \
|
||||
include/*.in \
|
||||
include/.*ignore \
|
||||
.*attributes */.*attributes */*/.*attributes \
|
||||
@@ -271,6 +273,10 @@ install-project: dist
|
||||
rm $(DISTNAME).tgz
|
||||
|
||||
install-project-quick:
|
||||
ifeq ($(CFG_WITH_DEFENV),yes)
|
||||
@echo "%Error: Reconfigure with './configure --disable-defenv' to avoid hardcoded paths."
|
||||
false
|
||||
endif
|
||||
@echo "Install-project-quick (no strip) to $(DIRPROJECT)"
|
||||
for p in $(INST_PROJ_FILES) ; do \
|
||||
$(INST_PROJ_CVS) $$p $(DIRPROJECT)/hw/utils/verilator/$$p; \
|
||||
|
||||
+61
-17
@@ -18,9 +18,9 @@ eval 'exec perl -wS $0 ${1+"$@"}'
|
||||
require 5.006_001;
|
||||
use warnings;
|
||||
BEGIN {
|
||||
if (my $Project=($ENV{DIRPROJECT}||$ENV{PROJECT})) {
|
||||
if ($ENV{DIRPROJECT} && $ENV{DIRPROJECT_PERL_BOOT}) {
|
||||
# Magic to allow author testing of perl packages in local directory
|
||||
require "$Project/hw/utils/perltools/boot.pl";
|
||||
require $ENV{DIRPROJECT}."/".$ENV{DIRPROJECT_PERL_BOOT};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,6 +214,7 @@ descriptions in the next sections for more information.
|
||||
--output-split <bytes> Split .cpp files into pieces
|
||||
--output-split-cfuncs <statements> Split .ccp functions
|
||||
--pins-bv <bits> Specify types for top level ports
|
||||
--pins-uint8 Specify types for top level ports
|
||||
--prefix <topname> Name of top level class
|
||||
--profile-cfuncs Name functions for profiling
|
||||
--private Debugging; see docs
|
||||
@@ -227,6 +228,7 @@ descriptions in the next sections for more information.
|
||||
--trace-depth <levels> Depth of tracing
|
||||
-U<var> Undefine preprocessor define
|
||||
--underline-zero Zero signals with leading _'s
|
||||
-V Verbose version and config
|
||||
-v <filename> Verilog library
|
||||
-Werror-<message> Convert warning to error
|
||||
-Wfuture-<message> Disable unknown message warnings
|
||||
@@ -513,10 +515,16 @@ Backward compatible alias for "--pins-bv 65". Note that's a 65, not a 64.
|
||||
|
||||
=item --pins-bv I<width>
|
||||
|
||||
Specifies SystemC outputs of greater than or equal to I<width> bits wide
|
||||
should use sc_bv's instead of uint32/uint64_t's. The default is "--pins-bv
|
||||
65". Versions before Verilator 3.671 defaulted to "--pins-bv 33". The
|
||||
more sc_bv is used, the worse for performance.
|
||||
Specifies SystemC inputs/outputs of greater than or equal to I<width> bits
|
||||
wide should use sc_bv's instead of uint32/uint64_t's. The default is
|
||||
"--pins-bv 65". Versions before Verilator 3.671 defaulted to "--pins-bv
|
||||
33". The more sc_bv is used, the worse for performance.
|
||||
|
||||
=item --pins-uint8
|
||||
|
||||
Specifies SystemC inputs/outputs that are smaller than the --pins-bv
|
||||
setting and 8 bits or less should use uint8_t instead of uint32_t.
|
||||
Likewise pins of width 9-16 will use uint16_t instead of uint32_t.
|
||||
|
||||
=item --prefix I<topname>
|
||||
|
||||
@@ -696,6 +704,11 @@ example module I<x> is referenced, look in I<x>.I<ext>.
|
||||
|
||||
Undefines the given preprocessor symbol.
|
||||
|
||||
=item -V
|
||||
|
||||
Shows the verbose version, including configuration information compiled
|
||||
into Verilator. (Similar to perl -V.)
|
||||
|
||||
=item -v I<filename>
|
||||
|
||||
Read the filename as a Verilog library. Any modules in the file may be
|
||||
@@ -828,6 +841,27 @@ Really, you're better off using a Makefile to do all this for you. Then,
|
||||
when your source changes it will automatically run all of these steps. See
|
||||
the test_sp directory in the distribution for an example.
|
||||
|
||||
=head1 CADENCE NC-SYSTEMC EXECUTION
|
||||
|
||||
Similar to compiling Verilated designs with gcc, Verilated designs may be
|
||||
compiled inside other simulators that support SystemC models. One such
|
||||
simulator is Cadence's NC-SystemC, part of their Incisive Verification
|
||||
Suite. (Highly recommended.)
|
||||
|
||||
Using the example files above, the following command will build the model
|
||||
underneath NC:
|
||||
|
||||
cd obj_dir
|
||||
ncsc_run \
|
||||
sc_main.cpp \
|
||||
Vour__ALLcls.cpp \
|
||||
Vour__ALLsup.cpp \
|
||||
verilated.cpp
|
||||
|
||||
For larger designs you'll want to automate this using makefiles, which pull
|
||||
the names of the .cpp files to compile in from the make variables generated
|
||||
in obj_dir/Vour_classes.mk.
|
||||
|
||||
=head1 BENCHMARKING & OPTIMIZATION
|
||||
|
||||
For best performance, run Verilator with the "-O3 -x-assign=fast
|
||||
@@ -1596,17 +1630,9 @@ All specify blocks and timing checks are ignored.
|
||||
|
||||
=head2 Array Initialization
|
||||
|
||||
When initializing an array, you need to use non-delayed assignments. This
|
||||
is done in the interest of speed; if delayed assignments were used, the
|
||||
simulator would have to copy large arrays every cycle. (In smaller loops,
|
||||
loop unrolling allows the delayed assignment to work, though it's a bit
|
||||
slower than a non-delayed assignment.) Here's an example
|
||||
|
||||
always @ (posedge clk)
|
||||
if (~reset_l) begin
|
||||
for (i=0; i<`ARRAY_SIZE; i++) begin
|
||||
array[i] = 0; // Non-delayed for verilator
|
||||
end
|
||||
When initializing a large array, you need to use non-delayed assignments.
|
||||
Verilator will tell you when this needs to be fixed; see the BLKLOOPINIT
|
||||
error for more information.
|
||||
|
||||
=head2 Array Out of Bounds
|
||||
|
||||
@@ -1774,6 +1800,24 @@ inside a public task.
|
||||
Ignoring this warning may make Verilator simulations differ from other
|
||||
simulators.
|
||||
|
||||
=item BLKLOOPINIT
|
||||
|
||||
This indicates that the initialization of an array needs to use non-delayed
|
||||
assignments. This is done in the interest of speed; if delayed assignments
|
||||
were used, the simulator would have to copy large arrays every cycle. (In
|
||||
smaller loops, loop unrolling allows the delayed assignment to work, though
|
||||
it's a bit slower than a non-delayed assignment.) Here's an example
|
||||
|
||||
always @ (posedge clk)
|
||||
if (~reset_l) begin
|
||||
for (i=0; i<`ARRAY_SIZE; i++) begin
|
||||
array[i] = 0; // Non-delayed for verilator
|
||||
end
|
||||
|
||||
This message is only seen on large or complicated loops because Verilator
|
||||
generally unrolls small loops. You may want to try increasing
|
||||
--unroll-count which will raise the small loop bar to avoid this error.
|
||||
|
||||
=item CASEINCOMPLETE
|
||||
|
||||
Warns that inside a case statement there is a stimulus pattern for which
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
// -*- C++ -*-
|
||||
//*************************************************************************
|
||||
//
|
||||
// Copyright 2009-2009 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.
|
||||
//
|
||||
//*************************************************************************
|
||||
///
|
||||
/// \file
|
||||
/// \brief Verilator: Common include for all Verilated SystemC files
|
||||
///
|
||||
/// This file is included automatically by Verilator at the top of
|
||||
/// all SystemC files it generates.
|
||||
///
|
||||
/// Code available from: http://www.veripool.org/verilator
|
||||
///
|
||||
//*************************************************************************
|
||||
|
||||
|
||||
#ifndef _VERILATEDSC_H_
|
||||
#define _VERILATEDSC_H_ 1 ///< Header Guard
|
||||
|
||||
#include "verilatedos.h"
|
||||
#include "systemc.h"
|
||||
|
||||
//=============================================================================
|
||||
// VL_SC_BV_DATAP
|
||||
// We want to get a pointer to m_data in the sc_bv_base class,
|
||||
// but it is protected. So make an exposing class, then use
|
||||
// cast magic to get at it. Saves patching get_datap in SystemC.
|
||||
|
||||
#define VL_SC_BV_DATAP(bv) (VlScBvExposer::sp_datap(bv))
|
||||
class VlScBvExposer : public sc_bv_base {
|
||||
public:
|
||||
static uint32_t* sp_datap(const sc_bv_base& base) {
|
||||
return static_cast<const VlScBvExposer*>(&base)->sp_datatp(); }
|
||||
uint32_t* sp_datatp() const { return (uint32_t*)(m_data); }
|
||||
// Above reads this protected element in sc_bv_base:
|
||||
// sc_digit* m_data; // data array
|
||||
};
|
||||
|
||||
//=========================================================================
|
||||
|
||||
#endif // guard
|
||||
+1
-2
@@ -121,8 +121,7 @@ If you will be using SystemC, download and install System-Perl,
|
||||
@url{http://search.cpan.org/search?module=SystemC::Netlist}. Note
|
||||
you'll need to set a @samp{SYSTEMPERL} environment variable to point
|
||||
to the downloaded kit. Optionally also set @samp{SYSTEMPERL_INCLUDE}
|
||||
to point to the installed headers. Also, make sure to do a @code{make
|
||||
sc_patch}.
|
||||
to point to the installed headers.
|
||||
|
||||
@item
|
||||
@code{cd} to the Verilator directory containing this README.
|
||||
|
||||
+2
-2
@@ -47,7 +47,7 @@ export OBJCACHE_JOBS := -j $(shell objcache --jobs "$(OBJCACHE_HOSTS)")
|
||||
export OBJCACHE := @objcache --read --write
|
||||
endif
|
||||
|
||||
UNDER_GIT = $(wildcard ../.git)
|
||||
UNDER_GIT = $(wildcard ../.git/logs/HEAD)
|
||||
|
||||
#*********************************************************************
|
||||
|
||||
@@ -79,7 +79,7 @@ prefiles::
|
||||
ifneq ($(UNDER_GIT),) # If local git tree... Else don't burden users
|
||||
prefiles:: config_rev.h
|
||||
# This output goes into srcdir, as we need to distribute it as part of the kit.
|
||||
config_rev.h: config_rev.pl ../.git/index
|
||||
config_rev.h: config_rev.pl ../.git/logs/HEAD
|
||||
$(PERL) config_rev.pl . >$@
|
||||
endif
|
||||
|
||||
|
||||
+2
-2
@@ -228,8 +228,8 @@ $(TGT): V3Ast__gen_classes.h $(OBJS)
|
||||
@echo " Linking $@..."
|
||||
-rm -rf $@ [email protected]
|
||||
${LINK} ${LDFLAGS} -o $@ $(OBJS) $(CCMALLOC) ${LIBS}
|
||||
@-cp [email protected] $@
|
||||
# ok if cp failes on linux, it's there to insure make works on NT
|
||||
@-(cp [email protected] $@ || true)
|
||||
# ok if cp failes on linux, it's there to insure executable works on NT
|
||||
|
||||
V3Number_test: V3Number_test.o
|
||||
${LINK} ${LDFLAGS} -o $@ $^ ${LIBS}
|
||||
|
||||
@@ -176,6 +176,11 @@ string AstNode::prettyName(const string& namein) {
|
||||
return pretty;
|
||||
}
|
||||
|
||||
string AstNode::prettyTypeName() const {
|
||||
if (name()=="") return typeName();
|
||||
return string(typeName())+" '"+prettyName()+"'";
|
||||
}
|
||||
|
||||
int AstNode::widthPow2() const {
|
||||
// I.e. width 30 returns 32, width 32 returns 32.
|
||||
uint32_t width = this->width();
|
||||
|
||||
+2
-1
@@ -640,7 +640,7 @@ protected:
|
||||
public:
|
||||
// ACCESSORS
|
||||
virtual AstType type() const = 0;
|
||||
const char* typeName() const { return type().ascii(); }
|
||||
const char* typeName() const { return type().ascii(); } // See also prettyTypeName
|
||||
AstNode* nextp() const { return m_nextp; }
|
||||
AstNode* backp() const { return m_backp; }
|
||||
AstNode* op1p() const { return m_op1p; }
|
||||
@@ -676,6 +676,7 @@ public:
|
||||
static string encodeName(const string& namein); // Encode user name into internal C representation
|
||||
static string encodeNumber(vlsint64_t numin); // Encode number into internal C representation
|
||||
string prettyName() const { return prettyName(name()); }
|
||||
string prettyTypeName() const; // "VARREF name" for error messages
|
||||
FileLine* fileline() const { return m_fileline; }
|
||||
int width() const { return m_width; }
|
||||
bool width1() const { return width()==1; }
|
||||
|
||||
+7
-1
@@ -122,7 +122,13 @@ string AstVar::scType() const {
|
||||
} else if (widthMin() == 1) {
|
||||
return "bool";
|
||||
} else if (widthMin() <= VL_WORDSIZE) {
|
||||
return "uint32_t";
|
||||
if (widthMin() <= 8 && v3Global.opt.pinsUint8()) {
|
||||
return "uint8_t";
|
||||
} else if (widthMin() <= 16 && v3Global.opt.pinsUint8()) {
|
||||
return "uint16_t";
|
||||
} else {
|
||||
return "uint32_t";
|
||||
}
|
||||
} else {
|
||||
return "uint64_t";
|
||||
}
|
||||
|
||||
@@ -219,6 +219,7 @@ private:
|
||||
if (msb<0) {
|
||||
// There's no space for a IF. We know upperValue is thus down to a specific
|
||||
// exact value, so just return the tree value
|
||||
// Note can't clone here, as we're going to check for equivelence above
|
||||
return m_valueItem[upperValue];
|
||||
}
|
||||
else {
|
||||
@@ -284,6 +285,8 @@ private:
|
||||
|
||||
AstNode::user3ClearTree();
|
||||
AstNode* ifrootp = replaceCaseFastRecurse(cexprp, m_caseWidth-1, 0UL);
|
||||
// Case expressions can't be linked twice, so clone them
|
||||
if (ifrootp && !ifrootp->user3()) ifrootp = ifrootp->cloneTree(true);
|
||||
|
||||
if (ifrootp) nodep->replaceWith(ifrootp);
|
||||
else nodep->unlinkFrBack();
|
||||
|
||||
+1
-1
@@ -1674,7 +1674,7 @@ private:
|
||||
// Default: Just iterate
|
||||
if (m_required) {
|
||||
nodep->v3error("Expecting expression to be constant, but can't convert a "
|
||||
<<nodep->typeName()<<" to constant.");
|
||||
<<nodep->prettyTypeName()<<" to constant.");
|
||||
} else {
|
||||
// Calculate the width of this operation
|
||||
if (m_params && !nodep->width()) {
|
||||
|
||||
+1
-1
@@ -335,7 +335,7 @@ private:
|
||||
&& nodep->lhsp()->castSel()->fromp()->castArraySel())) {
|
||||
AstNode* lhsp = nodep->lhsp()->unlinkFrBack();
|
||||
AstNode* newlhsp = createDlyArray(nodep, lhsp);
|
||||
if (m_inLoop) nodep->v3error("Unsupported: Delayed assignment to array inside for loops (non-delayed is ok - see docs)");
|
||||
if (m_inLoop) nodep->v3warn(BLKLOOPINIT,"Unsupported: Delayed assignment to array inside for loops (non-delayed is ok - see docs)");
|
||||
if (newlhsp) {
|
||||
nodep->lhsp(newlhsp);
|
||||
} else {
|
||||
|
||||
+5
-5
@@ -528,9 +528,9 @@ public:
|
||||
virtual void visit(AstTraceInc*, AstNUser*) {} // Handled outside the Visit class
|
||||
// Default
|
||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
||||
puts((string)"\n???? // "+nodep->typeName()+"\n");
|
||||
puts((string)"\n???? // "+nodep->prettyTypeName()+"\n");
|
||||
nodep->iterateChildren(*this);
|
||||
nodep->v3fatalSrc("Unknown node type reached emitter: "<<nodep->typeName());
|
||||
nodep->v3fatalSrc("Unknown node type reached emitter: "<<nodep->prettyTypeName());
|
||||
}
|
||||
|
||||
public:
|
||||
@@ -1410,7 +1410,7 @@ void EmitCStmts::emitVarList(AstNode* firstp, EisWhich which, const string& pref
|
||||
case EVL_ALL: doit = true; break;
|
||||
case EVL_IO: doit = varp->isIO(); break;
|
||||
case EVL_SIG: doit = (varp->isSignal() && !varp->isIO()); break;
|
||||
case EVL_TEMP: doit = varp->isTemp(); break;
|
||||
case EVL_TEMP: doit = (varp->isTemp() && !varp->isIO()); break;
|
||||
default: v3fatalSrc("Bad Case");
|
||||
}
|
||||
if (varp->isStatic() ? !isstatic : isstatic) doit=false;
|
||||
@@ -1885,8 +1885,8 @@ class EmitCTrace : EmitCStmts {
|
||||
if (nodep->valuep()->castVarRef()) {
|
||||
AstVarRef* varrefp = nodep->valuep()->castVarRef();
|
||||
AstVar* varp = varrefp->varp();
|
||||
if (emitTraceIsScBv(nodep)) puts("(uint32_t*)");
|
||||
puts("(");
|
||||
if (emitTraceIsScBv(nodep)) puts("VL_SC_BV_DATAP(");
|
||||
varrefp->iterate(*this); // Put var name out
|
||||
if (varp->arraysp()) {
|
||||
if (arrayindex==-2) puts("[i]");
|
||||
@@ -1894,7 +1894,7 @@ class EmitCTrace : EmitCStmts {
|
||||
else puts("["+cvtToStr(arrayindex)+"]");
|
||||
}
|
||||
if (varp->isSc()) puts(".read()");
|
||||
if (emitTraceIsScBv(nodep)) puts(".get_datap()");
|
||||
if (emitTraceIsScBv(nodep)) puts(")");
|
||||
puts(")");
|
||||
} else {
|
||||
puts("(");
|
||||
|
||||
+8
-2
@@ -68,7 +68,10 @@ public:
|
||||
V3OutScFile(const string& filename) : V3OutCFile(filename) {}
|
||||
virtual ~V3OutScFile() {};
|
||||
virtual void putsHeader() { puts("// Verilated -*- SystemC -*-\n"); }
|
||||
virtual void putsIntTopInclude() { puts("#include \"systemc.h\"\n"); }
|
||||
virtual void putsIntTopInclude() {
|
||||
puts("#include \"systemc.h\"\n");
|
||||
puts("#include \"verilatedsc.h\"\n");
|
||||
}
|
||||
};
|
||||
|
||||
class V3OutSpFile : public V3OutCFile {
|
||||
@@ -76,7 +79,10 @@ public:
|
||||
V3OutSpFile(const string& filename) : V3OutCFile(filename) {}
|
||||
virtual ~V3OutSpFile() {};
|
||||
virtual void putsHeader() { puts("// Verilated -*- SystemC -*-\n"); }
|
||||
virtual void putsIntTopInclude() { puts("#include \"systemperl.h\"\n"); }
|
||||
virtual void putsIntTopInclude() {
|
||||
puts("#include \"systemperl.h\"\n");
|
||||
puts("#include \"verilatedsc.h\"\n");
|
||||
}
|
||||
};
|
||||
|
||||
class V3OutVFile : public V3OutFile {
|
||||
|
||||
+2
-2
@@ -442,9 +442,9 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
||||
virtual void visit(AstCell*, AstNUser*) {} // Handled outside the Visit class
|
||||
// Default
|
||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
||||
puts((string)"\n???? // "+nodep->typeName()+"\n");
|
||||
puts((string)"\n???? // "+nodep->prettyTypeName()+"\n");
|
||||
nodep->iterateChildren(*this);
|
||||
nodep->v3fatalSrc("Unknown node type reached emitter: "<<nodep->typeName());
|
||||
nodep->v3fatalSrc("Unknown node type reached emitter: "<<nodep->prettyTypeName());
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
+19
-1
@@ -38,6 +38,7 @@ FileLine FileLine::s_defaultFileLine = FileLine(EmptySecret());
|
||||
int V3Error::s_errCount = 0;
|
||||
int V3Error::s_warnCount = 0;
|
||||
int V3Error::s_debugDefault = 0;
|
||||
int V3Error::s_tellManual = 0;
|
||||
ostringstream V3Error::s_errorStr; // Error string being formed
|
||||
V3ErrorCode V3Error::s_errorCode = V3ErrorCode::FATAL;
|
||||
bool V3Error::s_describedEachWarn[V3ErrorCode::MAX];
|
||||
@@ -285,6 +286,7 @@ bool V3Error::isError(V3ErrorCode code) {
|
||||
if (code==V3ErrorCode::SUPPRESS) return false;
|
||||
else if (code==V3ErrorCode::INFO) return false;
|
||||
else if (code==V3ErrorCode::FATAL) return true;
|
||||
else if (code==V3ErrorCode::FATALSRC) return true;
|
||||
else if (code==V3ErrorCode::ERROR) return true;
|
||||
else if (code<V3ErrorCode::FIRST_WARN
|
||||
|| s_pretendError[code]) return true;
|
||||
@@ -295,6 +297,7 @@ string V3Error::msgPrefix(V3ErrorCode code) {
|
||||
if (code==V3ErrorCode::SUPPRESS) return "-arning-suppressed: ";
|
||||
else if (code==V3ErrorCode::INFO) return "-Info: ";
|
||||
else if (code==V3ErrorCode::FATAL) return "%Error: ";
|
||||
else if (code==V3ErrorCode::FATALSRC) return "%Error: Internal Error: ";
|
||||
else if (code==V3ErrorCode::ERROR) return "%Error: ";
|
||||
else if (isError(code)) return "%Error-"+(string)code.ascii()+": ";
|
||||
else return "%Warning-"+(string)code.ascii()+": ";
|
||||
@@ -352,12 +355,27 @@ void V3Error::v3errorEnd (ostringstream& sstr) {
|
||||
cerr<<msgPrefix()<<"else you may end up with different sim results."<<endl;
|
||||
}
|
||||
}
|
||||
// If first warning is not the user's fault (internal/unsupported) then give the website
|
||||
// Not later warnings, as a internal may be caused by an earlier problem
|
||||
if (s_tellManual == 0) {
|
||||
if (s_errorCode==V3ErrorCode::FATALSRC
|
||||
|| sstr.str().find("Unsupported") != string::npos) {
|
||||
s_tellManual = 1;
|
||||
} else {
|
||||
s_tellManual = 2;
|
||||
}
|
||||
}
|
||||
if (isError(s_errorCode)) incErrors();
|
||||
else incWarnings();
|
||||
if (s_errorCode==V3ErrorCode::FATAL) {
|
||||
if (s_errorCode==V3ErrorCode::FATAL
|
||||
|| s_errorCode==V3ErrorCode::FATALSRC) {
|
||||
static bool inFatal = false;
|
||||
if (!inFatal) {
|
||||
inFatal = true;
|
||||
if (s_tellManual==1) {
|
||||
cerr<<msgPrefix()<<"See the manual and http://www.veripool.org/verilator for more assistance."<<endl;
|
||||
s_tellManual = 2;
|
||||
}
|
||||
#ifndef _V3ERROR_NO_GLOBAL_
|
||||
if (debug()) {
|
||||
v3Global.rootp()->dumpTreeFile(v3Global.debugFilename("final.tree",99));
|
||||
|
||||
+9
-6
@@ -39,6 +39,7 @@ public:
|
||||
SUPPRESS, // Warning suppressed by user
|
||||
INFO, // General information out
|
||||
FATAL, // Kill the program
|
||||
FATALSRC, // Kill the program, for internal source errors
|
||||
ERROR, // General error out, can't suppress
|
||||
// Boolean information we track per-line, but aren't errors
|
||||
I_COVERAGE, // Coverage is on/off from /*verilator coverage_on/off*/
|
||||
@@ -46,6 +47,7 @@ public:
|
||||
// Error codes:
|
||||
MULTITOP, // Error: Multiple top level modules
|
||||
TASKNSVAR, // Error: Task I/O not simple
|
||||
BLKLOOPINIT, // Error: Delayed assignment to array inside for loops
|
||||
// Warning codes:
|
||||
FIRST_WARN, // Just a code so the program knows where to start warnings
|
||||
//
|
||||
@@ -83,11 +85,11 @@ public:
|
||||
const char* ascii() const {
|
||||
const char* names[] = {
|
||||
// Leading spaces indicate it can't be disabled.
|
||||
" MIN", " SUPPRESS", " INFO", " FATAL", " ERROR",
|
||||
" MIN", " SUPPRESS", " INFO", " FATAL", " FATALSRC", " ERROR",
|
||||
// Boolean
|
||||
" I_COVERAGE", " I_TRACING",
|
||||
// Errors
|
||||
"MULTITOP", "TASKNSVAR",
|
||||
"MULTITOP", "TASKNSVAR", "BLKLOOPINIT",
|
||||
// Warnings
|
||||
" FIRST_WARN",
|
||||
"BLKANDNBLK",
|
||||
@@ -132,6 +134,7 @@ class V3Error {
|
||||
static int s_debugDefault; // Default debugging level
|
||||
static int s_errCount; // Error count
|
||||
static int s_warnCount; // Error count
|
||||
static int s_tellManual; // Tell user to see manual, 0=not yet, 1=doit, 2=disable
|
||||
static ostringstream s_errorStr; // Error string being formed
|
||||
static V3ErrorCode s_errorCode; // Error string being formed will abort
|
||||
enum MaxErrors { MAX_ERRORS = 50 }; // Fatal after this may errors
|
||||
@@ -175,12 +178,12 @@ inline void v3errorEnd(ostringstream& sstr) { V3Error::v3errorEnd(sstr); }
|
||||
|
||||
// These allow errors using << operators: v3error("foo"<<"bar");
|
||||
// Careful, you can't put () around msg, as you would in most macro definitions
|
||||
#define v3info(msg) v3errorEnd(((V3Error::v3errorPrep(V3ErrorCode::INFO)<<msg),V3Error::v3errorStr()));
|
||||
#define v3fatal(msg) v3errorEnd(((V3Error::v3errorPrep(V3ErrorCode::FATAL)<<msg),V3Error::v3errorStr()));
|
||||
#define v3error(msg) v3errorEnd(((V3Error::v3errorPrep(V3ErrorCode::ERROR)<<msg),V3Error::v3errorStr()));
|
||||
#define v3warn(code,msg) v3errorEnd(((V3Error::v3errorPrep(V3ErrorCode::code)<<msg),V3Error::v3errorStr()));
|
||||
#define v3info(msg) v3warn(INFO,msg)
|
||||
#define v3fatal(msg) v3warn(FATAL,msg)
|
||||
#define v3error(msg) v3warn(ERROR,msg)
|
||||
// Use this instead of fatal() to mention the source code line.
|
||||
#define v3fatalSrc(msg) v3fatal("Internal Error: "<<__FILE__<<":"<<dec<<__LINE__<<": "<<msg)
|
||||
#define v3fatalSrc(msg) v3warn(FATALSRC,__FILE__<<":"<<dec<<__LINE__<<": "<<msg)
|
||||
|
||||
#define UINFO(level,stmsg) {if(debug()>=(level)) { cout<<"- "<<V3Error::lineStr(__FILE__,__LINE__)<<stmsg; }}
|
||||
#define UINFONL(level,stmsg) {if(debug()>=(level)) { cout<<stmsg; } }
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ private:
|
||||
if (!nodep->user4()) {
|
||||
if (nodep->backp()->castCFunc()
|
||||
&& !(nodep->castNodeStmt() || nodep->castCFunc())) {
|
||||
nodep->v3fatalSrc("Node "<<nodep->typeName()<<" in statement position but not marked stmt (node under function)");
|
||||
nodep->v3fatalSrc("Node "<<nodep->prettyTypeName()<<" in statement position but not marked stmt (node under function)");
|
||||
}
|
||||
V3Hash oldHash = m_lowerHash;
|
||||
{
|
||||
|
||||
+25
-12
@@ -131,31 +131,43 @@ V3Number::V3Number (FileLine* fileline, const char* sourcep) {
|
||||
// Convert decimal number to hex
|
||||
int olen = 0;
|
||||
uint32_t val = 0;
|
||||
for (const char* cp=value_startp;
|
||||
*cp; cp++) {
|
||||
int got_x = 0;
|
||||
int got_z = 0;
|
||||
int got_01 = 0;
|
||||
for (const char* cp=value_startp; *cp; cp++) {
|
||||
switch (tolower(*cp)) {
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9': {
|
||||
val = val*10 + (*cp-'0');
|
||||
m_value[0] = val;
|
||||
if (width()>32 && olen>7/*10000000 fits in 32 bits, so ok*/) {
|
||||
m_fileline->v3error("Unsupported: Conversion of decimal number over 32 bits, use hex\n");
|
||||
olen=0;
|
||||
if (olen<=7) { // 10000000 fits in 32 bits, so ok
|
||||
// Constants are common, so for speed avoid wide math until we need it
|
||||
val = val*10 + (*cp-'0');
|
||||
m_value[0] = val;
|
||||
} else { // Wide; all previous digits are already in m_value[0]
|
||||
// this = (this * 10)/*product*/ + (*cp-'0')/*addend*/
|
||||
// Assumed rare; lots of optimizations are possible here
|
||||
V3Number product (fileline, width()+4); // +4 for overflow detection
|
||||
V3Number ten (fileline, width()+4, 10);
|
||||
V3Number addend (fileline, width(), (*cp-'0'));
|
||||
product.opMul(*this,ten);
|
||||
this->opAdd(product,addend);
|
||||
if (product.bitsValue(width(), 4)) { // Overflowed
|
||||
m_fileline->v3error("Too many digits for "<<width()<<" bit number: "<<sourcep);
|
||||
while (*(cp+1)) cp++; // Skip ahead so don't get multiple warnings
|
||||
}
|
||||
}
|
||||
olen++;
|
||||
got_01 = 1;
|
||||
break;
|
||||
}
|
||||
case 'z': case '?': {
|
||||
if (olen) m_fileline->v3error("Multi-digit X/Z/? not legal in decimal constant: "<<*cp);
|
||||
if (!m_sized) m_fileline->v3error("Unsized X/Z/? not legal in decimal constant: "<<*cp);
|
||||
olen++;
|
||||
setAllBitsZ();
|
||||
got_z = 1;
|
||||
break;
|
||||
}
|
||||
case 'x': {
|
||||
if (olen) m_fileline->v3error("Multi-digit X/Z/? not legal in decimal constant: "<<*cp);
|
||||
if (!m_sized) m_fileline->v3error("Unsized X/Z/? not legal in decimal constant: "<<*cp);
|
||||
olen++;
|
||||
got_x = 1;
|
||||
setAllBitsX();
|
||||
break;
|
||||
}
|
||||
@@ -167,6 +179,7 @@ V3Number::V3Number (FileLine* fileline, const char* sourcep) {
|
||||
}
|
||||
}
|
||||
obit = width();
|
||||
if ((got_01+got_x+got_z)>1) m_fileline->v3error("Mixing X/Z/? with digits not legal in decimal constant: "<<value_startp);
|
||||
}
|
||||
else {
|
||||
// Convert bin/octal number to hex
|
||||
@@ -174,7 +187,7 @@ V3Number::V3Number (FileLine* fileline, const char* sourcep) {
|
||||
(cp>=value_startp
|
||||
&& obit<=width());
|
||||
cp--) {
|
||||
if (*cp!='_' && obit>=width()) {
|
||||
if (*cp!='_' && *cp!='0' && obit>=width()) {
|
||||
m_fileline->v3error("Too many digits for "<<width()<<" bit number: "<<sourcep);
|
||||
break;
|
||||
}
|
||||
|
||||
+41
-13
@@ -369,17 +369,6 @@ string V3Options::getenvSYSTEMPERLGuts() {
|
||||
var = DEFENV_SYSTEMPERL;
|
||||
setenvStr("SYSTEMPERL", var, "Hardcoded at build time");
|
||||
}
|
||||
// Only correct or check it if we really need the value
|
||||
if (v3Global.opt.usingSystemPerlLibs()) {
|
||||
if (var == "") {
|
||||
string testdir = V3Options::getenvW() + "/hw/utils/perltools/SystemC"; // Hack for internal testing
|
||||
if (V3Options::fileStatDir(testdir)) {
|
||||
var = testdir;
|
||||
setenvStr ("SYSTEMPERL", var, "From W");
|
||||
}
|
||||
}
|
||||
// Test for correctness in SYSTEMPERL_INCLUDE
|
||||
}
|
||||
return var;
|
||||
}
|
||||
|
||||
@@ -635,9 +624,12 @@ void V3Options::parseOptsList(FileLine* fl, int argc, char** argv) {
|
||||
shift;
|
||||
V3Options::addLibraryFile(filenameSubstitute(argv[i]));
|
||||
}
|
||||
else if ( !strcmp (sw, "-V") ) {
|
||||
showVersion(true);
|
||||
exit(0);
|
||||
}
|
||||
else if ( !strcmp (sw, "-version") ) {
|
||||
cout <<version();
|
||||
cout <<endl;
|
||||
showVersion(false);
|
||||
exit(0);
|
||||
}
|
||||
// Single switches
|
||||
@@ -661,6 +653,7 @@ void V3Options::parseOptsList(FileLine* fl, int argc, char** argv) {
|
||||
else if ( onoff (sw, "-lint-only", flag/*ref*/) ) { m_lintOnly = flag; }
|
||||
else if ( !strcmp (sw, "-no-pins64") ) { m_pinsBv = 33; }
|
||||
else if ( !strcmp (sw, "-pins64") ) { m_pinsBv = 65; }
|
||||
else if ( onoff (sw, "-pins-uint8", flag/*ref*/) ){ m_pinsUint8 = flag; }
|
||||
else if ( !strcmp (sw, "-private") ) { m_public = false; }
|
||||
else if ( onoff (sw, "-profile-cfuncs", flag/*ref*/) ) { m_profileCFuncs = flag; }
|
||||
else if ( onoff (sw, "-psl", flag/*ref*/) ) { m_psl = flag; }
|
||||
@@ -897,6 +890,41 @@ void V3Options::parseOptsFile(FileLine* fl, const string& filename) {
|
||||
|
||||
//======================================================================
|
||||
|
||||
void V3Options::showVersion(bool verbose) {
|
||||
cout <<version();
|
||||
cout <<endl;
|
||||
if (!verbose) return;
|
||||
|
||||
cout <<endl;
|
||||
cout << "Copyright 2003-2009 by Wilson Snyder. Verilator is free software; you can\n";
|
||||
cout << "redistribute it and/or modify the Verilator internals under the terms of\n";
|
||||
cout << "either the GNU Lesser General Public License Version 3 or the Perl Artistic\n";
|
||||
cout << "License Version 2.0.\n";
|
||||
|
||||
cout <<endl;
|
||||
cout << "See http://www.veripool.org/verilator for documentation\n";
|
||||
|
||||
cout <<endl;
|
||||
cout << "Summary of configuration:\n";
|
||||
cout << " Compiled in defaults if not in environment:\n";
|
||||
cout << " SYSTEMC = " << DEFENV_SYSTEMC<<endl;
|
||||
cout << " SYSTEMC_ARCH = " << DEFENV_SYSTEMC_ARCH<<endl;
|
||||
cout << " SYSTEMPERL = " << DEFENV_SYSTEMPERL<<endl;
|
||||
cout << " SYSTEMPERL_INCLUDE = " << DEFENV_SYSTEMPERL_INCLUDE<<endl;
|
||||
cout << " VERILATOR_ROOT = " << DEFENV_VERILATOR_ROOT<<endl;
|
||||
|
||||
cout <<endl;
|
||||
cout << "Environment:\n";
|
||||
cout << " PERL = " << getenvStr("PERL","")<<endl;
|
||||
cout << " SYSTEMC = " << getenvStr("SYSTEMC","")<<endl;
|
||||
cout << " SYSTEMC_ARCH = " << getenvStr("SYSTEMC_ARCH","")<<endl;
|
||||
cout << " SYSTEMPERL = " << getenvStr("SYSTEMPERL","")<<endl;
|
||||
cout << " SYSTEMPERL_INCLUDE = " << getenvStr("SYSTEMPERL_INCLUDE","")<<endl;
|
||||
cout << " VERILATOR_ROOT = " << getenvStr("VERILATOR_ROOT","")<<endl;
|
||||
}
|
||||
|
||||
//======================================================================
|
||||
|
||||
V3Options::V3Options() {
|
||||
m_impp = new V3OptionsImp;
|
||||
|
||||
|
||||
+5
-1
@@ -105,6 +105,7 @@ class V3Options {
|
||||
bool m_l2Name; // main switch: --l2name
|
||||
bool m_lintOnly; // main switch: --lint-only
|
||||
bool m_outFormatOk; // main switch: --cc, --sc or --sp was specified
|
||||
bool m_pinsUint8; // main switch: --pins-uint8
|
||||
bool m_profileCFuncs;// main switch: --profile-cfuncs
|
||||
bool m_psl; // main switch: --psl
|
||||
bool m_public; // main switch: --public
|
||||
@@ -166,8 +167,10 @@ class V3Options {
|
||||
void addIncDir(const string& incdir);
|
||||
void addLibExt(const string& libext);
|
||||
void optimize(int level);
|
||||
void showVersion(bool verbose);
|
||||
void coverage(bool flag) { m_coverageLine = m_coverageToggle = m_coverageUser = flag; }
|
||||
bool onoff(const char* sw, const char* arg, bool& flag);
|
||||
|
||||
static bool wildmatchi(const char* s, const char* p);
|
||||
static string getenvStr(const string& envvar, const string& defaultValue);
|
||||
static void setenvStr(const string& envvar, const string& value, const string& why);
|
||||
@@ -212,6 +215,7 @@ class V3Options {
|
||||
bool traceDups() const { return m_traceDups; }
|
||||
bool outFormatOk() const { return m_outFormatOk; }
|
||||
bool keepTempFiles() const { return (V3Error::debugDefault()!=0); }
|
||||
bool pinsUint8() const { return m_pinsUint8; }
|
||||
bool profileCFuncs() const { return m_profileCFuncs; }
|
||||
bool psl() const { return m_psl; }
|
||||
bool allPublic() const { return m_public; }
|
||||
@@ -290,13 +294,13 @@ class V3Options {
|
||||
// METHODS (environment)
|
||||
// Most of these may be built into the executable with --enable-defenv,
|
||||
// see the README. If adding new variables, also see src/Makefile_obj.in
|
||||
// Also add to V3Options::showVersion()
|
||||
static string getenvPERL() { return getenvStr("PERL","perl"); }
|
||||
static string getenvSYSTEMC();
|
||||
static string getenvSYSTEMC_ARCH();
|
||||
static string getenvSYSTEMPERL();
|
||||
static string getenvSYSTEMPERL_INCLUDE();
|
||||
static string getenvVERILATOR_ROOT();
|
||||
static string getenvW() { return getenvStr("W",""); }
|
||||
|
||||
// METHODS (file utilities using these options)
|
||||
string fileExists (const string& filename);
|
||||
|
||||
+1
-1
@@ -432,7 +432,7 @@ private:
|
||||
}
|
||||
virtual void visit(AstTopScope* nodep, AstNUser*) {
|
||||
// Process the last thing we're finishing
|
||||
if (m_topScopep) nodep->v3fatalSrc("Only one topscope supported");
|
||||
if (m_topScopep) nodep->v3fatalSrc("Only one topscope should ever be created");
|
||||
UINFO(2," Loading tree...\n");
|
||||
//VV***** We reset userp()
|
||||
AstNode::user1ClearTree();
|
||||
|
||||
+1
-1
@@ -990,7 +990,7 @@ int V3PreProcImp::getToken() {
|
||||
string V3PreProcImp::getline() {
|
||||
// Get a single line from the parse stream. Buffer unreturned text until the newline.
|
||||
if (isEof()) return "";
|
||||
char* rtnp;
|
||||
const char* rtnp;
|
||||
bool gotEof = false;
|
||||
while (NULL==(rtnp=strchr(m_lineChars.c_str(),'\n')) && !gotEof) {
|
||||
int tok = getToken();
|
||||
|
||||
+3
-3
@@ -291,7 +291,7 @@ private:
|
||||
}
|
||||
}
|
||||
virtual void visit(AstNodeCond* nodep, AstNUser*) {
|
||||
// We could use above visit(AstNodeTriop), but it's slower to evaluate
|
||||
// We could use above visit(AstNodeTriop), but it's slower even O(n^2) to evaluate
|
||||
// both sides when we really only need to evaluate one side.
|
||||
if (m_checking) {
|
||||
if (!optimizable()) return; // Accelerate
|
||||
@@ -328,7 +328,7 @@ private:
|
||||
nodep->rhsp()->iterateAndNext(*this);
|
||||
AstVarScope* vscp = nodep->lhsp()->castVarRef()->varScopep();
|
||||
if (nodep->castAssignDly()) {
|
||||
// Don't do setNumber, as value isn't visible to new statements
|
||||
// Don't do setNumber, as value isn't yet visible to following statements
|
||||
setOutNumber(vscp, fetchNumber(nodep->rhsp()));
|
||||
} else {
|
||||
setNumber(vscp, fetchNumber(nodep->rhsp()));
|
||||
@@ -353,7 +353,7 @@ private:
|
||||
// In production code, we'll just not optimize. It should be fixed though.
|
||||
clearOptimizable(nodep, "Unknown node type, perhaps missing visitor in TableSimulateVisitor");
|
||||
#ifdef VL_DEBUG
|
||||
UINFO(0,"Unknown node type in TableSimulateVisitor: "<<nodep->typeName()<<endl);
|
||||
UINFO(0,"Unknown node type in TableSimulateVisitor: "<<nodep->prettyTypeName()<<endl);
|
||||
#endif
|
||||
}
|
||||
} else { // simulating
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@ public:
|
||||
virtual ~TraceActivityVertex() {}
|
||||
// Accessors
|
||||
AstNode* insertp() const {
|
||||
if (!m_insertp) v3fatal("Null insertp; probably called on a special always/slow.");
|
||||
if (!m_insertp) v3fatalSrc("Null insertp; probably called on a special always/slow.");
|
||||
return m_insertp;
|
||||
}
|
||||
virtual string name() const {
|
||||
|
||||
@@ -207,6 +207,7 @@ private:
|
||||
AstVarType::MODULETEMP,
|
||||
outrefp->name() + "__en" + suffix + cvtToStr(m_unique++),
|
||||
(width>1) ? new AstRange(outp->fileline(), width-1, 0) : (AstRange *) NULL);
|
||||
enp->varType2Out();
|
||||
|
||||
if (enp->width() != enrhsp->width()) {
|
||||
if (enrhsp->width()==1) { // it seems from my futzing that the linter guarantees this condition
|
||||
|
||||
@@ -102,6 +102,7 @@ private:
|
||||
AstAssign* initAssp = initp->castAssign();
|
||||
if (!initAssp) return cantUnroll(nodep, "no initial assignment");
|
||||
if (initp->nextp() && initp->nextp()!=nodep) nodep->v3fatalSrc("initial assignment shouldn't be a list");
|
||||
if (!initAssp->lhsp()->castVarRef()) return cantUnroll(nodep, "no initial assignment to simple variable");
|
||||
m_forVarp = initAssp->lhsp()->castVarRef()->varp();
|
||||
m_forVscp = initAssp->lhsp()->castVarRef()->varScopep();
|
||||
if (nodep->castGenFor() && !m_forVarp->isGenVar()) {
|
||||
|
||||
+26
-8
@@ -202,6 +202,22 @@ private:
|
||||
nodep->rhsp()->iterateAndNext(*this,WidthVP(ANYSIZE,0,BOTH).p());
|
||||
nodep->width(nodep->lhsp()->width() + nodep->rhsp()->width(),
|
||||
nodep->lhsp()->widthMin() + nodep->rhsp()->widthMin());
|
||||
// Cleanup zero width Verilog2001 {x,{0{foo}}} now,
|
||||
// otherwise having width(0) will cause later assertions to fire
|
||||
if (AstReplicate* repp=nodep->lhsp()->castReplicate()) {
|
||||
if (repp->width()==0) { // Keep rhs
|
||||
nodep->replaceWith(nodep->rhsp()->unlinkFrBack());
|
||||
pushDeletep(nodep); nodep=NULL;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (AstReplicate* repp=nodep->rhsp()->castReplicate()) {
|
||||
if (repp->width()==0) { // Keep lhs
|
||||
nodep->replaceWith(nodep->lhsp()->unlinkFrBack());
|
||||
pushDeletep(nodep); nodep=NULL;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (vup->c()->final()) {
|
||||
if (!nodep->widthSized()) {
|
||||
@@ -218,7 +234,9 @@ private:
|
||||
AstConst* constp = nodep->rhsp()->castConst();
|
||||
if (!constp) { nodep->v3error("Replication value isn't a constant."); return; }
|
||||
uint32_t times = constp->toUInt();
|
||||
if (times==0) { nodep->v3error("Replication value is 0."); times=1; }
|
||||
if (times==0 && !nodep->backp()->castConcat()) { // Concat Visitor will clean it up.
|
||||
nodep->v3error("Replication value of 0 is only legal under a concatenation."); times=1;
|
||||
}
|
||||
nodep->width((nodep->lhsp()->width() * times),
|
||||
(nodep->lhsp()->widthMin() * times));
|
||||
}
|
||||
@@ -702,7 +720,7 @@ private:
|
||||
// (Because we need to know if to connect to one or all instants)
|
||||
nodep->v3error("Port connection "<<nodep->prettyName()<<" as part of a module instance array "
|
||||
<<" requires "<<pinwidth<<" or "<<pinwidth*numInsts
|
||||
<<" bits, but connection's "<<nodep->exprp()->typeName()
|
||||
<<" bits, but connection's "<<nodep->exprp()->prettyTypeName()
|
||||
<<" generates "<<expwidth<<" bits.");
|
||||
awidth = expwidth;
|
||||
}
|
||||
@@ -712,7 +730,7 @@ private:
|
||||
if (pinwidth != expwidth) {
|
||||
nodep->v3error("Unsupported: Port connection "<<nodep->prettyName()<<" to inout signal "
|
||||
<<" requires "<<pinwidth
|
||||
<<" bits, but connection's "<<nodep->exprp()->typeName()
|
||||
<<" bits, but connection's "<<nodep->exprp()->prettyTypeName()
|
||||
<<" generates "<<expwidth<<" bits.");
|
||||
// otherwise would need some mess to force both sides to proper size
|
||||
}
|
||||
@@ -946,11 +964,11 @@ void WidthVisitor::widthCheck (AstNode* nodep, const char* side,
|
||||
}
|
||||
if (bad && !ignoreWarn) {
|
||||
if (debug()>4) nodep->backp()->dumpTree(cout," back: ");
|
||||
nodep->v3warn(WIDTH,"Operator "<<nodep->typeName()
|
||||
nodep->v3warn(WIDTH,"Operator "<<nodep->prettyTypeName()
|
||||
<<" expects "<<expWidth
|
||||
<<(expWidth!=expWidthMin?" or "+cvtToStr(expWidthMin):"")
|
||||
<<" bits on the "<<side<<", but "<<side<<"'s "
|
||||
<<underp->typeName()<<" generates "<<underp->width()
|
||||
<<underp->prettyTypeName()<<" generates "<<underp->width()
|
||||
<<(underp->width()!=underp->widthMin()
|
||||
?" or "+cvtToStr(underp->widthMin()):"")
|
||||
<<" bits.");
|
||||
@@ -969,9 +987,9 @@ void WidthVisitor::widthCheckReduce (AstNode* nodep, const char* side,
|
||||
if (bad) {
|
||||
if (!ignoreWarn) {
|
||||
if (debug()>4) nodep->backp()->dumpTree(cout," back: ");
|
||||
nodep->v3warn(WIDTH,"Logical Operator "<<nodep->typeName()
|
||||
nodep->v3warn(WIDTH,"Logical Operator "<<nodep->prettyTypeName()
|
||||
<<" expects 1 bit on the "<<side<<", but "<<side<<"'s "
|
||||
<<underp->typeName()<<" generates "<<underp->width()
|
||||
<<underp->prettyTypeName()<<" generates "<<underp->width()
|
||||
<<(underp->width()!=underp->widthMin()
|
||||
?" or "+cvtToStr(underp->widthMin()):"")
|
||||
<<" bits.");
|
||||
@@ -988,7 +1006,7 @@ void WidthVisitor::widthCheckPin (AstNode* nodep, AstNode* underp, int expWidth,
|
||||
<<" port connection "<<nodep->prettyName()
|
||||
<<" expects "<<expWidth
|
||||
<<" bits but connection's "
|
||||
<<underp->typeName()<<" generates "<<underp->width()
|
||||
<<underp->prettyTypeName()<<" generates "<<underp->width()
|
||||
<<(underp->width()!=underp->widthMin()
|
||||
?" or "+cvtToStr(underp->widthMin()):"")
|
||||
<<" bits.");
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//**********************************************************************
|
||||
//**** Version and host name
|
||||
|
||||
#define DTVERSION "Verilator 3.710 2009/05/19"
|
||||
#define DTVERSION "Verilator 3.712 2009/07/14"
|
||||
|
||||
//**********************************************************************
|
||||
//**** Functions
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
|
||||
require 5.006_001;
|
||||
BEGIN {
|
||||
if (my $Project=($ENV{DIRPROJECT}||$ENV{PROJECT})) {
|
||||
if ($ENV{DIRPROJECT} && $ENV{DIRPROJECT_PERL_BOOT}) {
|
||||
# Magic to allow author testing of perl packages in local directory
|
||||
require "$Project/hw/utils/perltools/boot.pl";
|
||||
require $ENV{DIRPROJECT}."/".$ENV{DIRPROJECT_PERL_BOOT};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,9 @@ $Fork = Forker->new(use_sig_child=>1) if !$Fork;
|
||||
$SIG{CHLD} = sub { $Fork->sig_child() if $Fork; };
|
||||
$SIG{TERM} = sub { $Fork->kill_tree_all('TERM') if $Fork; die "Quitting...\n"; };
|
||||
|
||||
our $Have_System_Perl;
|
||||
eval "use SystemC::Netlist; \$Have_System_Perl=1;";
|
||||
|
||||
#======================================================================
|
||||
|
||||
#======================================================================
|
||||
@@ -419,6 +422,10 @@ sub compile {
|
||||
$self->error("Test requires SystemC; ignore error since not installed\n");
|
||||
return 1;
|
||||
}
|
||||
elsif ($self->{trace} && !$Have_System_Perl) {
|
||||
$self->error("Test requires SystemPerl; ignore error since not installed\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
$self->_run(logfile=>"$self->{obj_dir}/vl_compile.log",
|
||||
fails=>$param{fails},
|
||||
|
||||
@@ -87,13 +87,8 @@ module Test (/*AUTOARG*/
|
||||
// merge the output values into the result vector.
|
||||
|
||||
input clk;
|
||||
input [31:0] in;
|
||||
output [31:0] out;
|
||||
|
||||
/*AUTOREG*/
|
||||
// Beginning of automatic regs (for this module's undeclared outputs)
|
||||
reg [31:0] out;
|
||||
// End of automatics
|
||||
input [31:0] in;
|
||||
output reg [31:0] out;
|
||||
|
||||
always @(posedge clk) begin
|
||||
out <= in;
|
||||
|
||||
@@ -9,13 +9,13 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
|
||||
|
||||
top_filename("t/t_math_synmul.v");
|
||||
|
||||
my $cycles = $Self->{benchmark}||0;
|
||||
$cycles = 100 if $cycles<100;
|
||||
$Self->{cycles} = $Self->{benchmark}||0;
|
||||
$Self->{cycles} = 100 if $Self->{cycles}<100;
|
||||
|
||||
$Self->{sim_time} = $cycles*100;
|
||||
$Self->{sim_time} = $Self->{cycles}*100;
|
||||
|
||||
compile (
|
||||
v_flags2 => ["+define+SIM_CYCLES=${cycles}"],
|
||||
v_flags2 => ["+define+SIM_CYCLES=$Self->{cycles}"],
|
||||
);
|
||||
|
||||
execute (
|
||||
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/perl
|
||||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||
#
|
||||
# Copyright 2003 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.
|
||||
|
||||
compile (
|
||||
);
|
||||
|
||||
execute (
|
||||
check_finished=>1,
|
||||
);
|
||||
|
||||
ok(1);
|
||||
1;
|
||||
@@ -0,0 +1,81 @@
|
||||
// DESCRIPTION: Verilator: Verilog Test module
|
||||
//
|
||||
// This file ONLY is placed into the Public Domain, for any use,
|
||||
// without warranty, 2008 by Wilson Snyder.
|
||||
|
||||
module t (/*AUTOARG*/
|
||||
// Inputs
|
||||
clk
|
||||
);
|
||||
input clk;
|
||||
|
||||
integer cyc=0;
|
||||
reg [63:0] crc;
|
||||
reg [63:0] sum;
|
||||
|
||||
// Take CRC data and apply to testblock inputs
|
||||
wire [1:0] in = crc[1:0];
|
||||
|
||||
/*AUTOWIRE*/
|
||||
// Beginning of automatic wires (for undeclared instantiated-module outputs)
|
||||
wire [1:0] out; // From test of Test.v
|
||||
// End of automatics
|
||||
|
||||
Test test (/*AUTOINST*/
|
||||
// Outputs
|
||||
.out (out[1:0]),
|
||||
// Inputs
|
||||
.in (in[1:0]));
|
||||
|
||||
// Aggregate outputs into a single result vector
|
||||
wire [63:0] result = {62'h0, out};
|
||||
|
||||
// What checksum will we end up with
|
||||
`define EXPECTED_SUM 64'hbb2d9709592f64bd
|
||||
|
||||
// Test loop
|
||||
always @ (posedge clk) begin
|
||||
`ifdef TEST_VERBOSE
|
||||
$write("[%0t] cyc==%0d crc=%x result=%x\n",$time, cyc, crc, result);
|
||||
`endif
|
||||
cyc <= cyc + 1;
|
||||
crc <= {crc[62:0], crc[63]^crc[2]^crc[0]};
|
||||
sum <= result ^ {sum[62:0],sum[63]^sum[2]^sum[0]};
|
||||
if (cyc==0) begin
|
||||
// Setup
|
||||
crc <= 64'h5aef0c8d_d70a4497;
|
||||
end
|
||||
else if (cyc<10) begin
|
||||
sum <= 64'h0;
|
||||
end
|
||||
else if (cyc<90) begin
|
||||
end
|
||||
else if (cyc==99) begin
|
||||
$write("[%0t] cyc==%0d crc=%x sum=%x\n",$time, cyc, crc, sum);
|
||||
if (crc !== 64'hc77bb9b3784ea091) $stop;
|
||||
if (sum !== `EXPECTED_SUM) $stop;
|
||||
$write("*-* All Finished *-*\n");
|
||||
$finish;
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
||||
module Test (/*AUTOARG*/
|
||||
// Outputs
|
||||
out,
|
||||
// Inputs
|
||||
in
|
||||
);
|
||||
input [1:0] in;
|
||||
output reg [1:0] out;
|
||||
always @* begin
|
||||
// bug99: Internal Error: ../V3Ast.cpp:495: New node already linked?
|
||||
case (in[1:0])
|
||||
2'd0, 2'd1, 2'd2, 2'd3: begin
|
||||
out = in;
|
||||
end
|
||||
endcase
|
||||
end
|
||||
endmodule
|
||||
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/perl
|
||||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||
#
|
||||
# Copyright 2003-2009 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.
|
||||
|
||||
compile (
|
||||
v_flags2 => ["--lint-only"],
|
||||
fails=>1,
|
||||
expect=>
|
||||
'%Error: t/t_const_dec_mixed_bad.v:\d+: Mixing X/Z/\? with digits not legal in decimal constant: x_1
|
||||
%Error: Exiting due to.*',
|
||||
);
|
||||
|
||||
ok(1);
|
||||
1;
|
||||
@@ -0,0 +1,10 @@
|
||||
// DESCRIPTION: Verilator: Verilog Test module
|
||||
//
|
||||
// This file ONLY is placed into the Public Domain, for any use,
|
||||
// without warranty, 2005-2007 by Wilson Snyder.
|
||||
|
||||
module t (/*AUTOARG*/);
|
||||
|
||||
parameter [200:0] MIXED = 32'dx_1;
|
||||
|
||||
endmodule
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/perl
|
||||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||
#
|
||||
# Copyright 2003-2009 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.
|
||||
|
||||
compile (
|
||||
v_flags2 => ["--lint-only"],
|
||||
fails=>1,
|
||||
expect=>
|
||||
'%Error: t/t_const_overflow_bad.v:\d+: Too many digits for 94 bit number: 94\'d123456789012345678901234567890
|
||||
%Error: t/t_const_overflow_bad.v:\d+: Too many digits for 8 bit number: 8\'habc
|
||||
%Error: t/t_const_overflow_bad.v:\d+: Too many digits for 6 bit number: 6\'o1234
|
||||
%Error: t/t_const_overflow_bad.v:\d+: Too many digits for 3 bit number: 3\'b1111
|
||||
%Error: Exiting due to.*',
|
||||
);
|
||||
|
||||
ok(1);
|
||||
1;
|
||||
@@ -0,0 +1,17 @@
|
||||
// DESCRIPTION: Verilator: Verilog Test module
|
||||
//
|
||||
// This file ONLY is placed into the Public Domain, for any use,
|
||||
// without warranty, 2005-2007 by Wilson Snyder.
|
||||
|
||||
module t (/*AUTOARG*/);
|
||||
|
||||
parameter [200:0] TOO_SMALL = 94'd123456789012345678901234567890; // One to many digits
|
||||
|
||||
parameter [200:0] SMALLH = 8'habc; // One to many digits
|
||||
parameter [200:0] SMALLO = 6'o1234; // One to many digits
|
||||
parameter [200:0] SMALLB = 3'b1111; // One to many digits
|
||||
|
||||
// We'll allow this though; no reason to be cruel
|
||||
parameter [200:0] OKH = 8'h000000001;
|
||||
|
||||
endmodule
|
||||
@@ -13,9 +13,9 @@ compile (
|
||||
v_flags2 => ["--lint-only"],
|
||||
fails=>$Self->{v3},
|
||||
expect=>
|
||||
'%Warning-WIDTH: t/t_flag_werror.v:\d+: Operator ASSIGNW expects 4 bits on the Assign RHS, but Assign RHS.s CONST generates 6 bits.
|
||||
q{%Warning-WIDTH: t/t_flag_werror.v:\d+: Operator ASSIGNW expects 4 bits on the Assign RHS, but Assign RHS.s CONST '6'h2e' generates 6 bits.
|
||||
%Warning-WIDTH: Use .* and lint_on around source to disable this message.
|
||||
%Error: Exiting due to',
|
||||
%Error: Exiting due to},
|
||||
) if $Self->{v3};
|
||||
|
||||
ok(1);
|
||||
|
||||
@@ -14,8 +14,8 @@ compile (
|
||||
fails=>$Self->{v3},
|
||||
verilator_flags=> [qw(-sp -Werror-WIDTH)],
|
||||
expect=>
|
||||
'%Error-WIDTH: t/t_flag_werror.v:\d+: Operator ASSIGNW expects 4 bits on the Assign RHS, but Assign RHS.s CONST generates 6 bits.
|
||||
%Error: Exiting due to',
|
||||
q{%Error-WIDTH: t/t_flag_werror.v:\d+: Operator ASSIGNW expects 4 bits on the Assign RHS, but Assign RHS.s CONST '6'h2e' generates 6 bits.
|
||||
%Error: Exiting due to},
|
||||
) if $Self->{v3};
|
||||
|
||||
ok(1);
|
||||
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/perl
|
||||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||
#
|
||||
# Copyright 2003 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.
|
||||
|
||||
compile (
|
||||
);
|
||||
|
||||
#execute ()
|
||||
|
||||
ok(1);
|
||||
1;
|
||||
@@ -0,0 +1,37 @@
|
||||
// DESCRIPTION: Verilator: Verilog Test module
|
||||
//
|
||||
// This file ONLY is placed into the Public Domain, for any use,
|
||||
// without warranty, 2009 by Wilson Snyder.
|
||||
|
||||
module t (/*AUTOARG*/
|
||||
// Outputs
|
||||
priority_mask,
|
||||
// Inputs
|
||||
muxed_requests
|
||||
);
|
||||
|
||||
parameter ARW = 7;
|
||||
|
||||
// verilator lint_off UNOPTFLAT
|
||||
integer i,j;
|
||||
|
||||
output reg [ARW-1:0] priority_mask;
|
||||
|
||||
input [ARW-1:0] muxed_requests;
|
||||
|
||||
always @* begin
|
||||
for (i=ARW-1;i>0;i=i-1) begin
|
||||
priority_mask[i]=1'b0;
|
||||
// vvvv=== note j=j not j=i; was bug
|
||||
for( j=j;j>=0;j=j-1)
|
||||
priority_mask[i]=priority_mask[j] | muxed_requests[j];
|
||||
end
|
||||
//Bit zero is always enabled
|
||||
priority_mask[0]=1'b0;
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
||||
// Local Variables:
|
||||
// verilog-auto-inst-param-value: t
|
||||
// End:
|
||||
@@ -11,10 +11,10 @@ compile (
|
||||
v_flags2 => ["--lint-only"],
|
||||
fails=>$Self->{v3},
|
||||
expect=>
|
||||
'%Warning-WIDTH: t/t_func_bad_width.v:\d+: Operator FUNCREF expects 40 bits on the Function Argument, but Function Argument.s VARREF generates 39 bits.
|
||||
q{%Warning-WIDTH: t/t_func_bad_width.v:\d+: Operator FUNCREF 'MUX' expects 40 bits on the Function Argument, but Function Argument's VARREF 'in' generates 39 bits.
|
||||
%Warning-WIDTH: Use [^\n]+
|
||||
%Warning-WIDTH: t/t_func_bad_width.v:\d+: Operator ASSIGN expects 4 bits on the Assign RHS, but Assign RHS.s FUNCREF generates 32 bits.
|
||||
%Error: Exiting due to',
|
||||
%Warning-WIDTH: t/t_func_bad_width.v:\d+: Operator ASSIGN expects 4 bits on the Assign RHS, but Assign RHS.s FUNCREF 'MUX' generates 32 bits.
|
||||
%Error: Exiting due to},
|
||||
);
|
||||
|
||||
ok(1);
|
||||
|
||||
@@ -86,14 +86,14 @@ module tpub (
|
||||
$c("publicNoArgs();");
|
||||
$c("publicSetBool(true);");
|
||||
$c("publicSetLong(0x11bca);");
|
||||
$c("publicSetQuad(0x66655554444);");
|
||||
$c("publicSetQuad(VL_ULL(0x66655554444));");
|
||||
$c("publicSetFlop(0x321);");
|
||||
//Unsupported: $c("WData w[3] = {0x12, 0x5678_9123, 0x1245_2352}; publicSetWide(w);");
|
||||
end
|
||||
if (cyc==12) begin
|
||||
$c("got_bool = publicGetSetBool(true);");
|
||||
$c("got_long = publicGetSetLong(0x11bca);");
|
||||
$c("got_quad = publicGetSetQuad(0xaaaabbbbcccc);");
|
||||
$c("got_quad = publicGetSetQuad(VL_ULL(0xaaaabbbbcccc));");
|
||||
end
|
||||
if (cyc==13) begin
|
||||
$c("{ bool gb; publicGetBool(gb); got_bool=gb; }");
|
||||
|
||||
@@ -11,8 +11,8 @@ compile (
|
||||
v_flags2 => ["--lint-only"],
|
||||
fails=>1,
|
||||
expect=>
|
||||
'%Error: t/t_inst_array_bad.v:\d+: Port connection __pinNumber2 as part of a module instance array requires 1 or 8 bits, but connection\'s VARREF generates 9 bits.
|
||||
%Error: Exiting due to.*',
|
||||
q{%Error: t/t_inst_array_bad.v:\d+: Port connection __pinNumber2 as part of a module instance array requires 1 or 8 bits, but connection's VARREF 'onebitbad' generates 9 bits.
|
||||
%Error: Exiting due to.*},
|
||||
);
|
||||
|
||||
ok(1);
|
||||
|
||||
@@ -16,12 +16,12 @@ compile (
|
||||
verilator_make_gcc=>0,
|
||||
fails=>$Self->{v3},
|
||||
expect=>
|
||||
'%Warning-WIDTH: t/t_inst_overwide.v:\d+: Output port connection outy_w92 expects 92 bits but connection\'s VARREF generates 30 bits.
|
||||
q{%Warning-WIDTH: t/t_inst_overwide.v:\d+: Output port connection outy_w92 expects 92 bits but connection's VARREF 'outc_w30' generates 30 bits.
|
||||
%Warning-WIDTH: Use .* to disable this message.
|
||||
%Warning-WIDTH: t/t_inst_overwide.v:\d+: Output port connection outz_w22 expects 22 bits but connection\'s VARREF generates 73 bits.
|
||||
%Warning-WIDTH: t/t_inst_overwide.v:\d+: Input port connection inw_w31 expects 31 bits but connection\'s VARREF generates 1 bits.
|
||||
%Warning-WIDTH: t/t_inst_overwide.v:\d+: Input port connection inx_w11 expects 11 bits but connection\'s VARREF generates 61 bits.
|
||||
%Error: Exiting due to.*',
|
||||
%Warning-WIDTH: t/t_inst_overwide.v:\d+: Output port connection outz_w22 expects 22 bits but connection's VARREF 'outd_w73' generates 73 bits.
|
||||
%Warning-WIDTH: t/t_inst_overwide.v:\d+: Input port connection inw_w31 expects 31 bits but connection's VARREF 'ina_w1' generates 1 bits.
|
||||
%Warning-WIDTH: t/t_inst_overwide.v:\d+: Input port connection inx_w11 expects 11 bits but connection's VARREF 'inb_w61' generates 61 bits.
|
||||
%Error: Exiting due to.*},
|
||||
);
|
||||
|
||||
ok(1);
|
||||
|
||||
@@ -11,9 +11,9 @@ compile (
|
||||
v_flags2 => ["--lint-only"],
|
||||
fails=>1,
|
||||
expect=>
|
||||
'.*%Warning-WIDTH: t/t_lint_restore_bad.v:\d+: Operator ASSIGN expects 5 bits on the Assign RHS, but Assign RHS\'s CONST generates 64 bits.
|
||||
q{.*%Warning-WIDTH: t/t_lint_restore_bad.v:\d+: Operator ASSIGN expects 5 bits on the Assign RHS, but Assign RHS's CONST '64'h1' generates 64 bits.
|
||||
%Warning-WIDTH: Use .*
|
||||
%Error: Exiting due to.*',
|
||||
%Error: Exiting due to.*},
|
||||
) if $Self->{v3};
|
||||
|
||||
ok(1);
|
||||
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/perl
|
||||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||
#
|
||||
# Copyright 2003-2009 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.
|
||||
|
||||
compile (
|
||||
v_flags2 => ["--lint-only"],
|
||||
fails=>1,
|
||||
expect=>
|
||||
q{.*%Warning-WIDTH: t/t_lint_width_bad.v:\d+: Operator ASSIGNW expects 5 bits on the Assign RHS, but Assign RHS's VARREF 'in' generates 4 bits.
|
||||
%Warning-WIDTH: Use .*
|
||||
%Error: Exiting due to.*},
|
||||
) if $Self->{v3};
|
||||
|
||||
ok(1);
|
||||
1;
|
||||
@@ -0,0 +1,19 @@
|
||||
// DESCRIPTION: Verilator: Verilog Test module
|
||||
//
|
||||
// This file ONLY is placed into the Public Domain, for any use,
|
||||
// without warranty, 2009 by Wilson Snyder.
|
||||
|
||||
module t ();
|
||||
|
||||
// This shows the uglyness in width warnings across param modules
|
||||
// TODO: Would be nice to also show relevant parameter settings
|
||||
p #(.WIDTH(4)) p4 (.in(4'd0));
|
||||
p #(.WIDTH(5)) p5 (.in(5'd0));
|
||||
|
||||
endmodule
|
||||
|
||||
module p
|
||||
#(parameter WIDTH=64)
|
||||
(input [WIDTH-1:0] in);
|
||||
wire [4:0] out = in;
|
||||
endmodule
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/perl
|
||||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||
#
|
||||
# Copyright 2003 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.
|
||||
|
||||
compile (
|
||||
);
|
||||
|
||||
execute (
|
||||
check_finished=>1,
|
||||
);
|
||||
|
||||
ok(1);
|
||||
1;
|
||||
@@ -0,0 +1,87 @@
|
||||
// DESCRIPTION: Verilator: Verilog Test module
|
||||
// This file ONLY is placed into the Public Domain, for any use,
|
||||
// without warranty, 2009 by Wilson Snyder.
|
||||
|
||||
module t (/*AUTOARG*/
|
||||
// Inputs
|
||||
clk
|
||||
);
|
||||
input clk;
|
||||
|
||||
integer cyc=0;
|
||||
reg [63:0] crc;
|
||||
reg [63:0] sum;
|
||||
|
||||
// Take CRC data and apply to testblock inputs
|
||||
wire [15:0] in = crc[15:0];
|
||||
|
||||
/*AUTOWIRE*/
|
||||
// Beginning of automatic wires (for undeclared instantiated-module outputs)
|
||||
wire [15:0] outa; // From test of Test.v
|
||||
wire [15:0] outb; // From test of Test.v
|
||||
wire [15:0] outc; // From test of Test.v
|
||||
// End of automatics
|
||||
|
||||
Test test (/*AUTOINST*/
|
||||
// Outputs
|
||||
.outa (outa[15:0]),
|
||||
.outb (outb[15:0]),
|
||||
.outc (outc[15:0]),
|
||||
// Inputs
|
||||
.clk (clk),
|
||||
.in (in[15:0]));
|
||||
|
||||
// Aggregate outputs into a single result vector
|
||||
wire [63:0] result = {16'h0, outa, outb, outc};
|
||||
|
||||
// Test loop
|
||||
always @ (posedge clk) begin
|
||||
`ifdef TEST_VERBOSE
|
||||
$write("[%0t] cyc==%0d crc=%x result=%x\n",$time, cyc, crc, result);
|
||||
`endif
|
||||
cyc <= cyc + 1;
|
||||
crc <= {crc[62:0], crc[63]^crc[2]^crc[0]};
|
||||
sum <= result ^ {sum[62:0],sum[63]^sum[2]^sum[0]};
|
||||
if (cyc==0) begin
|
||||
// Setup
|
||||
crc <= 64'h5aef0c8d_d70a4497;
|
||||
sum <= 64'h0;
|
||||
end
|
||||
else if (cyc<10) begin
|
||||
sum <= 64'h0;
|
||||
end
|
||||
else if (cyc<90) begin
|
||||
end
|
||||
else if (cyc==99) begin
|
||||
$write("[%0t] cyc==%0d crc=%x sum=%x\n",$time, cyc, crc, sum);
|
||||
if (crc !== 64'hc77bb9b3784ea091) $stop;
|
||||
// What checksum will we end up with (above print should match)
|
||||
`define EXPECTED_SUM 64'h09be74b1b0f8c35d
|
||||
if (sum !== `EXPECTED_SUM) $stop;
|
||||
$write("*-* All Finished *-*\n");
|
||||
$finish;
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
||||
module Test (/*AUTOARG*/
|
||||
// Outputs
|
||||
outa, outb, outc,
|
||||
// Inputs
|
||||
clk, in
|
||||
);
|
||||
|
||||
input clk;
|
||||
input [15:0] in;
|
||||
output reg [15:0] outa;
|
||||
output reg [15:0] outb;
|
||||
output reg [15:0] outc;
|
||||
|
||||
parameter WIDTH = 0;
|
||||
always @(posedge clk) begin
|
||||
outa <= {in};
|
||||
outb <= {{WIDTH{1'b0}}, in};
|
||||
outc <= {in, {WIDTH{1'b0}}};
|
||||
end
|
||||
endmodule
|
||||
@@ -84,6 +84,10 @@ module t (/*AUTOARG*/
|
||||
if ( con__ascii !== {"abcd","efgh","ijkl","mnop"}) $stop;
|
||||
|
||||
if ( 3'dx !== 3'hx) $stop;
|
||||
|
||||
// Wide decimal
|
||||
if ( 94'd12345678901234567890123456789 != 94'h27e41b3246bec9b16e398115) $stop;
|
||||
if (-94'sd123456789012345678901234567 != 94'h3f99e1020ea70d57d360b479) $stop;
|
||||
end
|
||||
if (cyc==2) begin
|
||||
win <= 32'h123123;
|
||||
|
||||
@@ -7,7 +7,7 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
|
||||
# Lesser General Public License Version 3 or the Perl Artistic License
|
||||
# Version 2.0.
|
||||
|
||||
$golden_out ||= "t/$Self->{name}.out";
|
||||
$Self->{golden_out} ||= "t/$Self->{name}.out";
|
||||
my $stdout_filename = "$Self->{obj_dir}/$Self->{name}__test.vpp";
|
||||
|
||||
if (!$Self->{v3}) {
|
||||
@@ -19,7 +19,7 @@ if (!$Self->{v3}) {
|
||||
stdout_filename => $stdout_filename,
|
||||
);
|
||||
ok(preproc_check($Self->{top_filename}, $stdout_filename)
|
||||
&& files_identical($stdout_filename, $golden_out));
|
||||
&& files_identical($stdout_filename, $Self->{golden_out}));
|
||||
}
|
||||
|
||||
sub preproc_check {
|
||||
|
||||
@@ -12,7 +12,7 @@ top_filename("$Self->{obj_dir}/$Self->{name}.v");
|
||||
# Rather then having to maintain a new .v and .out, simply add returns
|
||||
# to all lines of the existing t_preproc test.
|
||||
|
||||
$golden_out ||= "$Self->{obj_dir}/$Self->{name}.out";
|
||||
$Self->{golden_out} = "$Self->{obj_dir}/$Self->{name}.out";
|
||||
|
||||
{
|
||||
my $wholefile = file_contents("$Self->{t_dir}/t_preproc.v");
|
||||
@@ -22,9 +22,9 @@ $golden_out ||= "$Self->{obj_dir}/$Self->{name}.out";
|
||||
{
|
||||
my $wholefile = file_contents("$Self->{t_dir}/t_preproc.out");
|
||||
$wholefile =~ s!t/t_preproc.v!$Self->{obj_dir}/t_preproc_dos.v!og; # Fix `line's
|
||||
write_wholefile($golden_out, $wholefile);
|
||||
write_wholefile($Self->{golden_out}, $wholefile);
|
||||
}
|
||||
|
||||
require 't/t_preproc.pl';
|
||||
do 't/t_preproc.pl';
|
||||
|
||||
1;
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
//
|
||||
// Copyright 2006 by Wilson Snyder. This program is free software; you can
|
||||
// redistribute it and/or modify it under the terms of either the GNU
|
||||
// General Public License or the Perl Artistic License.
|
||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||
// Version 2.0.
|
||||
|
||||
// ** Note this file has DOS CR's so we can test them!
|
||||
|
||||
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/perl
|
||||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||
#
|
||||
# Copyright 2003 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.
|
||||
|
||||
top_filename("t/t_var_pinsizes.v");
|
||||
|
||||
compile (
|
||||
v_flags2 => ["--trace -sp -pins-uint8 --exe $Self->{t_dir}/t_var_pinsizes.cpp"],
|
||||
make_main => 0,
|
||||
) if $Self->{v3};
|
||||
|
||||
if ($Self->{v3}) {
|
||||
file_grep ("$Self->{obj_dir}/$Self->{VM_PREFIX}.sp", qr/sc_in<bool> \s+ i1;/x);
|
||||
file_grep ("$Self->{obj_dir}/$Self->{VM_PREFIX}.sp", qr/sc_in<uint8_t> \s+ i8;/x);
|
||||
file_grep ("$Self->{obj_dir}/$Self->{VM_PREFIX}.sp", qr/sc_in<uint16_t> \s+ i16;/x);
|
||||
file_grep ("$Self->{obj_dir}/$Self->{VM_PREFIX}.sp", qr/sc_in<uint32_t> \s+ i32;/x);
|
||||
file_grep ("$Self->{obj_dir}/$Self->{VM_PREFIX}.sp", qr/sc_in<uint64_t> \s+ i64;/x);
|
||||
file_grep ("$Self->{obj_dir}/$Self->{VM_PREFIX}.sp", qr/sc_in<sc_bv<65>\s> \s+ i65;/x);
|
||||
|
||||
file_grep ("$Self->{obj_dir}/$Self->{VM_PREFIX}.sp", qr/sc_out<bool> \s+ o1;/x);
|
||||
file_grep ("$Self->{obj_dir}/$Self->{VM_PREFIX}.sp", qr/sc_out<uint8_t> \s+ o8;/x);
|
||||
file_grep ("$Self->{obj_dir}/$Self->{VM_PREFIX}.sp", qr/sc_out<uint16_t> \s+ o16;/x);
|
||||
file_grep ("$Self->{obj_dir}/$Self->{VM_PREFIX}.sp", qr/sc_out<uint32_t> \s+ o32;/x);
|
||||
file_grep ("$Self->{obj_dir}/$Self->{VM_PREFIX}.sp", qr/sc_out<uint64_t> \s+ o64;/x);
|
||||
file_grep ("$Self->{obj_dir}/$Self->{VM_PREFIX}.sp", qr/sc_out<sc_bv<65>\s> \s+ o65;/x);
|
||||
}
|
||||
|
||||
ok(1);
|
||||
1;
|
||||
@@ -8,6 +8,8 @@
|
||||
# include "Vt_var_pins_sc32.h"
|
||||
#elif defined(T_VAR_PINS_SC64)
|
||||
# include "Vt_var_pins_sc64.h"
|
||||
#elif defined(T_VAR_PINS_SCUI)
|
||||
# include "Vt_var_pins_scui.h"
|
||||
#else
|
||||
# error "Unknown test"
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user