Add IMPERFECTSCH warning, disabled by default.

This commit is contained in:
Wilson Snyder 2008-08-05 13:41:53 -04:00
parent f1b7762bef
commit 2b63219cc6
6 changed files with 55 additions and 14 deletions

View File

@ -10,6 +10,8 @@ indicates the contributor was also the author of the fix; Thanks!
*** Add by-design and by-module subtotals to verilator_profcfunc.
**** Add IMPERFECTSCH warning, disabled by default.
* Verilator 3.670 2008/07/23
** Add --x-assign=fast option, and make it the default.

View File

@ -580,6 +580,10 @@ It is strongly recommended you cleanup your code rather than using this
option, it is only intended to be use when running test-cases of code
received from third parties.
=item -Wwarn-I<message>
Enables the specified warning message.
=item -x-assign 0
=item -x-assign 1
@ -1728,6 +1732,13 @@ additional ones.)
Ignoring this warning may make Verilator simulations differ from other
simulators.
=item IMPERFECTSCH
Warns that the scheduling of the model is not absolutely perfect, and some
manual code edits may result in faster performance. This warning defaults
to off, and must be turned on explicitly before the top module statement is
processed.
=item IMPLICIT
Warns that a wire is being implicitly declared (it is a single bit wide

View File

@ -63,6 +63,7 @@ private:
vscp->v3fatalSrc("Not applicable\n");
#endif
AstVar* varp = vscp->varp();
vscp->v3warn(IMPERFECTSCH,"Imperfect scheduling of variable: "<<vscp);
if (varp->arraysp()) {
vscp->v3error("Unsupported: Can't detect changes on arrayed variable (probably with UNOPTFLAT warning suppressed): "<<varp->prettyName());
} else {

View File

@ -65,6 +65,17 @@ V3ErrorCode::V3ErrorCode(const char* msgp) {
//######################################################################
// FileLine class functions
FileLine::FileLine(FileLine::EmptySecret) {
m_lineno=0;
m_filename="COMMAND_LINE";
m_warnOff=0;
for (int codei=V3ErrorCode::FIRST_WARN; codei<V3ErrorCode::MAX; codei++) {
V3ErrorCode code = (V3ErrorCode)codei;
if (code.defaultsOff()) warnOff(code, true);
}
}
void FileLine::lineDirective(const char* textp) {
// Handle `line directive
// Skip `line
@ -318,7 +329,9 @@ void V3Error::v3errorEnd (ostringstream& sstr) {
#ifdef __COVERITY__
if (s_errorCode==V3ErrorCode::FATAL) __coverity_panic__(x);
#endif
if (s_errorCode!=V3ErrorCode::SUPPRESS || debug()) {
if (s_errorCode!=V3ErrorCode::SUPPRESS
// On debug, show only non default-off warning to prevent pages of warnings
|| (debug() && !s_errorCode.defaultsOff())) {
cerr<<msgPrefix()<<sstr.str();
if (sstr.str()[sstr.str().length()-1] != '\n') {
cerr<<endl;

View File

@ -52,6 +52,7 @@ public:
COMBDLY, // Combinatorial delayed assignment
STMTDLY, // Delayed statement
GENCLK, // Generated Clock
IMPERFECTSCH, // Imperfect schedule (disabled by default)
IMPLICIT, // Implicit wire
IMPURE, // Impure function not being inlined
MULTIDRIVEN, // Driven from multiple blocks
@ -81,7 +82,7 @@ public:
" FIRST_WARN",
"BLKANDNBLK",
"CASEINCOMPLETE", "CASEOVERLAP", "CASEWITHX", "CASEX", "CMPCONST",
"COMBDLY", "STMTDLY", "GENCLK", "IMPLICIT", "IMPURE",
"COMBDLY", "STMTDLY", "GENCLK", "IMPERFECTSCH", "IMPLICIT", "IMPURE",
"MULTIDRIVEN", "REDEFMACRO",
"UNDRIVEN", "UNOPT", "UNOPTFLAT", "UNSIGNED", "UNUSED",
"VARHIDDEN", "WIDTH", "WIDTHCONCAT",
@ -89,6 +90,8 @@ public:
};
return names[m_e];
};
// Warnings that default to off
bool defaultsOff() const { return ( m_e==IMPERFECTSCH );};
// Warnings that warn about nasty side effects
bool dangerous() const { return ( m_e==COMBDLY );};
// Warnings we'll present to the user as errors
@ -207,7 +210,7 @@ protected:
public:
FileLine (const string& filename, int lineno) { m_lineno=lineno; m_filename = filename; m_warnOff=s_defaultFileLine.m_warnOff; }
FileLine (FileLine* fromp) { m_lineno=fromp->lineno(); m_filename = fromp->filename(); m_warnOff=fromp->m_warnOff; }
FileLine (EmptySecret) { m_lineno=0; m_filename="COMMAND_LINE"; m_warnOff=0; }
FileLine (EmptySecret);
~FileLine() { }
#ifdef VL_LEAK_CHECKS
static void* operator new(size_t size);

View File

@ -640,17 +640,6 @@ void V3Options::parseOptsList(FileLine* fl, int argc, char** argv) {
else if ( !strncmp (sw, "-U", 2)) {
V3PreShell::undef (string (sw+strlen("-U")));
}
else if ( !strncmp (sw, "-Wno-",5) ) {
if (!strcmp (sw, "-Wno-lint")) {
FileLine::defaultFileLine().warnLintOff(true);
}
else {
string msg = sw+strlen("-Wno-");
if (!(FileLine::defaultFileLine().warnOff(msg, true))) {
fl->v3fatal("Unknown warning disabled: "<<sw);
}
}
}
else if ( !strncmp (sw, "-Werror-",strlen("-Werror-")) ) {
string msg = sw+strlen("-Werror-");
V3ErrorCode code (msg.c_str());
@ -667,6 +656,28 @@ void V3Options::parseOptsList(FileLine* fl, int argc, char** argv) {
// Note it may not be a future option, but one that is currently implemented.
addFuture(msg);
}
else if ( !strncmp (sw, "-Wno-",5) ) {
if (!strcmp (sw, "-Wno-lint")) {
FileLine::defaultFileLine().warnLintOff(true);
}
else {
string msg = sw+strlen("-Wno-");
if (!(FileLine::defaultFileLine().warnOff(msg, true))) {
fl->v3fatal("Unknown warning specified: "<<sw);
}
}
}
else if ( !strncmp (sw, "-Wwarn-",5) ) {
if (!strcmp (sw, "-Wwarn-lint")) {
FileLine::defaultFileLine().warnLintOff(false);
}
else {
string msg = sw+strlen("-Wwarn-");
if (!(FileLine::defaultFileLine().warnOff(msg, false))) {
fl->v3fatal("Unknown warning specified: "<<sw);
}
}
}
else if ( !strcmp (sw, "-bin") && (i+1)<argc ) {
shift; m_bin = argv[i];
}