Compare commits

...
11 Commits
30 changed files with 928 additions and 78 deletions
+13
View File
@@ -3,6 +3,19 @@ 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.843 2012/12/01
*** Add +1364-1995ext and similar language options, bug532. [Jeremy Bennett]
**** Fix mis-optimized identical submodule subtract, bug581. [Charlie Brej]
**** Fix crash on dotted references into dead modules, bug583. [Jeremy Bennett]
**** Fix compile issues on MSVCC, bug571, bug577. [Amir Gonnen]
**** Fix --debug overriding preceding --dump-treei, bug580. [Jeremy Bennett]
* Verilator 3.842 2012/11/03
**** Add -x-initial-edge, bug570. [Jeremy Bennett]
+78 -11
View File
@@ -241,6 +241,11 @@ descriptions in the next sections for more information.
{file.c/cc/cpp} Optional C++ files to compile in
{file.a/o/so} Optional C++ files to link in
+1364-1995ext+<ext> Use Verilog 1995 with file extension <ext>
+1364-2001ext+<ext> Use Verilog 2001 with file extension <ext>
+1364-2005ext+<ext> Use Verilog 2005 with file extension <ext>
+1800-2005ext+<ext> Use SystemVerilog 2005 with file extension <ext>
+1800-2009ext+<ext> Use SystemVerilog 2009 with file extension <ext>
--assert Enable all assertions
--autoflush Flush streams after all $displays
--bbox-sys Blackbox unknown $system calls
@@ -261,6 +266,7 @@ descriptions in the next sections for more information.
--debug-check Enable debugging assertions
--debugi <level> Enable debugging at a specified level
--debugi-<srcfile> <level> Enable debugging a source file at a level
--default-language <lang> Default language to parse
+define+<var>+<value> Set preprocessor define
--dump-tree Enable dumping .tree files
--dump-treei <level> Enable dumping .tree files at a level
@@ -279,7 +285,7 @@ descriptions in the next sections for more information.
--inline-mult <value> Tune module inlining
-LDFLAGS <flags> Linker pre-object flags for makefile
-LDLIBS <flags> Linker library flags for makefile
--language <lang> Language standard to parse
--language <lang> Default language standard to parse
+libext+<ext>+[ext]... Extensions for finding modules
--lint-only Lint, but do not make output
--MMD Create .d dependency files
@@ -308,6 +314,7 @@ descriptions in the next sections for more information.
--sp Create SystemPerl output
--stats Create statistics file
-sv Enable SystemVerilog parsing
+systemverilogext+<ext> Synonym for +1800-2009ext+<ext>
--top-module <topname> Name of top level input module
--trace Enable waveform creation
--trace-depth <levels> Depth of tracing
@@ -320,6 +327,8 @@ descriptions in the next sections for more information.
--unused-regexp <regexp> Tune UNUSED lint signals
-V Verbose version and config
-v <filename> Verilog library
+verilog1995ext+<ext> Synonym for +1364-1995ext+<ext>
+verilog2001ext+<ext> Synonym for +1364-2001ext+<ext>
-Werror-<message> Convert warning to error
-Wfuture-<message> Disable unknown message warnings
-Wno-<message> Disable warning
@@ -355,6 +364,41 @@ this way, Verilator will include a make rule that uses these files when
linking the I<module> executable. This generally is only useful when used
with the --exe option.
=item +1364-1995ext+I<ext>
=item +1364-2001ext+I<ext>
=item +1364-2005ext+I<ext>
=item +1800-2005ext+I<ext>
=item +1800-2009ext+I<ext>
Specifies the language standard to be used with a specific filename
extension, I<ext>.
For compatibility with other simulators, see also the synonyms
C<+verilog1995ext+>I<ext>, C<+verilog2001ext+>I<ext>, and
C<+systemverilogext+>I<ext>.
For any source file, the language specified by these options takes
precedence over any language specified by the C<--default-language> or
C<--language> options.
These options take effect in the order they are encountered. Thus the
following would use Verilog 1995 for C<a.v> and Verilog 2001 for C<b.v>.
verilator ... +1364-1995ext+v a.v +1364-2001ext+v b.v
These flags are only recommended for legacy mixed language designs, as the
preferable option is to edit the code to repair new keywords, or add
appropriate C<`begin_keywords>.
B<Note> C<`begin_keywords> is a SystemVerilog construct, which specifies
I<only> which the set of keywords is to be recognized. Whatever set is
chosen, the semantics will be those of SystemVerilog. By contrast
C<+1364-1995ext+> etc. specify both the syntax I<and> semantics to be used.
=item --assert
Enable all assertions, includes enabling the --psl flag. (If psl is not
@@ -529,6 +573,7 @@ Rarely needed. Enable internal debugging assertion checks, without
changing debug verbosity. Enabled automatically when --debug specified.
=item --debugi <level>
=item --debugi-<srcfile> <level>
Rarely needed - for developer use. Set internal debugging level globally
@@ -536,6 +581,25 @@ to the specified debug level (1-10) or set the specified source file to the
specified level. Higher levels produce more detailed messages (plain
C<--debug> is equivalent to C<--debugi 4>).
=item --default-language I<value>
Select the language to be used by default when first processing each
Verilog file. The language value must be "1364-1995", "1364-2001",
"1364-2005", "1800-2005" or "1800-2009".
Any language associated with a particular file extension (see the various
+I<lang>ext+ options) will be used in preference to the language specified
by --default-language.
The --default-language flag is only recommended for legacy code using the
same language in all source files, as the preferable option is to edit the
code to repair new keywords, or add appropriate C<`begin_keywords>. For
legacy mixed language designs, the various +I<lang>ext+ options should be
used.
If no language is specified, either by this flag or +I<lang>ext+ options,
then the latest SystemVerilog language (IEEE 1800-2009) is used.
=item +define+I<var>+I<value>
Defines the given preprocessor symbol. Same as -D; +define is fairly
@@ -549,7 +613,7 @@ the Verilator Internals manual. --dump-tree is enabled automatically with
--debug, so "--debug --no-dump-tree" may be useful if the dump files are
large and not desired.
=item --dump-treei
=item --dump-treei <level>
Rarely needed. Enable writing .tree debug files with a specific dumping
level, 0 disbles dumps and is equivelent to "--no-dump-tree". Level 9
@@ -645,15 +709,8 @@ in the Make variable LDLIBS, not LDFLAGS.)
=item --language I<value>
Select the language to be used when first processing each Verilog file.
The language value must be "1364-1995", "1364-2001", "1364-2001",
"1364-2005", "1800-2005", "VAMS-2.3". Verilator also allows the
non-standard "1800+VAMS" to allow both the full SystemVerilog and
Verilog-AMS keywords.
The --language flag is only recommended for legacy code, as the preferable
option is to edit the code to repair new keywords, or add appropriate
`begin_keywords.
A synonym for C<--default-langauge>, for compatibility with other tools and
earlier versions of Verilator.
=item +libext+I<ext>+I<ext>...
@@ -860,6 +917,10 @@ Specifies SystemVerilog language features should be enabled; equivalent to
"--language 1800-2005". This option is selected by default, it exists for
compatibility with other simulators.
=item +systemverilogext+I<ext>
A synonym for C<+1800-2009ext+>I<ext>.
=item --top-module I<topname>
When the input Verilog contains more than one top level module, specifies
@@ -935,6 +996,12 @@ Read the filename as a Verilog library. Any modules in the file may be
used to resolve cell instantiations in the top level module, else ignored.
Note -v is fairly standard across Verilog tools.
=item +verilog1995ext+I<ext>
=item +verilog2001ext+I<ext>
Synonyms for C<+1364-1995ext+>I<ext> and C<+1364-2001ext+>I<ext> respectively
=item -Wall
Enable all warnings, including code style warnings that are normally
+1 -1
View File
@@ -6,7 +6,7 @@
#AC_INIT([Verilator],[#.### YYYY-MM-DD])
#AC_INIT([Verilator],[#.### devel])
AC_INIT([Verilator],[3.842 2012-11-03])
AC_INIT([Verilator],[3.843 2012-12-01])
AC_CONFIG_HEADER(src/config_build.h)
AC_CONFIG_FILES(Makefile src/Makefile src/Makefile_obj include/verilated.mk)
+7
View File
@@ -34,6 +34,13 @@
# include <unistd.h>
#endif
#ifndef O_LARGEFILE // For example on WIN32
# define O_LARGEFILE 0
#endif
#ifndef O_NONBLOCK
# define O_NONBLOCK 0
#endif
// CONSTANTS
static const char* VLTSAVE_HEADER_STR = "verilatorsave01\n"; ///< Value of first bytes of each file
static const char* VLTSAVE_TRAILER_STR = "vltsaved"; ///< Value of last bytes of each file
+4
View File
@@ -36,18 +36,22 @@ typedef signed __int8 int8_t;
#endif
/* Use to export a symbol from application */
#ifndef DPI_DLLISPEC
#if defined (_MSC_VER)
#define DPI_DLLISPEC __declspec(dllimport)
#else
#define DPI_DLLISPEC
#endif
#endif
/* Use to import a symbol into application */
#ifndef DPI_DLLESPEC
#if defined (_MSC_VER)
#define DPI_DLLESPEC __declspec(dllexport)
#else
#define DPI_DLLESPEC
#endif
#endif
/* Use to mark a function as external */
#ifndef DPI_EXTERN
+11 -4
View File
@@ -1135,10 +1135,17 @@ struct AstVarRef : public AstNodeVarRef {
ASTNODE_NODE_FUNCS(VarRef, VARREF)
virtual void dump(ostream& str);
virtual V3Hash sameHash() const { return V3Hash(V3Hash(varp()->name()),V3Hash(hiername())); }
virtual bool same(AstNode* samep) const {
if (varScopep()) return varScopep()==samep->castVarRef()->varScopep();
else return (hiername()==samep->castVarRef()->hiername()
&& varp()->name()==samep->castVarRef()->varp()->name()); }
virtual bool same(AstNode* samep) const { return same(samep->castVarRef()); }
inline bool same(AstVarRef* samep) const {
if (varScopep()) return (varScopep()==samep->varScopep()
&& lvalue()==samep->lvalue());
else return (hiername()==samep->hiername()
&& varp()->name()==samep->varp()->name()
&& lvalue()==samep->lvalue()); }
inline bool sameNoLvalue(AstVarRef* samep) const {
if (varScopep()) return (varScopep()==samep->varScopep());
else return (hiername()==samep->hiername()
&& varp()->name()==samep->varp()->name()); }
virtual int instrCount() const { return widthInstrs()*(lvalue()?1:instrCountLd()); }
virtual string emitVerilog() { V3ERROR_NA; return ""; } // Implemented specially
virtual string emitC() { V3ERROR_NA; return ""; }
+4 -5
View File
@@ -415,8 +415,7 @@ private:
// Avoid comparing widthMin's, which results in lost optimization attempts
// If cleanup sameTree to be smarter, this can be restored.
//return node1p->sameTree(node2p);
return node1p->castVarRef()->varp() == node2p->castVarRef()->varp()
&& node1p->castVarRef()->lvalue() == node2p->castVarRef()->lvalue();
return node1p->same(node2p);
} else {
return false;
}
@@ -431,7 +430,7 @@ private:
AstVarRef* elsevarp = elsep->lhsp()->castVarRef();
if (!ifvarp || !elsevarp) return false;
if (ifvarp->isWide()) return false; // Would need temporaries, so not worth it
if (ifvarp->varp() != elsevarp->varp()) return false;
if (!ifvarp->sameTree(elsevarp)) return false;
return true;
}
bool operandIfIf(AstNodeIf* nodep) {
@@ -776,7 +775,7 @@ private:
AstSel* sel2p = nextp->lhsp()->castSel(); if (!sel2p) return false;
AstVarRef* varref1p = sel1p->fromp()->castVarRef(); if (!varref1p) return false;
AstVarRef* varref2p = sel2p->fromp()->castVarRef(); if (!varref2p) return false;
if (varref1p->varp() != varref2p->varp()) return false;
if (!varref1p->sameTree(varref2p)) return false;
AstConst* con1p = sel1p->lsbp()->castConst(); if (!con1p) return false;
AstConst* con2p = sel2p->lsbp()->castConst(); if (!con2p) return false;
// We need to make sure there's no self-references involved in either
@@ -827,7 +826,7 @@ private:
bool replaceNodeAssign(AstNodeAssign* nodep) {
if (nodep->lhsp()->castVarRef()
&& nodep->rhsp()->castVarRef()
&& nodep->lhsp()->sameTree(nodep->rhsp())
&& nodep->lhsp()->castVarRef()->sameNoLvalue(nodep->rhsp()->castVarRef())
&& !nodep->castAssignDly()) {
// X = X. Quite pointless, though X <= X may override another earlier assignment
if (nodep->castAssignW()) {
+19 -4
View File
@@ -80,22 +80,33 @@ const string FileLineSingleton::filenameLetters(int no) {
return op;
}
//! Convert filenames to a filenameno
//! This lets us assign a nice small identifier for debug messages, but more
//! importantly lets us use a 4 byte int instead of 8 byte pointer in every
//! FileLine.
//! We associate a language with each source file, so we also set the default
//! for this.
int FileLineSingleton::nameToNumber(const string& filename) {
// Convert filenames to a filenameno
// This lets us assign a nice small identifier for debug messages, but more
// importantly lets us use a 4 byte int instead of 8 byte pointer in every FileLine.
FileNameNumMap::const_iterator iter = m_namemap.find(filename);
if (VL_LIKELY(iter != m_namemap.end())) return iter->second;
int num = m_names.size();
m_names.push_back(filename);
m_languages.push_back(V3LangCode::mostRecent());
m_namemap.insert(make_pair(filename,num));
return num;
}
//! Support XML output
//! Experimental. Updated to also put out the language.
void FileLineSingleton::fileNameNumMapDumpXml(ostream& os) {
os<<"<files>\n";
for (FileNameNumMap::const_iterator it = m_namemap.begin(); it != m_namemap.end(); ++it) {
os<<"<file id=\""<<filenameLetters(it->second)<<"\" filename=\""<<it->first<<"\"/>\n";
os<<"<file id=\""<<filenameLetters(it->second)
<<"\" filename=\""<<it->first
<<"\" language=\""<<numberToLang(it->second).ascii()<<"\"/>\n";
}
os<<"</files>\n";
}
@@ -170,6 +181,10 @@ FileLine* FileLine::copyOrSameFileLine() {
return newp;
}
void FileLine::updateLanguage () {
language(v3Global.opt.fileLanguage(filename()));
}
const string FileLine::filebasename() const {
string name = filename();
string::size_type pos;
+19 -3
View File
@@ -30,6 +30,8 @@
#include <set>
#include <deque>
#include "V3LangCode.h"
//######################################################################
class V3ErrorCode {
@@ -271,12 +273,18 @@ inline uint32_t cvtToHash(const void* vp) {
class FileLine;
//! Singleton class with tables of per-file data.
//! This singleton class contains tables of data that are unchanging in each
//! source file (each with its own unique filename number).
class FileLineSingleton {
// TYPES
typedef map<string,int> FileNameNumMap;
typedef map<string,V3LangCode> FileLangNumMap;
// MEMBERS
FileNameNumMap m_namemap; // filenameno for each filename
deque<string> m_names; // filename text for each filenameno
deque<V3LangCode> m_languages; // language for each filenameno
// COSNTRUCTORS
FileLineSingleton() { }
~FileLineSingleton() { }
@@ -285,17 +293,22 @@ protected:
// METHODS
int nameToNumber(const string& filename);
const string numberToName(int filenameno) const { return m_names[filenameno]; }
void clear() { m_namemap.clear(); m_names.clear(); }
const V3LangCode numberToLang(int filenameno) const { return m_languages[filenameno]; }
void numberToLang(int filenameno, const V3LangCode l) { m_languages[filenameno] = l; }
void clear() { m_namemap.clear(); m_names.clear(); m_languages.clear(); }
void fileNameNumMapDumpXml(ostream& os);
static const string filenameLetters(int fileno);
};
//! File and line number of an object, mostly for error reporting
//! This class is instantiated for every source code line (potentially
//! millions). To save space, per-file information (e.g. filename, source
//! language is held in tables in the FileLineSingleton class.
class FileLine {
// File and line number of an object, mostly for error reporting
int m_lineno;
int m_filenameno;
bitset<V3ErrorCode::_ENUM_MAX> m_warnOn;
// Consider moving opt.language() into here, so can know language per-node
private:
struct EmptySecret {};
@@ -315,6 +328,7 @@ protected:
friend class V3PreLex;
friend class V3PreProcImp;
void lineno(int num) { m_lineno = num; }
void language (V3LangCode lang) { singleton().numberToLang(m_filenameno, lang); }
void filename(const string& name) { m_filenameno = singleton().nameToNumber(name); }
void lineDirective(const char* textp, int& enterExitRef);
void linenoInc() { m_lineno++; }
@@ -337,6 +351,8 @@ public:
#endif
int lineno () const { return m_lineno; }
V3LangCode language () const { return singleton().numberToLang(m_filenameno); }
void updateLanguage ();
string ascii() const;
const string filename () const { return singleton().numberToName(m_filenameno); }
const string filenameLetters() const { return singleton().filenameLetters(m_filenameno); }
+72
View File
@@ -0,0 +1,72 @@
// -*- mode: C++; c-file-style: "cc-mode" -*-
//*************************************************************************
// DESCRIPTION: Verilator: Language code class
//
// Code available from: http://www.veripool.org/verilator
//
//*************************************************************************
//
// Copyright 2003-2012 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.
//
//*************************************************************************
#ifndef _V3LANGCODE_H_
#define _V3LANGCODE_H_ 1
#include "config_build.h"
#include "verilatedos.h"
#include <string>
#include <vector>
#include <map>
#include <set>
//######################################################################
//! Class for the different languages supported.
//! A separate file, since used both in V3Options (globally) and FileLine 9per
//! file).
class V3LangCode {
public:
enum en {
L_ERROR, // Must be first.
L1364_1995,
L1364_2001,
L1364_2005,
L1800_2005,
L1800_2009,
// ***Add new elements below also***
_ENUM_END
};
const char* ascii() const {
const char* names[] = {
// These must match the `begin_keywords values.
" ERROR",
"1364-1995",
"1364-2001",
"1364-2005",
"1800-2005",
"1800-2009"
};
return names[m_e];
};
static V3LangCode mostRecent() { return V3LangCode(L1800_2009); }
bool legal() const { return m_e != L_ERROR; }
//
enum en m_e;
inline V3LangCode () : m_e(L_ERROR) {}
inline V3LangCode (en _e) : m_e(_e) {}
V3LangCode (const char* textp);
explicit inline V3LangCode (int _e) : m_e(static_cast<en>(_e)) {}
operator en () const { return m_e; }
};
//######################################################################
#endif // guard
+1
View File
@@ -1484,6 +1484,7 @@ private:
}
nodep->fromp()->iterateAndNext(*this);
nodep->bitp()->iterateAndNext(*this);
nodep->attrp()->iterateAndNext(*this);
}
virtual void visit(AstBegin* nodep, AstNUser*) {
UINFO(5," "<<nodep<<endl);
+61 -6
View File
@@ -55,6 +55,7 @@ struct V3OptionsImp {
set<string> m_incDirUserSet; // Include directories (for removing duplicates)
list<string> m_incDirFallbacks; // Include directories (ordered)
set<string> m_incDirFallbackSet; // Include directories (for removing duplicates)
map<string,V3LangCode> m_langExts; // Language extension map
list<string> m_libExtVs; // Library extensions (ordered)
set<string> m_libExtVSet; // Library extensions (for removing duplicates)
DirMap m_dirMap; // Directory listing
@@ -76,6 +77,12 @@ struct V3OptionsImp {
}
}
}
void addLangExt(const string &langext, const V3LangCode lc) {
// New language extension replaces any pre-existing one.
(void)m_langExts.erase(langext);
m_langExts[langext] = lc;
}
void addLibExtV(const string& libext) {
if (m_libExtVSet.find(libext) == m_libExtVSet.end()) {
m_libExtVSet.insert(libext);
@@ -91,6 +98,9 @@ void V3Options::addIncDirUser(const string& incdir) {
void V3Options::addIncDirFallback(const string& incdir) {
m_impp->addIncDirFallback(incdir);
}
void V3Options::addLangExt(const string &langext, const V3LangCode lc) {
m_impp->addLangExt(langext, lc);
}
void V3Options::addLibExtV(const string& libext) {
m_impp->addLibExtV(libext);
}
@@ -158,7 +168,7 @@ string V3Options::allArgsString() {
}
//######################################################################
// Language class
// V3LangCode class functions
V3LangCode::V3LangCode (const char* textp) {
// Return code for given string, or ERROR, which is a bad code
@@ -365,6 +375,24 @@ void V3Options::filePathLookedMsg(FileLine* fl, const string& modname) {
}
}
//! Determine what language is associated with a filename
//! If we recognize the extension, use its language, otherwise, use the
//! default language.
V3LangCode V3Options::fileLanguage(const string &filename) {
string ext = filenameNonDir(filename);
string::size_type pos;
if ((pos = ext.rfind(".")) != string::npos) {
ext.erase(0, pos + 1);
map<string,V3LangCode>::iterator it = m_impp->m_langExts.find(ext);
if (it != m_impp->m_langExts.end()) {
return it->second;
}
}
return m_defaultLanguage;
}
void V3Options::unlinkRegexp(const string& dir, const string& regexp) {
if (DIR* dirp = opendir(dir.c_str())) {
while (struct dirent* direntp = readdir(dirp)) {
@@ -633,6 +661,17 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char
else if ( !strncmp (sw, "+incdir+", 8)) {
addIncDirUser (parseFileArg(optdir, string (sw+strlen("+incdir+"))));
}
else if (parseLangExt(sw, "+systemverilogext+", V3LangCode::L1800_2009)
|| parseLangExt(sw, "+verilog1995ext+", V3LangCode::L1364_1995)
|| parseLangExt(sw, "+verilog2001ext+", V3LangCode::L1364_2001)
|| parseLangExt(sw, "+1364-1995ext+", V3LangCode::L1364_1995)
|| parseLangExt(sw, "+1364-2001ext+", V3LangCode::L1364_2001)
|| parseLangExt(sw, "+1364-2005ext+", V3LangCode::L1364_2005)
|| parseLangExt(sw, "+1800-2005ext+", V3LangCode::L1800_2005)
|| parseLangExt(sw, "+1800-2009ext+", V3LangCode::L1800_2009)) {
// Nothing to do here - all done in the test
}
else if ( !strncmp (sw, "+libext+", 8)) {
string exts = string(sw+strlen("+libext+"));
string::size_type pos;
@@ -695,7 +734,7 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char
else if ( onoff (sw, "-skip-identical", flag/*ref*/) ) { m_skipIdentical = flag; }
else if ( !strcmp (sw, "-sp") ) { m_outFormatOk = true; m_systemC = true; m_systemPerl = true; }
else if ( onoff (sw, "-stats", flag/*ref*/) ) { m_stats = flag; }
else if ( !strcmp (sw, "-sv") ) { m_language = V3LangCode::L1800_2005; }
else if ( !strcmp (sw, "-sv") ) { m_defaultLanguage = V3LangCode::L1800_2005; }
else if ( onoff (sw, "-trace", flag/*ref*/) ) { m_trace = flag; }
else if ( onoff (sw, "-trace-dups", flag/*ref*/) ) { m_traceDups = flag; }
else if ( onoff (sw, "-trace-underscore", flag/*ref*/) ) { m_traceUnderscore = flag; }
@@ -779,11 +818,12 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char
shift;
addLdLibs(argv[i]);
}
else if ( !strcmp (sw, "-language") && (i+1)<argc ) {
else if ( (!strcmp (sw, "-language") && (i+1)<argc)
|| (!strcmp (sw, "-default-language") && (i+1)<argc)) {
shift;
V3LangCode optval = V3LangCode(argv[i]);
if (optval.legal()) {
m_language = optval;
m_defaultLanguage = optval;
} else {
fl->v3fatal("Unknown language specified: "<<argv[i]);
}
@@ -1074,6 +1114,21 @@ string V3Options::parseFileArg(const string& optdir, const string& relfilename)
//======================================================================
//! Utility to see if we have a language extension argument and if so add it.
bool V3Options::parseLangExt (const char* swp, //!< argument text
const char* langswp, //!< option to match
const V3LangCode lc) { //!< language code
int len = strlen(langswp);
if (!strncmp(swp, langswp, len)) {
addLangExt(swp + len, lc);
return true;
} else {
return false;
}
}
//======================================================================
void V3Options::showVersion(bool verbose) {
cout <<version();
cout <<endl;
@@ -1171,7 +1226,7 @@ V3Options::V3Options() {
m_unusedRegexp = "*unused*";
m_xAssign = "fast";
m_language = V3LangCode::mostRecent();
m_defaultLanguage = V3LangCode::mostRecent();
optimize(true);
// Default +libext+
@@ -1188,7 +1243,7 @@ V3Options::~V3Options() {
void V3Options::setDebugMode(int level) {
V3Error::debugDefault(level);
m_dumpTree = true;
if (!m_dumpTree) m_dumpTree = true; // Don't override if already set.
m_stats = true;
m_debugCheck = true;
cout << "Starting "<<version()<<endl;
+8 -40
View File
@@ -29,43 +29,7 @@
#include <set>
#include "V3Global.h"
//######################################################################
class V3LangCode {
public:
enum en {
L_ERROR, // Must be first.
L1364_1995,
L1364_2001,
L1364_2005,
L1800_2005,
L1800_2009,
// ***Add new elements below also***
_ENUM_END
};
const char* ascii() const {
const char* names[] = {
// These must match the `begin_keywords values.
" ERROR",
"1364-1995",
"1364-2001",
"1364-2005",
"1800-2005",
"1800-2009"
};
return names[m_e];
};
static V3LangCode mostRecent() { return V3LangCode(L1800_2009); }
bool legal() const { return m_e != L_ERROR; }
//
enum en m_e;
inline V3LangCode () : m_e(L_ERROR) {}
inline V3LangCode (en _e) : m_e(_e) {}
V3LangCode (const char* textp); // Return matching code or ERROR
explicit inline V3LangCode (int _e) : m_e(static_cast<en>(_e)) {}
operator en () const { return m_e; }
};
#include "V3LangCode.h"
//######################################################################
// V3Options - Command line options
@@ -156,8 +120,9 @@ class V3Options {
string m_unusedRegexp; // main switch: --unused-regexp
string m_xAssign; // main switch: --x-assign
// Consider moving m_language into FileLine, so can know language per-node
V3LangCode m_language; // main switch: --language
// Language is now held in FileLine, on a per-node basis. However we still
// have a concept of the default language at a global level.
V3LangCode m_defaultLanguage; // main switch: --language
// MEMBERS (optimizations)
// // main switch: -Op: --public
@@ -185,6 +150,7 @@ class V3Options {
void addFuture(const string& flag);
void addIncDirUser(const string& incdir); // User requested
void addIncDirFallback(const string& incdir); // Low priority if not found otherwise
void addLangExt(const string &langext, const V3LangCode lc);
void addLibExtV(const string& libext);
void optimize(int level);
void showVersion(bool verbose);
@@ -192,6 +158,7 @@ class V3Options {
bool onoff(const char* sw, const char* arg, bool& flag);
bool suffixed(const char* sw, const char* arg);
string parseFileArg(const string& optdir, const string& relfilename);
bool parseLangExt(const char* swp, const char* langswp, const V3LangCode lc);
string filePathCheckOneDir(const string& modname, const string& dirname);
static string getenvStr(const string& envvar, const string& defaultValue);
@@ -288,7 +255,7 @@ class V3Options {
const V3StringSet& ldLibs() const { return m_ldLibs; }
const V3StringSet& libraryFiles() const { return m_libraryFiles; }
const V3StringList& vFiles() const { return m_vFiles; }
const V3LangCode& language() const { return m_language; }
const V3LangCode& defaultLanguage() const { return m_defaultLanguage; }
bool isFuture(const string& flag) const;
bool isLibraryFile(const string& filename) const;
@@ -351,6 +318,7 @@ class V3Options {
string fileExists (const string& filename);
string filePath (FileLine* fl, const string& modname, const string& errmsg);
void filePathLookedMsg(FileLine* fl, const string& modname);
V3LangCode fileLanguage(const string &filename);
static bool fileStatDir (const string& filename);
static bool fileStatNormal (const string& filename);
+6 -2
View File
@@ -100,8 +100,12 @@ void V3ParseImp::parseFile(FileLine* fileline, const string& modfilename, bool i
// Set language standard up front
if (!v3Global.opt.preprocOnly()) {
// Leting lex parse this saves us from having to specially en/decode
// from the V3LangCode to the various Lex BEGIN states.
ppPushText((string)"`begin_keywords \""+v3Global.opt.language().ascii()+"\"\n");
// from the V3LangCode to the various Lex BEGIN states. The language
// of this source file is updated here, in case there have been any
// intervening +<lang>ext+ options since it was first ecountered.
FileLine *modfileline = new FileLine (modfilename, 0);
modfileline->updateLanguage();
ppPushText((string)"`begin_keywords \""+modfileline->language().ascii()+"\"\n");
}
// Preprocess into m_ppBuffer
+4 -2
View File
@@ -20,8 +20,9 @@ use vars qw ($Debug %Vars $Driver $Fork);
use POSIX qw(strftime);
$::Driver = 1;
$::Have_Forker = 0;
eval "use Parallel::Forker; \$Fork=Parallel::Forker->new(use_sig_child=>1);";
eval "use Parallel::Forker; \$Fork=Parallel::Forker->new(use_sig_child=>1); \$::Have_Forker=1;";
$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"; };
@@ -185,7 +186,8 @@ sub one_test {
if ($opt_stop) { die "%Error: --stop and errors found\n"; }
}
$LeftCnt--;
print STDERR "==SUMMARY: Left $LeftCnt Passed $OkCnt Unsup $UnsupCnt Skipped $SkipCnt Failed $FailCnt\n";
my $LeftMsg = $::Have_Forker ? $LeftCnt : "NO-FORKER";
print STDERR "==SUMMARY: Left $LeftMsg Passed $OkCnt Unsup $UnsupCnt Skipped $SkipCnt Failed $FailCnt\n";
},
)->ready();
}
+18
View File
@@ -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;
+279
View File
@@ -0,0 +1,279 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2012 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 [7:0] operand_a = crc[7:0];
wire [7:0] operand_b = crc[15:8];
/*AUTOWIRE*/
// Beginning of automatic wires (for undeclared instantiated-module outputs)
wire [6:0] out; // From test of Test.v
// End of automatics
Test test (/*AUTOINST*/
// Outputs
.out (out[6:0]),
// Inputs
.clk (clk),
.operand_a (operand_a[7:0]),
.operand_b (operand_b[7:0]));
// Aggregate outputs into a single result vector
wire [63:0] result = {57'h0, out};
// 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'h8a78c2ec4946ac38
if (sum !== `EXPECTED_SUM) $stop;
$write("*-* All Finished *-*\n");
$finish;
end
end
endmodule
module Test
(
// Inputs
input wire clk,
input wire [7:0] operand_a, // operand a
input wire [7:0] operand_b, // operand b
// Outputs
output wire [6:0] out
);
wire [6:0] clz_a;
wire [6:0] clz_b;
clz u_clz_a
(
// Inputs
.data_i (operand_a),
.out (clz_a));
clz u_clz_b
(
// Inputs
.data_i (operand_b),
.out (clz_b));
assign out = clz_a - clz_b;
`ifdef TEST_VERBOSE
always @(posedge clk)
$display("Out(%x) = clz_a(%x) - clz_b(%x)", out, clz_a, clz_b);
`endif
endmodule
`define def_0000_001x 8'b0000_0010, 8'b0000_0011
`define def_0000_01xx 8'b0000_0100, 8'b0000_0101, 8'b0000_0110, 8'b0000_0111
`define def_0000_10xx 8'b0000_1000, 8'b0000_1001, 8'b0000_1010, 8'b0000_1011
`define def_0000_11xx 8'b0000_1100, 8'b0000_1101, 8'b0000_1110, 8'b0000_1111
`define def_0000_1xxx `def_0000_10xx, `def_0000_11xx
`define def_0001_00xx 8'b0001_0000, 8'b0001_0001, 8'b0001_0010, 8'b0001_0011
`define def_0001_01xx 8'b0001_0100, 8'b0001_0101, 8'b0001_0110, 8'b0001_0111
`define def_0001_10xx 8'b0001_1000, 8'b0001_1001, 8'b0001_1010, 8'b0001_1011
`define def_0001_11xx 8'b0001_1100, 8'b0001_1101, 8'b0001_1110, 8'b0001_1111
`define def_0010_00xx 8'b0010_0000, 8'b0010_0001, 8'b0010_0010, 8'b0010_0011
`define def_0010_01xx 8'b0010_0100, 8'b0010_0101, 8'b0010_0110, 8'b0010_0111
`define def_0010_10xx 8'b0010_1000, 8'b0010_1001, 8'b0010_1010, 8'b0010_1011
`define def_0010_11xx 8'b0010_1100, 8'b0010_1101, 8'b0010_1110, 8'b0010_1111
`define def_0011_00xx 8'b0011_0000, 8'b0011_0001, 8'b0011_0010, 8'b0011_0011
`define def_0011_01xx 8'b0011_0100, 8'b0011_0101, 8'b0011_0110, 8'b0011_0111
`define def_0011_10xx 8'b0011_1000, 8'b0011_1001, 8'b0011_1010, 8'b0011_1011
`define def_0011_11xx 8'b0011_1100, 8'b0011_1101, 8'b0011_1110, 8'b0011_1111
`define def_0100_00xx 8'b0100_0000, 8'b0100_0001, 8'b0100_0010, 8'b0100_0011
`define def_0100_01xx 8'b0100_0100, 8'b0100_0101, 8'b0100_0110, 8'b0100_0111
`define def_0100_10xx 8'b0100_1000, 8'b0100_1001, 8'b0100_1010, 8'b0100_1011
`define def_0100_11xx 8'b0100_1100, 8'b0100_1101, 8'b0100_1110, 8'b0100_1111
`define def_0101_00xx 8'b0101_0000, 8'b0101_0001, 8'b0101_0010, 8'b0101_0011
`define def_0101_01xx 8'b0101_0100, 8'b0101_0101, 8'b0101_0110, 8'b0101_0111
`define def_0101_10xx 8'b0101_1000, 8'b0101_1001, 8'b0101_1010, 8'b0101_1011
`define def_0101_11xx 8'b0101_1100, 8'b0101_1101, 8'b0101_1110, 8'b0101_1111
`define def_0110_00xx 8'b0110_0000, 8'b0110_0001, 8'b0110_0010, 8'b0110_0011
`define def_0110_01xx 8'b0110_0100, 8'b0110_0101, 8'b0110_0110, 8'b0110_0111
`define def_0110_10xx 8'b0110_1000, 8'b0110_1001, 8'b0110_1010, 8'b0110_1011
`define def_0110_11xx 8'b0110_1100, 8'b0110_1101, 8'b0110_1110, 8'b0110_1111
`define def_0111_00xx 8'b0111_0000, 8'b0111_0001, 8'b0111_0010, 8'b0111_0011
`define def_0111_01xx 8'b0111_0100, 8'b0111_0101, 8'b0111_0110, 8'b0111_0111
`define def_0111_10xx 8'b0111_1000, 8'b0111_1001, 8'b0111_1010, 8'b0111_1011
`define def_0111_11xx 8'b0111_1100, 8'b0111_1101, 8'b0111_1110, 8'b0111_1111
`define def_1000_00xx 8'b1000_0000, 8'b1000_0001, 8'b1000_0010, 8'b1000_0011
`define def_1000_01xx 8'b1000_0100, 8'b1000_0101, 8'b1000_0110, 8'b1000_0111
`define def_1000_10xx 8'b1000_1000, 8'b1000_1001, 8'b1000_1010, 8'b1000_1011
`define def_1000_11xx 8'b1000_1100, 8'b1000_1101, 8'b1000_1110, 8'b1000_1111
`define def_1001_00xx 8'b1001_0000, 8'b1001_0001, 8'b1001_0010, 8'b1001_0011
`define def_1001_01xx 8'b1001_0100, 8'b1001_0101, 8'b1001_0110, 8'b1001_0111
`define def_1001_10xx 8'b1001_1000, 8'b1001_1001, 8'b1001_1010, 8'b1001_1011
`define def_1001_11xx 8'b1001_1100, 8'b1001_1101, 8'b1001_1110, 8'b1001_1111
`define def_1010_00xx 8'b1010_0000, 8'b1010_0001, 8'b1010_0010, 8'b1010_0011
`define def_1010_01xx 8'b1010_0100, 8'b1010_0101, 8'b1010_0110, 8'b1010_0111
`define def_1010_10xx 8'b1010_1000, 8'b1010_1001, 8'b1010_1010, 8'b1010_1011
`define def_1010_11xx 8'b1010_1100, 8'b1010_1101, 8'b1010_1110, 8'b1010_1111
`define def_1011_00xx 8'b1011_0000, 8'b1011_0001, 8'b1011_0010, 8'b1011_0011
`define def_1011_01xx 8'b1011_0100, 8'b1011_0101, 8'b1011_0110, 8'b1011_0111
`define def_1011_10xx 8'b1011_1000, 8'b1011_1001, 8'b1011_1010, 8'b1011_1011
`define def_1011_11xx 8'b1011_1100, 8'b1011_1101, 8'b1011_1110, 8'b1011_1111
`define def_1100_00xx 8'b1100_0000, 8'b1100_0001, 8'b1100_0010, 8'b1100_0011
`define def_1100_01xx 8'b1100_0100, 8'b1100_0101, 8'b1100_0110, 8'b1100_0111
`define def_1100_10xx 8'b1100_1000, 8'b1100_1001, 8'b1100_1010, 8'b1100_1011
`define def_1100_11xx 8'b1100_1100, 8'b1100_1101, 8'b1100_1110, 8'b1100_1111
`define def_1101_00xx 8'b1101_0000, 8'b1101_0001, 8'b1101_0010, 8'b1101_0011
`define def_1101_01xx 8'b1101_0100, 8'b1101_0101, 8'b1101_0110, 8'b1101_0111
`define def_1101_10xx 8'b1101_1000, 8'b1101_1001, 8'b1101_1010, 8'b1101_1011
`define def_1101_11xx 8'b1101_1100, 8'b1101_1101, 8'b1101_1110, 8'b1101_1111
`define def_1110_00xx 8'b1110_0000, 8'b1110_0001, 8'b1110_0010, 8'b1110_0011
`define def_1110_01xx 8'b1110_0100, 8'b1110_0101, 8'b1110_0110, 8'b1110_0111
`define def_1110_10xx 8'b1110_1000, 8'b1110_1001, 8'b1110_1010, 8'b1110_1011
`define def_1110_11xx 8'b1110_1100, 8'b1110_1101, 8'b1110_1110, 8'b1110_1111
`define def_1111_00xx 8'b1111_0000, 8'b1111_0001, 8'b1111_0010, 8'b1111_0011
`define def_1111_01xx 8'b1111_0100, 8'b1111_0101, 8'b1111_0110, 8'b1111_0111
`define def_1111_10xx 8'b1111_1000, 8'b1111_1001, 8'b1111_1010, 8'b1111_1011
`define def_1111_11xx 8'b1111_1100, 8'b1111_1101, 8'b1111_1110, 8'b1111_1111
`define def_0001_xxxx `def_0001_00xx, `def_0001_01xx, `def_0001_10xx, `def_0001_11xx
`define def_0010_xxxx `def_0010_00xx, `def_0010_01xx, `def_0010_10xx, `def_0010_11xx
`define def_0011_xxxx `def_0011_00xx, `def_0011_01xx, `def_0011_10xx, `def_0011_11xx
`define def_0100_xxxx `def_0100_00xx, `def_0100_01xx, `def_0100_10xx, `def_0100_11xx
`define def_0101_xxxx `def_0101_00xx, `def_0101_01xx, `def_0101_10xx, `def_0101_11xx
`define def_0110_xxxx `def_0110_00xx, `def_0110_01xx, `def_0110_10xx, `def_0110_11xx
`define def_0111_xxxx `def_0111_00xx, `def_0111_01xx, `def_0111_10xx, `def_0111_11xx
`define def_1000_xxxx `def_1000_00xx, `def_1000_01xx, `def_1000_10xx, `def_1000_11xx
`define def_1001_xxxx `def_1001_00xx, `def_1001_01xx, `def_1001_10xx, `def_1001_11xx
`define def_1010_xxxx `def_1010_00xx, `def_1010_01xx, `def_1010_10xx, `def_1010_11xx
`define def_1011_xxxx `def_1011_00xx, `def_1011_01xx, `def_1011_10xx, `def_1011_11xx
`define def_1100_xxxx `def_1100_00xx, `def_1100_01xx, `def_1100_10xx, `def_1100_11xx
`define def_1101_xxxx `def_1101_00xx, `def_1101_01xx, `def_1101_10xx, `def_1101_11xx
`define def_1110_xxxx `def_1110_00xx, `def_1110_01xx, `def_1110_10xx, `def_1110_11xx
`define def_1111_xxxx `def_1111_00xx, `def_1111_01xx, `def_1111_10xx, `def_1111_11xx
`define def_1xxx_xxxx `def_1000_xxxx, `def_1001_xxxx, `def_1010_xxxx, `def_1011_xxxx, \
`def_1100_xxxx, `def_1101_xxxx, `def_1110_xxxx, `def_1111_xxxx
`define def_01xx_xxxx `def_0100_xxxx, `def_0101_xxxx, `def_0110_xxxx, `def_0111_xxxx
`define def_001x_xxxx `def_0010_xxxx, `def_0011_xxxx
module clz(
input wire [7:0] data_i,
output wire [6:0] out
);
// -----------------------------
// Reg declarations
// -----------------------------
reg [2:0] clz_byte0;
reg [2:0] clz_byte1;
reg [2:0] clz_byte2;
reg [2:0] clz_byte3;
always @*
case (data_i)
`def_1xxx_xxxx : clz_byte0 = 3'b000;
`def_01xx_xxxx : clz_byte0 = 3'b001;
`def_001x_xxxx : clz_byte0 = 3'b010;
`def_0001_xxxx : clz_byte0 = 3'b011;
`def_0000_1xxx : clz_byte0 = 3'b100;
`def_0000_01xx : clz_byte0 = 3'b101;
`def_0000_001x : clz_byte0 = 3'b110;
8'b0000_0001 : clz_byte0 = 3'b111;
8'b0000_0000 : clz_byte0 = 3'b111;
default : clz_byte0 = 3'bxxx;
endcase
always @*
case (data_i)
`def_1xxx_xxxx : clz_byte1 = 3'b000;
`def_01xx_xxxx : clz_byte1 = 3'b001;
`def_001x_xxxx : clz_byte1 = 3'b010;
`def_0001_xxxx : clz_byte1 = 3'b011;
`def_0000_1xxx : clz_byte1 = 3'b100;
`def_0000_01xx : clz_byte1 = 3'b101;
`def_0000_001x : clz_byte1 = 3'b110;
8'b0000_0001 : clz_byte1 = 3'b111;
8'b0000_0000 : clz_byte1 = 3'b111;
default : clz_byte1 = 3'bxxx;
endcase
always @*
case (data_i)
`def_1xxx_xxxx : clz_byte2 = 3'b000;
`def_01xx_xxxx : clz_byte2 = 3'b001;
`def_001x_xxxx : clz_byte2 = 3'b010;
`def_0001_xxxx : clz_byte2 = 3'b011;
`def_0000_1xxx : clz_byte2 = 3'b100;
`def_0000_01xx : clz_byte2 = 3'b101;
`def_0000_001x : clz_byte2 = 3'b110;
8'b0000_0001 : clz_byte2 = 3'b111;
8'b0000_0000 : clz_byte2 = 3'b111;
default : clz_byte2 = 3'bxxx;
endcase
always @*
case (data_i)
`def_1xxx_xxxx : clz_byte3 = 3'b000;
`def_01xx_xxxx : clz_byte3 = 3'b001;
`def_001x_xxxx : clz_byte3 = 3'b010;
`def_0001_xxxx : clz_byte3 = 3'b011;
`def_0000_1xxx : clz_byte3 = 3'b100;
`def_0000_01xx : clz_byte3 = 3'b101;
`def_0000_001x : clz_byte3 = 3'b110;
8'b0000_0001 : clz_byte3 = 3'b111;
8'b0000_0000 : clz_byte3 = 3'b111;
default : clz_byte3 = 3'bxxx;
endcase
assign out = {4'b0000, clz_byte1};
endmodule // clz
+16
View File
@@ -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.
# This is a compile only test.
compile (
v_flags2 => ["+verilog2001ext+v"],
);
ok(1);
1;
+51
View File
@@ -0,0 +1,51 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// A test of the +verilog1995ext+ and +verilog2001ext+ flags.
//
// This source code contains constructs that are valid in Verilog 2001 and
// SystemVerilog 2005/2009, but not in Verilog 1995. So it should fail if we
// set the language to be 1995, but not 2001.
//
// Compile only test, so no need for "All Finished" output.
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2012 by Jeremy Bennett.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
reg [1:0] res;
// Instantiate the test
test test_i (/*AUTOINST*/
// Outputs
.res (res),
// Inputs
.clk (clk),
.in (1'b1));
endmodule
module test (// Outputs
res,
// Inputs
clk,
in
);
output [1:0] res;
input clk;
input in;
// This is a Verilog 2001 test
generate
genvar i;
for (i=0; i<2; i=i+1) begin
always @(posedge clk) begin
res[i:i] <= in;
end
end
endgenerate
endmodule
+19
View File
@@ -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 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_langext_1.v");
# This is a compile only test.
compile (
v_flags2 => ["+verilog1995ext+v"],
fails => 1
);
ok(1);
1;
+16
View File
@@ -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.
# This is a compile only test.
compile (
v_flags2 => ["+systemverilogext+v"],
);
ok(1);
1;
+55
View File
@@ -0,0 +1,55 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// A test of the +1364-1995ext+ and +systemverilogext+ flags.
//
// This source code contains constructs that are valid in SystemVerilog 2009
// but not in Verilog 1995. So it should fail if we set the language to be
// Verilog 1995, but not SystemVerilog 2009.
//
// Compile only test, so no need for "All Finished" output.
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2012 by Jeremy Bennett.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
reg [1:0] res;
// Instantiate the test
test test_i (/*AUTOINST*/
// Outputs
.res (res),
// Inputs
.clk (clk),
.in (1'b1));
endmodule
module test (// Outputs
res,
// Inputs
clk,
in
);
output [1:0] res;
input clk;
input in;
// This is a SystemVerilog 2009 only test
generate
genvar i;
for (i=0; i<2; i=i+1) begin
always @(posedge clk) begin
unique0 case (i)
0: res[0:0] <= in;
1: res[1:1] <= in;
endcase
end
end
endgenerate
endmodule
+19
View File
@@ -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 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_langext_2.v");
# This is a compile only test.
compile (
v_flags2 => ["+1364-1995ext+v"],
fails => 1
);
ok(1);
1;
+16
View File
@@ -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.
# This is a compile only test.
compile (
v_flags2 => ["+1364-2005ext+v"],
);
ok(1);
1;
+21
View File
@@ -0,0 +1,21 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// A test of the +verilog2001ext+ and +verilog2005ext+ flags.
//
// This source code uses the uwire declaration, which is only valid in Verilog
// 2005.
//
// Compile only test, so no need for "All Finished" output.
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2012 by Jeremy Bennett.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
uwire w; // Only in Verilog 2005
endmodule
+19
View File
@@ -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 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_langext_3.v");
# This is a compile only test.
compile (
v_flags2 => ["+1364-2001ext+v"],
fails => 1
);
ok(1);
1;
+18
View File
@@ -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.
top_filename("t/t_langext_2.v");
# This is a compile only test.
compile (
v_flags2 => ["+1800-2009ext+v"],
);
ok(1);
1;
+19
View File
@@ -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 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_langext_2.v");
# This is a compile only test.
compile (
v_flags2 => ["+1800-2005ext+v"],
fails => 1
);
ok(1);
1;
+15
View File
@@ -0,0 +1,15 @@
#!/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 only test.
compile (
);
ok(1);
1;
+39
View File
@@ -0,0 +1,39 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// A test case for parameterized module.
//
// When a module is instantiatied with parameter, there will be two modules in
// the tree and eventually one will be removed after param and deadifyModules.
//
// This test is to check that the removal of dead module will not cause
// compilation error. Possible error was/is seen as:
//
// pure virtual method called
// terminate called without an active exception
// %Error: Verilator aborted. Consider trying --debug --gdbbt
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2012 by Jie Xu.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
wire [71:0] ctrl;
memory #(.words(72)) i_memory (.clk (clk));
assign ctrl = i_memory.mem[0];
endmodule
// memory module, which is used with parameter
module memory (clk);
input clk;
parameter words = 16384, bits = 72;
reg [bits-1 :0] mem[words-1 : 0];
endmodule