Internals: clang-format cleanup. No functional change.
This commit is contained in:
parent
dcde026bac
commit
aef2b7ea3c
|
|
@ -32,6 +32,7 @@ class UnrollStateful {
|
||||||
// MEMBERS
|
// MEMBERS
|
||||||
UnrollVisitor* m_unrollerp;
|
UnrollVisitor* m_unrollerp;
|
||||||
VL_UNCOPYABLE(UnrollStateful);
|
VL_UNCOPYABLE(UnrollStateful);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// CONSTRUCTORS
|
// CONSTRUCTORS
|
||||||
UnrollStateful();
|
UnrollStateful();
|
||||||
|
|
|
||||||
|
|
@ -37,13 +37,11 @@
|
||||||
//######################################################################
|
//######################################################################
|
||||||
// VlcOptions
|
// VlcOptions
|
||||||
|
|
||||||
void VlcOptions::addReadFile(const string& filename) {
|
void VlcOptions::addReadFile(const string& filename) { m_readFiles.insert(filename); }
|
||||||
m_readFiles.insert(filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
string VlcOptions::version() {
|
string VlcOptions::version() {
|
||||||
string ver = DTVERSION;
|
string ver = DTVERSION;
|
||||||
ver += " rev "+cvtToStr(DTVERSION_rev);
|
ver += " rev " + cvtToStr(DTVERSION_rev);
|
||||||
return ver;
|
return ver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -52,10 +50,17 @@ bool VlcOptions::onoff(const char* sw, const char* arg, bool& flag) {
|
||||||
// if sw=="-no-arg", then return true (found it), and flag=false
|
// if sw=="-no-arg", then return true (found it), and flag=false
|
||||||
// if sw=="-noarg", then return true (found it), and flag=false
|
// if sw=="-noarg", then return true (found it), and flag=false
|
||||||
// else return false
|
// else return false
|
||||||
if (arg[0]!='-') v3fatalSrc("OnOff switches must have leading dash.");
|
if (arg[0] != '-') v3fatalSrc("OnOff switches must have leading dash.");
|
||||||
if (0==strcmp(sw, arg)) { flag = true; return true; }
|
if (0 == strcmp(sw, arg)) {
|
||||||
else if (0==strncmp(sw, "-no", 3) && (0==strcmp(sw+3, arg+1))) { flag = false; return true; }
|
flag = true;
|
||||||
else if (0==strncmp(sw, "-no-", 4) && (0==strcmp(sw+4, arg+1))) { flag = false; return true; }
|
return true;
|
||||||
|
} else if (0 == strncmp(sw, "-no", 3) && (0 == strcmp(sw + 3, arg + 1))) {
|
||||||
|
flag = false;
|
||||||
|
return true;
|
||||||
|
} else if (0 == strncmp(sw, "-no-", 4) && (0 == strcmp(sw + 4, arg + 1))) {
|
||||||
|
flag = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -64,57 +69,52 @@ void VlcOptions::parseOptsList(int argc, char** argv) {
|
||||||
// Note argc and argv DO NOT INCLUDE the filename in [0]!!!
|
// Note argc and argv DO NOT INCLUDE the filename in [0]!!!
|
||||||
// May be called recursively when there are -f files.
|
// May be called recursively when there are -f files.
|
||||||
#define shift { ++i; }
|
#define shift { ++i; }
|
||||||
for (int i=0; i<argc; ) {
|
for (int i = 0; i < argc;) {
|
||||||
UINFO(9, " Option: "<<argv[i]<<endl);
|
UINFO(9, " Option: " << argv[i] << endl);
|
||||||
if (argv[i][0]=='-') {
|
if (argv[i][0] == '-') {
|
||||||
const char* sw = argv[i];
|
const char* sw = argv[i];
|
||||||
bool flag = true;
|
bool flag = true;
|
||||||
// Allow gnu -- switches
|
// Allow gnu -- switches
|
||||||
if (sw[0]=='-' && sw[1]=='-') ++sw;
|
if (sw[0] == '-' && sw[1] == '-') ++sw;
|
||||||
if (0) {}
|
|
||||||
// Single switches
|
// Single switches
|
||||||
else if (onoff (sw, "-annotate-all", flag/*ref*/) ) { m_annotateAll = flag; }
|
else if (onoff(sw, "-annotate-all", flag /*ref*/)) {
|
||||||
else if (onoff (sw, "-rank", flag/*ref*/) ) { m_rank = flag; }
|
m_annotateAll = flag;
|
||||||
else if (onoff (sw, "-unlink", flag/*ref*/) ) { m_unlink = flag; }
|
} else if (onoff(sw, "-rank", flag /*ref*/)) {
|
||||||
|
m_rank = flag;
|
||||||
|
} else if (onoff(sw, "-unlink", flag /*ref*/)) {
|
||||||
|
m_unlink = flag;
|
||||||
|
}
|
||||||
// Parameterized switches
|
// Parameterized switches
|
||||||
else if (!strcmp(sw, "-annotate-min") && (i+1)<argc ) {
|
else if (!strcmp(sw, "-annotate-min") && (i + 1) < argc) {
|
||||||
shift;
|
shift;
|
||||||
m_annotateMin = atoi(argv[i]);
|
m_annotateMin = atoi(argv[i]);
|
||||||
}
|
} else if (!strcmp(sw, "-annotate") && (i + 1) < argc) {
|
||||||
else if (!strcmp(sw, "-annotate") && (i+1)<argc ) {
|
|
||||||
shift;
|
shift;
|
||||||
m_annotateOut = argv[i];
|
m_annotateOut = argv[i];
|
||||||
}
|
} else if (!strcmp(sw, "-debug")) {
|
||||||
else if (!strcmp(sw, "-debug") ) {
|
|
||||||
V3Error::debugDefault(3);
|
V3Error::debugDefault(3);
|
||||||
}
|
} else if (!strcmp(sw, "-debugi") && (i + 1) < argc) {
|
||||||
else if (!strcmp(sw, "-debugi") && (i+1)<argc ) {
|
|
||||||
shift;
|
shift;
|
||||||
V3Error::debugDefault(atoi(argv[i]));
|
V3Error::debugDefault(atoi(argv[i]));
|
||||||
}
|
} else if (!strcmp(sw, "-V")) {
|
||||||
else if (!strcmp(sw, "-V") ) {
|
|
||||||
showVersion(true);
|
showVersion(true);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
} else if (!strcmp(sw, "-version")) {
|
||||||
else if (!strcmp(sw, "-version") ) {
|
|
||||||
showVersion(false);
|
showVersion(false);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
} else if (!strcmp(sw, "-write") && (i + 1) < argc) {
|
||||||
else if (!strcmp(sw, "-write") && (i+1)<argc ) {
|
|
||||||
shift;
|
shift;
|
||||||
m_writeFile = argv[i];
|
m_writeFile = argv[i];
|
||||||
}
|
} else {
|
||||||
else {
|
v3fatal("Invalid option: " << argv[i]);
|
||||||
v3fatal("Invalid option: "<<argv[i]);
|
|
||||||
}
|
}
|
||||||
shift;
|
shift;
|
||||||
} // - options
|
} // - options
|
||||||
else if (1) {
|
else if (1) {
|
||||||
addReadFile(argv[i]);
|
addReadFile(argv[i]);
|
||||||
shift;
|
shift;
|
||||||
}
|
} else {
|
||||||
else {
|
v3fatal("Invalid argument: " << argv[i]);
|
||||||
v3fatal("Invalid argument: "<<argv[i]);
|
|
||||||
shift;
|
shift;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -122,17 +122,17 @@ void VlcOptions::parseOptsList(int argc, char** argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void VlcOptions::showVersion(bool verbose) {
|
void VlcOptions::showVersion(bool verbose) {
|
||||||
cout <<version();
|
cout << version();
|
||||||
cout <<endl;
|
cout << endl;
|
||||||
if (!verbose) return;
|
if (!verbose) return;
|
||||||
|
|
||||||
cout <<endl;
|
cout << endl;
|
||||||
cout << "Copyright 2003-2020 by Wilson Snyder. Verilator is free software; you can\n";
|
cout << "Copyright 2003-2020 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 << "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 << "either the GNU Lesser General Public License Version 3 or the Perl Artistic\n";
|
||||||
cout << "License Version 2.0.\n";
|
cout << "License Version 2.0.\n";
|
||||||
|
|
||||||
cout <<endl;
|
cout << endl;
|
||||||
cout << "See https://verilator.org for documentation\n";
|
cout << "See https://verilator.org for documentation\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -145,11 +145,9 @@ int main(int argc, char** argv, char** env) {
|
||||||
VlcTop top;
|
VlcTop top;
|
||||||
|
|
||||||
// Command option parsing
|
// Command option parsing
|
||||||
top.opt.parseOptsList(argc-1, argv+1);
|
top.opt.parseOptsList(argc - 1, argv + 1);
|
||||||
|
|
||||||
if (top.opt.readFiles().empty()) {
|
if (top.opt.readFiles().empty()) top.opt.addReadFile("vlt_coverage.dat");
|
||||||
top.opt.addReadFile("vlt_coverage.dat");
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
const VlStringSet& readFiles = top.opt.readFiles();
|
const VlStringSet& readFiles = top.opt.readFiles();
|
||||||
|
|
@ -165,9 +163,7 @@ int main(int argc, char** argv, char** env) {
|
||||||
}
|
}
|
||||||
|
|
||||||
V3Error::abortIfWarnings();
|
V3Error::abortIfWarnings();
|
||||||
if (!top.opt.annotateOut().empty()) {
|
if (!top.opt.annotateOut().empty()) top.annotate(top.opt.annotateOut());
|
||||||
top.annotate(top.opt.annotateOut());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (top.opt.rank()) {
|
if (top.opt.rank()) {
|
||||||
top.rank();
|
top.rank();
|
||||||
|
|
@ -189,7 +185,7 @@ int main(int argc, char** argv, char** env) {
|
||||||
// Final writing shouldn't throw warnings, but...
|
// Final writing shouldn't throw warnings, but...
|
||||||
V3Error::abortIfWarnings();
|
V3Error::abortIfWarnings();
|
||||||
|
|
||||||
UINFO(1,"Done, Exiting...\n");
|
UINFO(1, "Done, Exiting...\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Local Variables:
|
// Local Variables:
|
||||||
|
|
|
||||||
|
|
@ -26,11 +26,11 @@
|
||||||
//######################################################################
|
//######################################################################
|
||||||
|
|
||||||
void VlcTop::readCoverage(const string& filename, bool nonfatal) {
|
void VlcTop::readCoverage(const string& filename, bool nonfatal) {
|
||||||
UINFO(2,"readCoverage "<<filename<<endl);
|
UINFO(2, "readCoverage " << filename << endl);
|
||||||
|
|
||||||
std::ifstream is(filename.c_str());
|
std::ifstream is(filename.c_str());
|
||||||
if (!is) {
|
if (!is) {
|
||||||
if (!nonfatal) v3fatal("Can't read "<<filename);
|
if (!nonfatal) v3fatal("Can't read " << filename);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -39,15 +39,15 @@ void VlcTop::readCoverage(const string& filename, bool nonfatal) {
|
||||||
|
|
||||||
while (!is.eof()) {
|
while (!is.eof()) {
|
||||||
string line = V3Os::getline(is);
|
string line = V3Os::getline(is);
|
||||||
//UINFO(9," got "<<line<<endl);
|
// UINFO(9," got "<<line<<endl);
|
||||||
if (line[0] == 'C') {
|
if (line[0] == 'C') {
|
||||||
string::size_type secspace = 3;
|
string::size_type secspace = 3;
|
||||||
for (; secspace<line.length(); secspace++) {
|
for (; secspace < line.length(); secspace++) {
|
||||||
if (line[secspace]=='\'' && line[secspace+1]==' ') break;
|
if (line[secspace] == '\'' && line[secspace + 1] == ' ') break;
|
||||||
}
|
}
|
||||||
string point = line.substr(3, secspace-3);
|
string point = line.substr(3, secspace - 3);
|
||||||
vluint64_t hits = atoll(line.c_str()+secspace+1);
|
vluint64_t hits = atoll(line.c_str() + secspace + 1);
|
||||||
//UINFO(9," point '"<<point<<"'"<<" "<<hits<<endl);
|
// UINFO(9," point '"<<point<<"'"<<" "<<hits<<endl);
|
||||||
|
|
||||||
vluint64_t pointnum = points().findAddPoint(point, hits);
|
vluint64_t pointnum = points().findAddPoint(point, hits);
|
||||||
if (pointnum) {} // Prevent unused
|
if (pointnum) {} // Prevent unused
|
||||||
|
|
@ -62,25 +62,25 @@ void VlcTop::readCoverage(const string& filename, bool nonfatal) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void VlcTop::writeCoverage(const string& filename) {
|
void VlcTop::writeCoverage(const string& filename) {
|
||||||
UINFO(2,"writeCoverage "<<filename<<endl);
|
UINFO(2, "writeCoverage " << filename << endl);
|
||||||
|
|
||||||
std::ofstream os(filename.c_str());
|
std::ofstream os(filename.c_str());
|
||||||
if (!os) {
|
if (!os) {
|
||||||
v3fatal("Can't write "<<filename);
|
v3fatal("Can't write " << filename);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
os << "# SystemC::Coverage-3" << endl;
|
os << "# SystemC::Coverage-3" << endl;
|
||||||
for (VlcPoints::ByName::const_iterator it = m_points.begin(); it != m_points.end(); ++it) {
|
for (VlcPoints::ByName::const_iterator it = m_points.begin(); it != m_points.end(); ++it) {
|
||||||
const VlcPoint& point = m_points.pointNumber(it->second);
|
const VlcPoint& point = m_points.pointNumber(it->second);
|
||||||
os <<"C '"<<point.name()<<"' " << point.count()<<endl;
|
os << "C '" << point.name() << "' " << point.count() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//********************************************************************
|
//********************************************************************
|
||||||
|
|
||||||
struct CmpComputrons {
|
struct CmpComputrons {
|
||||||
inline bool operator() (const VlcTest* lhsp, const VlcTest* rhsp) const {
|
inline bool operator()(const VlcTest* lhsp, const VlcTest* rhsp) const {
|
||||||
if (lhsp->computrons() != rhsp->computrons()) {
|
if (lhsp->computrons() != rhsp->computrons()) {
|
||||||
return lhsp->computrons() < rhsp->computrons();
|
return lhsp->computrons() < rhsp->computrons();
|
||||||
}
|
}
|
||||||
|
|
@ -89,7 +89,7 @@ struct CmpComputrons {
|
||||||
};
|
};
|
||||||
|
|
||||||
void VlcTop::rank() {
|
void VlcTop::rank() {
|
||||||
UINFO(2,"rank...\n");
|
UINFO(2, "rank...\n");
|
||||||
vluint64_t nextrank = 1;
|
vluint64_t nextrank = 1;
|
||||||
|
|
||||||
// Sort by computrons, so fast tests get selected first
|
// Sort by computrons, so fast tests get selected first
|
||||||
|
|
@ -106,7 +106,7 @@ void VlcTop::rank() {
|
||||||
for (VlcPoints::ByName::const_iterator it = m_points.begin(); it != m_points.end(); ++it) {
|
for (VlcPoints::ByName::const_iterator it = m_points.begin(); it != m_points.end(); ++it) {
|
||||||
VlcPoint* pointp = &points().pointNumber(it->second);
|
VlcPoint* pointp = &points().pointNumber(it->second);
|
||||||
// If any tests hit this point, then we'll need to cover it.
|
// If any tests hit this point, then we'll need to cover it.
|
||||||
if (pointp->testsCovering()) { remaining.addData(pointp->pointNum(), 1); }
|
if (pointp->testsCovering()) remaining.addData(pointp->pointNum(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Additional Greedy algorithm
|
// Additional Greedy algorithm
|
||||||
|
|
@ -114,10 +114,10 @@ void VlcTop::rank() {
|
||||||
// then hierarchically solve a small subset of tests, and take resulting
|
// then hierarchically solve a small subset of tests, and take resulting
|
||||||
// solution and move up to larger subset of tests. (Aka quick sort.)
|
// solution and move up to larger subset of tests. (Aka quick sort.)
|
||||||
while (1) {
|
while (1) {
|
||||||
if (debug()) { UINFO(9,"Left on iter"<<nextrank<<": "); remaining.dump(); }
|
if (debug()) { UINFO(9, "Left on iter" << nextrank << ": "); remaining.dump(); }
|
||||||
VlcTest* bestTestp = NULL;
|
VlcTest* bestTestp = NULL;
|
||||||
vluint64_t bestRemain = 0;
|
vluint64_t bestRemain = 0;
|
||||||
for (std::vector<VlcTest*>::iterator it=bytime.begin(); it!=bytime.end(); ++it) {
|
for (std::vector<VlcTest*>::iterator it = bytime.begin(); it != bytime.end(); ++it) {
|
||||||
VlcTest* testp = *it;
|
VlcTest* testp = *it;
|
||||||
if (!testp->rank()) {
|
if (!testp->rank()) {
|
||||||
vluint64_t remain = testp->buckets().dataPopCount(remaining);
|
vluint64_t remain = testp->buckets().dataPopCount(remaining);
|
||||||
|
|
@ -145,13 +145,13 @@ void VlcTop::annotateCalc() {
|
||||||
const VlcPoint& point = m_points.pointNumber(it->second);
|
const VlcPoint& point = m_points.pointNumber(it->second);
|
||||||
string filename = point.filename();
|
string filename = point.filename();
|
||||||
int lineno = point.lineno();
|
int lineno = point.lineno();
|
||||||
if (!filename.empty() && lineno!=0) {
|
if (!filename.empty() && lineno != 0) {
|
||||||
int column = point.column();
|
int column = point.column();
|
||||||
VlcSource& source = sources().findNewSource(filename);
|
VlcSource& source = sources().findNewSource(filename);
|
||||||
string threshStr = point.thresh();
|
string threshStr = point.thresh();
|
||||||
unsigned thresh = (!threshStr.empty()) ? atoi(threshStr.c_str()) : opt.annotateMin();
|
unsigned thresh = (!threshStr.empty()) ? atoi(threshStr.c_str()) : opt.annotateMin();
|
||||||
bool ok = (point.count() >= thresh);
|
bool ok = (point.count() >= thresh);
|
||||||
UINFO(9, "AnnoCalc count "<<filename<<" "<<lineno<<" "<<point.count()<<endl);
|
UINFO(9, "AnnoCalc count " << filename << " " << lineno << " " << point.count() << endl);
|
||||||
source.incCount(lineno, column, point.count(), ok);
|
source.incCount(lineno, column, point.count(), ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -162,17 +162,16 @@ void VlcTop::annotateCalcNeeded() {
|
||||||
// coverage in all categories
|
// coverage in all categories
|
||||||
int totCases = 0;
|
int totCases = 0;
|
||||||
int totOk = 0;
|
int totOk = 0;
|
||||||
for (VlcSources::NameMap::iterator sit=m_sources.begin(); sit!=m_sources.end(); ++sit) {
|
for (VlcSources::NameMap::iterator sit = m_sources.begin(); sit != m_sources.end(); ++sit) {
|
||||||
VlcSource& source = sit->second;
|
VlcSource& source = sit->second;
|
||||||
//UINFO(1,"Source "<<source.name()<<endl);
|
// UINFO(1,"Source "<<source.name()<<endl);
|
||||||
if (opt.annotateAll()) source.needed(true);
|
if (opt.annotateAll()) source.needed(true);
|
||||||
VlcSource::LinenoMap& lines = source.lines();
|
VlcSource::LinenoMap& lines = source.lines();
|
||||||
for (VlcSource::LinenoMap::iterator lit = lines.begin(); lit != lines.end(); ++lit) {
|
for (VlcSource::LinenoMap::iterator lit = lines.begin(); lit != lines.end(); ++lit) {
|
||||||
VlcSource::ColumnMap& cmap = lit->second;
|
VlcSource::ColumnMap& cmap = lit->second;
|
||||||
for (VlcSource::ColumnMap::iterator cit = cmap.begin(); cit != cmap.end();
|
for (VlcSource::ColumnMap::iterator cit = cmap.begin(); cit != cmap.end(); ++cit) {
|
||||||
++cit) {
|
|
||||||
VlcSourceCount& col = cit->second;
|
VlcSourceCount& col = cit->second;
|
||||||
//UINFO(0,"Source "<<source.name()<<":"<<col.lineno()<<":"<<col.column()<<endl);
|
// UINFO(0,"Source "<<source.name()<<":"<<col.lineno()<<":"<<col.column()<<endl);
|
||||||
++totCases;
|
++totCases;
|
||||||
if (col.ok()) {
|
if (col.ok()) {
|
||||||
++totOk;
|
++totOk;
|
||||||
|
|
@ -182,36 +181,36 @@ void VlcTop::annotateCalcNeeded() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
float pct = totCases ? (100*totOk / totCases) : 0;
|
float pct = totCases ? (100 * totOk / totCases) : 0;
|
||||||
cout<<"Total coverage ("<<totOk<<"/"<<totCases<<") "
|
cout << "Total coverage (" << totOk << "/" << totCases << ") ";
|
||||||
<<std::fixed<<std::setw(3)<<std::setprecision(2)<<pct<<"%"<<endl;
|
cout << std::fixed << std::setw(3) << std::setprecision(2) << pct << "%" << endl;
|
||||||
if (totOk != totCases) cout<<"See lines with '%00' in "<<opt.annotateOut()<<endl;
|
if (totOk != totCases) cout << "See lines with '%00' in " << opt.annotateOut() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VlcTop::annotateOutputFiles(const string& dirname) {
|
void VlcTop::annotateOutputFiles(const string& dirname) {
|
||||||
// Create if uncreated, ignore errors
|
// Create if uncreated, ignore errors
|
||||||
V3Os::createDir(dirname);
|
V3Os::createDir(dirname);
|
||||||
for (VlcSources::NameMap::iterator sit=m_sources.begin(); sit!=m_sources.end(); ++sit) {
|
for (VlcSources::NameMap::iterator sit = m_sources.begin(); sit != m_sources.end(); ++sit) {
|
||||||
VlcSource& source = sit->second;
|
VlcSource& source = sit->second;
|
||||||
if (!source.needed()) continue;
|
if (!source.needed()) continue;
|
||||||
string filename = source.name();
|
string filename = source.name();
|
||||||
string outfilename = dirname+"/"+V3Os::filenameNonDir(filename);
|
string outfilename = dirname + "/" + V3Os::filenameNonDir(filename);
|
||||||
|
|
||||||
UINFO(1,"annotateOutputFile "<<filename<<" -> "<<outfilename<<endl);
|
UINFO(1, "annotateOutputFile " << filename << " -> " << outfilename << endl);
|
||||||
|
|
||||||
std::ifstream is(filename.c_str());
|
std::ifstream is(filename.c_str());
|
||||||
if (!is) {
|
if (!is) {
|
||||||
v3error("Can't read "<<filename);
|
v3error("Can't read " << filename);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ofstream os(outfilename.c_str());
|
std::ofstream os(outfilename.c_str());
|
||||||
if (!os) {
|
if (!os) {
|
||||||
v3fatal("Can't write "<<outfilename);
|
v3fatal("Can't write " << outfilename);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
os << "\t// verilator_coverage annotation"<<endl;
|
os << "\t// verilator_coverage annotation" << endl;
|
||||||
|
|
||||||
int lineno = 0;
|
int lineno = 0;
|
||||||
while (!is.eof()) {
|
while (!is.eof()) {
|
||||||
|
|
@ -221,22 +220,21 @@ void VlcTop::annotateOutputFiles(const string& dirname) {
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
VlcSource::LinenoMap& lines = source.lines();
|
VlcSource::LinenoMap& lines = source.lines();
|
||||||
VlcSource::LinenoMap::iterator lit=lines.find(lineno);
|
VlcSource::LinenoMap::iterator lit = lines.find(lineno);
|
||||||
if (lit != lines.end()) {
|
if (lit != lines.end()) {
|
||||||
VlcSource::ColumnMap& cmap = lit->second;
|
VlcSource::ColumnMap& cmap = lit->second;
|
||||||
for (VlcSource::ColumnMap::iterator cit = cmap.begin(); cit != cmap.end();
|
for (VlcSource::ColumnMap::iterator cit = cmap.begin(); cit != cmap.end(); ++cit) {
|
||||||
++cit) {
|
|
||||||
VlcSourceCount& col = cit->second;
|
VlcSourceCount& col = cit->second;
|
||||||
//UINFO(0,"Source "<<source.name()<<":"<<col.lineno()<<":"<<col.column()<<endl);
|
// UINFO(0,"Source
|
||||||
os<<(col.ok()?" ":"%")
|
// "<<source.name()<<":"<<col.lineno()<<":"<<col.column()<<endl);
|
||||||
<<std::setfill('0')<<std::setw(6)<<col.count()
|
os << (col.ok() ? " " : "%") << std::setfill('0') << std::setw(6)
|
||||||
<<"\t"<<line<<endl;
|
<< col.count() << "\t" << line << endl;
|
||||||
if (first) {
|
if (first) {
|
||||||
first = false;
|
first = false;
|
||||||
// Multiple columns on same line; print line just once
|
// Multiple columns on same line; print line just once
|
||||||
string indent;
|
string indent;
|
||||||
for (string::const_iterator pos=line.begin();
|
for (string::const_iterator pos = line.begin();
|
||||||
pos!=line.end() && isspace(*pos); ++pos) {
|
pos != line.end() && isspace(*pos); ++pos) {
|
||||||
indent += *pos;
|
indent += *pos;
|
||||||
}
|
}
|
||||||
line = indent + "verilator_coverage: (next point on previous line)\n";
|
line = indent + "verilator_coverage: (next point on previous line)\n";
|
||||||
|
|
@ -244,9 +242,7 @@ void VlcTop::annotateOutputFiles(const string& dirname) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (first) {
|
if (first) os << "\t" << line << endl;
|
||||||
os<<"\t"<<line<<endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue