Use newline instead of endl, for fewer stream flushes

This commit is contained in:
Wilson Snyder 2023-11-24 11:45:52 -05:00
parent fae7f11222
commit 58d9a5ebac
11 changed files with 57 additions and 57 deletions

View File

@ -211,7 +211,7 @@ private:
std::string result = prefix + "*" + suffix;
// std::cout << "\nch pre=" << prefix << " s=" << suffix << "\nch a="
// << old << "\nch b=" << add << "\ncho=" << result << std::endl;
// << old << "\nch b=" << add << "\ncho=" << result << "\n";
return result;
}
bool itemMatchesString(VerilatedCovImpItem* itemp, const std::string& match)
@ -337,7 +337,7 @@ public:
const std::string key = keys[i];
if (!keys[i].empty()) {
const std::string val = valps[i];
// std::cout << " " << __FUNCTION__ << " " << key << " = " << val << std::endl;
// std::cout << " " << __FUNCTION__ << " " << key << " = " << val << "\n";
m_insertp->m_keys[addKeynum] = valueIndex(key);
m_insertp->m_vals[addKeynum] = valueIndex(val);
++addKeynum;

View File

@ -31,7 +31,7 @@
#if 0
# include <iostream>
# define VL_TRACE_OFFLOAD_DEBUG(msg) std::cout << "TRACE OFFLOAD THREAD: " << msg << std::endl
# define VL_TRACE_OFFLOAD_DEBUG(msg) std::cout << "TRACE OFFLOAD THREAD: " << msg << "\n"
#else
# define VL_TRACE_OFFLOAD_DEBUG(msg)
#endif

View File

@ -1237,7 +1237,7 @@ void AstNode::dumpPtrs(std::ostream& os) const {
// This may cause address sanitizer failures as iterpp can be stale
// os << "*=" << cvtToHex(*m_iterpp);
}
os << std::endl;
os << "\n";
}
void AstNode::dumpTree(std::ostream& os, const string& indent, int maxDepth) const {

View File

@ -768,16 +768,16 @@ public:
if (needsCleaning) ++resultOps;
if (debug() >= 9) { // LCOV_EXCL_START
cout << "- Bitop tree considered: " << endl;
cout << "- Bitop tree considered:\n";
for (AstNodeExpr* const termp : termps) termp->dumpTree("- Reduced term: ");
for (const std::pair<AstNodeExpr*, FrozenNodeInfo>& termp : visitor.m_frozenNodes) {
termp.first->dumpTree("- Frozen term with lsb "
+ std::to_string(termp.second.m_lsb) + " polarity "
+ std::to_string(termp.second.m_polarity) + ": ");
}
cout << "- Needs flipping: " << needsFlip << endl;
cout << "- Needs cleaning: " << needsCleaning << endl;
cout << "- Size: " << resultOps << " input size: " << visitor.m_ops << endl;
cout << "- Needs flipping: " << needsFlip << "\n";
cout << "- Needs cleaning: " << needsCleaning << "\n";
cout << "- Size: " << resultOps << " input size: " << visitor.m_ops << "\n";
} // LCOV_EXCL_END
// Sometimes we have no terms left after ignoring redundant terms

View File

@ -80,7 +80,7 @@ static void dumpDotVertex(std::ostream& os, const DfgVertex& vtx) {
} else {
os << ", shape=box";
}
os << "]" << endl;
os << "]\n";
return;
}
@ -104,7 +104,7 @@ static void dumpDotVertex(std::ostream& os, const DfgVertex& vtx) {
} else {
os << ", shape=box3d";
}
os << "]" << endl;
os << "]\n";
return;
}
@ -121,7 +121,7 @@ static void dumpDotVertex(std::ostream& os, const DfgVertex& vtx) {
}
os << '"';
os << ", shape=plain";
os << "]" << endl;
os << "]\n";
return;
}
@ -136,7 +136,7 @@ static void dumpDotVertex(std::ostream& os, const DfgVertex& vtx) {
} else {
os << ", shape=circle";
}
os << "]" << endl;
os << "]\n";
return;
}
@ -147,14 +147,14 @@ static void dumpDotVertex(std::ostream& os, const DfgVertex& vtx) {
} else {
os << ", shape=circle";
}
os << "]" << endl;
os << "]\n";
}
// Dump one DfgEdge in Graphviz format
static void dumpDotEdge(std::ostream& os, const DfgEdge& edge, const string& headlabel) {
os << toDotId(*edge.sourcep()) << " -> " << toDotId(*edge.sinkp());
if (!headlabel.empty()) os << " [headlabel=\"" << headlabel << "\"]";
os << endl;
os << "\n";
}
// Dump one DfgVertex and all of its source DfgEdges in Graphviz format
@ -171,17 +171,17 @@ static void dumpDotVertexAndSourceEdges(std::ostream& os, const DfgVertex& vtx)
void DfgGraph::dumpDot(std::ostream& os, const string& label) const {
// Header
os << "digraph dfg {" << endl;
os << "digraph dfg {\n";
os << "graph [label=\"" << name();
if (!label.empty()) os << "-" << label;
os << "\", labelloc=t, labeljust=l]" << endl;
os << "graph [rankdir=LR]" << endl;
os << "\", labelloc=t, labeljust=l]\n";
os << "graph [rankdir=LR]\n";
// Emit all vertices
forEachVertex([&](const DfgVertex& vtx) { dumpDotVertexAndSourceEdges(os, vtx); });
// Footer
os << "}" << endl;
os << "}\n";
}
void DfgGraph::dumpDotFile(const string& fileName, const string& label) const {
@ -242,15 +242,15 @@ void DfgGraph::dumpDotUpstreamCone(const string& fileName, const DfgVertex& vtx,
if (os->fail()) v3fatal("Cannot write to file: " << fileName);
// Header
*os << "digraph dfg {" << endl;
if (!name.empty()) *os << "graph [label=\"" << name << "\", labelloc=t, labeljust=l]" << endl;
*os << "graph [rankdir=LR]" << endl;
*os << "digraph dfg {\n";
if (!name.empty()) *os << "graph [label=\"" << name << "\", labelloc=t, labeljust=l]\n";
*os << "graph [rankdir=LR]\n";
// Dump the cone
dumpDotUpstreamConeFromVertex(*os, vtx);
// Footer
*os << "}" << endl;
*os << "}\n";
// Done
os->close();
@ -276,15 +276,15 @@ void DfgGraph::dumpDotAllVarConesPrefixed(const string& label) const {
if (os->fail()) v3fatal("Cannot write to file: " << fileName);
// Header
*os << "digraph dfg {" << endl;
*os << "graph [label=\"" << coneName << "\", labelloc=t, labeljust=l]" << endl;
*os << "graph [rankdir=LR]" << endl;
*os << "digraph dfg {\n";
*os << "graph [label=\"" << coneName << "\", labelloc=t, labeljust=l]\n";
*os << "graph [rankdir=LR]\n";
// Dump this cone
dumpDotUpstreamConeFromVertex(*os, vtx);
// Footer
*os << "}" << endl;
*os << "}\n";
// Done with this logic cone
os->close();

View File

@ -399,7 +399,7 @@ void FileLine::v3errorEnd(std::ostringstream& sstr, const string& extra)
std::ostringstream nsstr;
if (lastLineno()) nsstr << this;
nsstr << sstr.str();
nsstr << endl;
nsstr << "\n";
std::ostringstream lstr;
if (!extra.empty()) {
lstr << std::setw(ascii().length()) << " "

View File

@ -416,5 +416,5 @@ void V3Graph::dumpDotFile(const string& filename, bool colorAsSubgraph) const {
*logp << "}\n";
logp->close();
cout << "dot -Tpdf -o ~/a.pdf " << filename << endl;
cout << "dot -Tpdf -o ~/a.pdf " << filename << "\n";
}

View File

@ -1833,46 +1833,46 @@ string V3Options::parseFileArg(const string& optdir, const string& relfilename)
void V3Options::showVersion(bool verbose) {
cout << version();
cout << endl;
cout << "\n";
if (!verbose) return;
cout << endl;
cout << "\n";
cout << "Copyright 2003-2023 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 << "either the GNU Lesser General Public License Version 3 or the Perl Artistic\n";
cout << "License Version 2.0.\n";
cout << endl;
cout << "\n";
cout << "See https://verilator.org for documentation\n";
cout << endl;
cout << "\n";
cout << "Summary of configuration:\n";
cout << " Compiled in defaults if not in environment:\n";
cout << " SYSTEMC = " << DEFENV_SYSTEMC << endl;
cout << " SYSTEMC_ARCH = " << DEFENV_SYSTEMC_ARCH << endl;
cout << " SYSTEMC_INCLUDE = " << DEFENV_SYSTEMC_INCLUDE << endl;
cout << " SYSTEMC_LIBDIR = " << DEFENV_SYSTEMC_LIBDIR << endl;
cout << " VERILATOR_ROOT = " << DEFENV_VERILATOR_ROOT << endl;
cout << " SystemC system-wide = " << cvtToStr(systemCSystemWide()) << endl;
cout << " SYSTEMC = " << DEFENV_SYSTEMC << "\n";
cout << " SYSTEMC_ARCH = " << DEFENV_SYSTEMC_ARCH << "\n";
cout << " SYSTEMC_INCLUDE = " << DEFENV_SYSTEMC_INCLUDE << "\n";
cout << " SYSTEMC_LIBDIR = " << DEFENV_SYSTEMC_LIBDIR << "\n";
cout << " VERILATOR_ROOT = " << DEFENV_VERILATOR_ROOT << "\n";
cout << " SystemC system-wide = " << cvtToStr(systemCSystemWide()) << "\n";
// If update below, also update V3Options::getenvBuiltins()
cout << endl;
cout << "\n";
cout << "Environment:\n";
cout << " MAKE = " << V3Os::getenvStr("MAKE", "") << endl;
cout << " PERL = " << V3Os::getenvStr("PERL", "") << endl;
cout << " SYSTEMC = " << V3Os::getenvStr("SYSTEMC", "") << endl;
cout << " SYSTEMC_ARCH = " << V3Os::getenvStr("SYSTEMC_ARCH", "") << endl;
cout << " SYSTEMC_INCLUDE = " << V3Os::getenvStr("SYSTEMC_INCLUDE", "") << endl;
cout << " SYSTEMC_LIBDIR = " << V3Os::getenvStr("SYSTEMC_LIBDIR", "") << endl;
cout << " MAKE = " << V3Os::getenvStr("MAKE", "") << "\n";
cout << " PERL = " << V3Os::getenvStr("PERL", "") << "\n";
cout << " SYSTEMC = " << V3Os::getenvStr("SYSTEMC", "") << "\n";
cout << " SYSTEMC_ARCH = " << V3Os::getenvStr("SYSTEMC_ARCH", "") << "\n";
cout << " SYSTEMC_INCLUDE = " << V3Os::getenvStr("SYSTEMC_INCLUDE", "") << "\n";
cout << " SYSTEMC_LIBDIR = " << V3Os::getenvStr("SYSTEMC_LIBDIR", "") << "\n";
// wrapper uses VERILATOR_BIN
cout << " VERILATOR_BIN = " << V3Os::getenvStr("VERILATOR_BIN", "") << endl;
cout << " VERILATOR_ROOT = " << V3Os::getenvStr("VERILATOR_ROOT", "") << endl;
cout << " VERILATOR_BIN = " << V3Os::getenvStr("VERILATOR_BIN", "") << "\n";
cout << " VERILATOR_ROOT = " << V3Os::getenvStr("VERILATOR_ROOT", "") << "\n";
// If update below, also update V3Options::getSupported()
cout << endl;
cout << "\n";
cout << "Supported features (compiled-in or forced by environment):\n";
cout << " COROUTINES = " << getSupported("COROUTINES") << endl;
cout << " SYSTEMC = " << getSupported("SYSTEMC") << endl;
cout << " COROUTINES = " << getSupported("COROUTINES") << "\n";
cout << " SYSTEMC = " << getSupported("SYSTEMC") << "\n";
}
//======================================================================
@ -1906,7 +1906,7 @@ void V3Options::setDebugMode(int level) {
if (!m_dumpLevel.count("tree")) m_dumpLevel["tree"] = 3; // Don't override if already set.
m_stats = true;
m_debugCheck = true;
cout << "Starting " << version() << endl;
cout << "Starting " << version() << "\n";
}
unsigned V3Options::debugLevel(const string& tag) const VL_MT_SAFE {

View File

@ -99,9 +99,9 @@ private:
nodep->v3warn(ENCAPSULATED, nodep->prettyNameQ()
<< " is hidden as " << how
<< " within this context (IEEE 1800-2017 8.18)\n"
<< nodep->warnContextPrimary() << endl
<< nodep->warnContextPrimary() << "\n"
<< nodep->warnOther()
<< "... Location of definition" << endl
<< "... Location of definition\n"
<< defp->warnContextSecondary());
}
}

View File

@ -120,7 +120,7 @@ public:
for (uint64_t i = 0; i < m_dataSize; ++i) {
if (hits(i)) std::cout << "," << i;
}
std::cout << std::endl;
std::cout << "\n";
}
};

View File

@ -103,16 +103,16 @@ void VlcOptions::parseOptsList(int argc, char** argv) {
void VlcOptions::showVersion(bool verbose) {
std::cout << version();
std::cout << endl;
std::cout << "\n";
if (!verbose) return;
std::cout << endl;
std::cout << "\n";
std::cout << "Copyright 2003-2023 by Wilson Snyder. Verilator is free software; you can\n";
std::cout << "redistribute it and/or modify the Verilator internals under the terms of\n";
std::cout << "either the GNU Lesser General Public License Version 3 or the Perl Artistic\n";
std::cout << "License Version 2.0.\n";
std::cout << endl;
std::cout << "\n";
std::cout << "See https://verilator.org for documentation\n";
}