mirror of
https://github.com/verilator/verilator.git
synced 2026-10-05 17:43:31 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
02e6005fa9 | ||
|
|
a32caac3c1 | ||
|
|
2aa618ce98 | ||
|
|
96b23f6edd | ||
|
|
02d162858f | ||
|
|
82844a5591 | ||
|
|
46fb5a852f | ||
|
|
10a3aa18bc | ||
|
|
3c395c26be | ||
|
|
ea78520220 | ||
|
|
92fbec2294 | ||
|
|
b9be4ae4e8 |
@@ -3,6 +3,18 @@ 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.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.
|
||||
|
||||
@@ -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. ####
|
||||
######################################################################
|
||||
|
||||
@@ -271,6 +274,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; \
|
||||
|
||||
+23
-2
@@ -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};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -828,6 +828,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
|
||||
|
||||
+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}
|
||||
|
||||
@@ -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
@@ -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;
|
||||
|
||||
+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));
|
||||
|
||||
+7
-5
@@ -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*/
|
||||
@@ -83,7 +84,7 @@ 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
|
||||
@@ -132,6 +133,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 +177,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; } }
|
||||
|
||||
+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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+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();
|
||||
|
||||
+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()) {
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//**********************************************************************
|
||||
//**** Version and host name
|
||||
|
||||
#define DTVERSION "Verilator 3.710 2009/05/19"
|
||||
#define DTVERSION "Verilator 3.711 2009/05/19"
|
||||
|
||||
//**********************************************************************
|
||||
//**** 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},
|
||||
|
||||
@@ -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
|
||||
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:
|
||||
@@ -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; }");
|
||||
|
||||
@@ -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!
|
||||
|
||||
|
||||
Reference in New Issue
Block a user