diff --git a/Changes b/Changes index 843fc5ae2..364efe718 100644 --- a/Changes +++ b/Changes @@ -14,6 +14,14 @@ The contributors that suggested a given feature are shown in []. Thanks! **** Fix internals to avoid 'using namespace std'. +**** Fix Verilation performance issues, bug1316. [John Coiner] + + +* Verilator 3.925 devel + + +* Verilator 3.924 2018-06-12 + *** Renamed --profile-cfuncs to --prof-cfuncs. **** Report interface ports connected to wrong interface, bug1294. [Todd Strader] @@ -24,7 +32,8 @@ The contributors that suggested a given feature are shown in []. Thanks! **** Fix parsing error on bad missing #, bug1308. [Dan Kirkham] -**** Fix Verilation performance issues, bug1316. [John Coiner] +**** Fix $clog2 to be in verilog 2005, bug1319. [James Hutchinson] + * Verilator 3.922 2018-03-17 diff --git a/include/verilated.cpp b/include/verilated.cpp index 1ad503beb..ae4fb1aeb 100644 --- a/include/verilated.cpp +++ b/include/verilated.cpp @@ -122,10 +122,16 @@ std::string _vl_string_vprintf(const char* formatp, va_list ap) VL_MT_SAFE { va_list aq; va_copy(aq, ap); int len = VL_VSNPRINTF(NULL, 0, formatp, aq); - if (VL_UNLIKELY(len < 1)) return ""; + va_end(aq); + if (VL_UNLIKELY(len < 1)) { + va_end(ap); + return ""; + } char* bufp = new char[len+1]; VL_VSNPRINTF(bufp, len+1, formatp, ap); + va_end(ap); + std::string out = std::string(bufp, len); delete[] bufp; return out; @@ -163,7 +169,7 @@ void VL_DBG_MSGF(const char* formatp, ...) VL_MT_SAFE { // Using VL_PRINTF not VL_PRINTF_MT so that we can call VL_DBG_MSGF // from within the guts of the thread execution machinery (and it goes // to the screen and not into the queues we're debugging) - VL_PRINTF("-V{t%d,%" VL_PRI64 "d}%s", VL_THREAD_ID(), _vl_dbg_sequence_number(), out.c_str()); + VL_PRINTF("-V{t%d,%" VL_PRI64 "u}%s", VL_THREAD_ID(), _vl_dbg_sequence_number(), out.c_str()); } #ifdef VL_THREADED diff --git a/include/verilated_vpi.cpp b/include/verilated_vpi.cpp index c57bcad13..63faa7ecd 100644 --- a/include/verilated_vpi.cpp +++ b/include/verilated_vpi.cpp @@ -473,11 +473,12 @@ public: m_errorInfo.level = level; return this; } - void setMessage(std::string file, PLI_INT32 line, const std::string& message, ...) { + void setMessage(std::string file, PLI_INT32 line, const char* message, ...) { + // message cannot be a const string& as va_start cannot use a reference static VL_THREAD_LOCAL std::string filehold; va_list args; va_start(args, message); - VL_VSNPRINTF(m_buff, sizeof(m_buff), message.c_str(), args); + VL_VSNPRINTF(m_buff, sizeof(m_buff), message, args); va_end(args); m_errorInfo.state = vpiPLI; filehold = file; diff --git a/src/V3Ast.h b/src/V3Ast.h index c1489d7e4..c0b0cee97 100644 --- a/src/V3Ast.h +++ b/src/V3Ast.h @@ -2105,7 +2105,7 @@ public: class AstNodeRange : public AstNode { // A range, sized or unsized public: - AstNodeRange(FileLine* fl) : AstNode (fl) { } + explicit AstNodeRange(FileLine* fl) : AstNode (fl) { } ASTNODE_BASE_FUNCS(NodeRange) }; diff --git a/src/V3AstNodes.h b/src/V3AstNodes.h index a2e775a78..327374a93 100644 --- a/src/V3AstNodes.h +++ b/src/V3AstNodes.h @@ -151,7 +151,7 @@ public: class AstUnsizedRange : public AstNodeRange { // Unsized range specification, for open arrays public: - AstUnsizedRange(FileLine* fl) : AstNodeRange(fl) { } + explicit AstUnsizedRange(FileLine* fl) : AstNodeRange(fl) { } ASTNODE_NODE_FUNCS(UnsizedRange) virtual string emitC() { V3ERROR_NA; return ""; } virtual string emitVerilog() { return "[]"; } diff --git a/src/verilog.l b/src/verilog.l index f116279a2..0d0ac40b3 100644 --- a/src/verilog.l +++ b/src/verilog.l @@ -422,6 +422,8 @@ vnum {vnum1}|{vnum2}|{vnum3}|{vnum4}|{vnum5} /* Verilog 2005 */ { + /* System Tasks */ + "$clog2" { FL; return yD_CLOG2; } /* Keywords */ "uwire" { FL; return yWIRE; } } @@ -430,7 +432,6 @@ vnum {vnum1}|{vnum2}|{vnum3}|{vnum4}|{vnum5} { /* System Tasks */ "$bits" { FL; return yD_BITS; } - "$clog2" { FL; return yD_CLOG2; } "$countones" { FL; return yD_COUNTONES; } "$dimensions" { FL; return yD_DIMENSIONS; } "$error" { FL; return yD_ERROR; }