Allow wildcards in vlt config files
This commit is contained in:
parent
d261c4cd27
commit
dce245da5a
|
|
@ -1548,20 +1548,22 @@ Verilator configuration commands.
|
||||||
|
|
||||||
=item coverage_off [-file "<filename>" [-lines <line> [ - <line> ]]]
|
=item coverage_off [-file "<filename>" [-lines <line> [ - <line> ]]]
|
||||||
|
|
||||||
Disable coverage for the specified filename (or all files if omitted) and
|
Disable coverage for the specified filename (or wildcard with '*' or '?',
|
||||||
range of line numbers (or all lines if omitted). Often used to ignore an
|
or all files if omitted) and range of line numbers (or all lines if
|
||||||
entire module for coverage analysis purposes.
|
omitted). Often used to ignore an entire module for coverage analysis
|
||||||
|
purposes.
|
||||||
|
|
||||||
=item lint_off -msg <message> [-file "<filename>" [-lines <line> [ - <line>]]]
|
=item lint_off -msg <message> [-file "<filename>" [-lines <line> [ - <line>]]]
|
||||||
|
|
||||||
Disables the specified lint warning in the specified filename (or all files
|
Disables the specified lint warning in the specified filename (or wildcard
|
||||||
if omitted) and range of line numbers (or all lines if omitted).
|
with '*' or '?', or all files if omitted) and range of line numbers (or all
|
||||||
|
lines if omitted).
|
||||||
|
|
||||||
=item tracing_off [-file "<filename>" [-lines <line> [ - <line> ]]]
|
=item tracing_off [-file "<filename>" [-lines <line> [ - <line> ]]]
|
||||||
|
|
||||||
Disable waveform tracing for all future signals declared in the specified
|
Disable waveform tracing for all future signals declared in the specified
|
||||||
filename (or all files if omitted) and range of line numbers (or all lines
|
filename (or wildcard with '*' or '?', or all files if omitted) and range
|
||||||
if omitted).
|
of line numbers (or all lines if omitted).
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,8 @@ class V3ConfigIgnores {
|
||||||
IgnLines::const_iterator m_lastIt; // Point with next linenumber > current line number
|
IgnLines::const_iterator m_lastIt; // Point with next linenumber > current line number
|
||||||
IgnLines::const_iterator m_lastEnd; // Point with end()
|
IgnLines::const_iterator m_lastEnd; // Point with end()
|
||||||
|
|
||||||
IgnFiles m_ignFiles; // Ignores for each filename
|
IgnFiles m_ignWilds; // Ignores for each wildcarded filename
|
||||||
|
IgnFiles m_ignFiles; // Ignores for each non-wildcarded filename
|
||||||
|
|
||||||
static V3ConfigIgnores s_singleton; // Singleton (not via local static, as that's slow)
|
static V3ConfigIgnores s_singleton; // Singleton (not via local static, as that's slow)
|
||||||
|
|
||||||
|
|
@ -68,13 +69,13 @@ class V3ConfigIgnores {
|
||||||
~V3ConfigIgnores() {}
|
~V3ConfigIgnores() {}
|
||||||
|
|
||||||
// METHODS
|
// METHODS
|
||||||
inline IgnLines* findLines(const string& filename) {
|
inline IgnLines* findWilds(const string& wildname) {
|
||||||
IgnFiles::iterator it = m_ignFiles.find(filename);
|
IgnFiles::iterator it = m_ignWilds.find(wildname);
|
||||||
if (it != m_ignFiles.end()) {
|
if (it != m_ignWilds.end()) {
|
||||||
return &(it->second);
|
return &(it->second);
|
||||||
} else {
|
} else {
|
||||||
m_ignFiles.insert(make_pair(filename, IgnLines()));
|
m_ignWilds.insert(make_pair(wildname, IgnLines()));
|
||||||
it = m_ignFiles.find(filename);
|
it = m_ignWilds.find(wildname);
|
||||||
return &(it->second);
|
return &(it->second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -82,23 +83,35 @@ class V3ConfigIgnores {
|
||||||
// Given a filename, find all wildcard matches against it and build
|
// Given a filename, find all wildcard matches against it and build
|
||||||
// hash with the specific filename. This avoids having to wildmatch
|
// hash with the specific filename. This avoids having to wildmatch
|
||||||
// more than once against any filename.
|
// more than once against any filename.
|
||||||
IgnLines* linesp = findLines(filename);
|
IgnFiles::iterator it = m_ignFiles.find(filename);
|
||||||
m_lastIt = linesp->begin();
|
if (it == m_ignFiles.end()) {
|
||||||
m_lastEnd = linesp->end();
|
// Haven't seen this filename before
|
||||||
|
m_ignFiles.insert(make_pair(filename, IgnLines()));
|
||||||
|
it = m_ignFiles.find(filename);
|
||||||
|
// Make new list for this file of all matches
|
||||||
|
for (IgnFiles::iterator fnit = m_ignWilds.begin(); fnit != m_ignWilds.end(); ++fnit) {
|
||||||
|
if (V3Options::wildmatch(filename.c_str(), fnit->first.c_str())) {
|
||||||
|
for (IgnLines::iterator lit = fnit->second.begin(); lit != fnit->second.end(); ++lit) {
|
||||||
|
it->second.insert(*lit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_lastIt = it->second.begin();
|
||||||
|
m_lastEnd = it->second.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inline static V3ConfigIgnores& singleton() { return s_singleton; }
|
inline static V3ConfigIgnores& singleton() { return s_singleton; }
|
||||||
|
|
||||||
void addIgnore(V3ErrorCode code, string filename, int lineno, bool on) {
|
void addIgnore(V3ErrorCode code, string wildname, int lineno, bool on) {
|
||||||
// Insert
|
// Insert
|
||||||
IgnLines* linesp = findLines(filename);
|
IgnLines* linesp = findWilds(wildname);
|
||||||
UINFO(9,"config addIgnore "<<filename<<":"<<lineno<<", "<<code<<", "<<on<<endl);
|
UINFO(9,"config addIgnore "<<wildname<<":"<<lineno<<", "<<code<<", "<<on<<endl);
|
||||||
linesp->insert(V3ConfigLine(code, lineno, on));
|
linesp->insert(V3ConfigLine(code, lineno, on));
|
||||||
if (m_lastFilename == filename) {
|
// Flush the match cache, due to a change in the rules.
|
||||||
// Flush the match cache, due to a change in the rules.
|
m_ignFiles.clear();
|
||||||
m_lastFilename = " ";
|
m_lastFilename = " ";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
inline void applyIgnores(FileLine* filelinep) {
|
inline void applyIgnores(FileLine* filelinep) {
|
||||||
// HOT routine, called each parsed token line
|
// HOT routine, called each parsed token line
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,8 @@
|
||||||
|
|
||||||
lint_off -msg CASEINCOMPLETE -file "t/t_vlt_warn.v"
|
lint_off -msg CASEINCOMPLETE -file "t/t_vlt_warn.v"
|
||||||
lint_off -msg WIDTH -file "t/t_vlt_warn.v" -lines 18
|
lint_off -msg WIDTH -file "t/t_vlt_warn.v" -lines 18
|
||||||
lint_off -msg WIDTH -file "t/t_vlt_warn.v" -lines 19-19
|
// Test wildcard filenames
|
||||||
|
lint_off -msg WIDTH -file "*/t_vlt_warn.v" -lines 19-19
|
||||||
|
|
||||||
coverage_off -file "t/t_vlt_warn.v"
|
coverage_off -file "t/t_vlt_warn.v"
|
||||||
// Test --flag is also accepted
|
// Test --flag is also accepted
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue