diff --git a/Makefile.in b/Makefile.in index fa4d0407d..afba5f799 100644 --- a/Makefile.in +++ b/Makefile.in @@ -642,7 +642,6 @@ FASTCOV_OPT += --exclude-br-lines-starting-with FASTCOV_OPT += BROKEN_BASE_RTN FASTCOV_OPT += BROKEN_RTN FASTCOV_OPT += NUM_ASSERT -FASTCOV_OPT += NUM_ASSERT FASTCOV_OPT += SELF_CHECK FASTCOV_OPT += UASSERT FASTCOV_OPT += UINFO diff --git a/src/V3AstAttr.h b/src/V3AstAttr.h index a0591ed4d..c2388248f 100644 --- a/src/V3AstAttr.h +++ b/src/V3AstAttr.h @@ -658,10 +658,6 @@ public: return names[m_e]; } bool trueKnown() const { return m_e == BU_TRUE; } - bool trueUnknown() const { return m_e == BU_TRUE || m_e == BU_UNKNOWN; } - bool falseKnown() const { return m_e == BU_FALSE; } - bool falseUnknown() const { return m_e == BU_FALSE || m_e == BU_UNKNOWN; } - bool unknown() const { return m_e == BU_UNKNOWN; } void setTrueOrFalse(bool flag) { m_e = flag ? BU_TRUE : BU_FALSE; } }; constexpr bool operator==(const VBoolOrUnknown& lhs, const VBoolOrUnknown& rhs) { @@ -1769,7 +1765,6 @@ public: || m_e == SUPPLY1 || m_e == TRIOR || m_e == TRIAND); } bool isWor() const { return (m_e == TRIOR); } - bool isWand() const { return (m_e == TRIAND); } bool isWiredNet() const { return (m_e == TRIOR || m_e == TRIAND); } bool isContAssignable() const { // In Verilog, always ok in SystemVerilog return (m_e == SUPPLY0 || m_e == SUPPLY1 || m_e == WIRE || m_e == WREAL || m_e == TRIWIRE diff --git a/src/V3AstNodeOther.h b/src/V3AstNodeOther.h index 46bfef349..f0c515efe 100644 --- a/src/V3AstNodeOther.h +++ b/src/V3AstNodeOther.h @@ -2128,7 +2128,6 @@ public: bool isSignal() const { return varType().isSignal(); } bool isNet() const { return varType().isNet(); } bool isWor() const { return varType().isWor(); } - bool isWand() const { return varType().isWand(); } bool isWiredNet() const { return varType().isWiredNet(); } bool isTemp() const { return varType().isTemp(); } bool isToggleCoverable() const { diff --git a/src/V3File.cpp b/src/V3File.cpp index 54c4b665d..40099bb59 100644 --- a/src/V3File.cpp +++ b/src/V3File.cpp @@ -522,9 +522,8 @@ private: constexpr int P_RD = 0; constexpr int P_WR = 1; - if (pipe(fd_stdin) != 0 || pipe(fd_stdout) != 0) { - v3fatal("--pipe-filter: Can't pipe: " << std::strerror(errno)); - } + if (VL_UNCOVERABLE(pipe(fd_stdin) != 0 || pipe(fd_stdout) != 0)) + v3fatal("--pipe-filter: Can't pipe: " << std::strerror(errno)); // LCOV_EXCL_LINE if (fd_stdin[P_RD] <= 2 || fd_stdin[P_WR] <= 2 || fd_stdout[P_RD] <= 2 || fd_stdout[P_WR] <= 2) { // We'd have to rearrange all of the FD usages in this case. @@ -535,7 +534,8 @@ private: UINFO(1, "--pipe-filter: /bin/sh -c " << command); const pid_t pid = fork(); - if (pid < 0) v3fatal("--pipe-filter: fork failed: " << std::strerror(errno)); + if (VL_UNCOVERABLE(pid < 0)) + v3fatal("--pipe-filter: fork failed: " << std::strerror(errno)); // LCOV_EXCL_LINE if (pid == 0) { // Child UINFO(6, "In child"); close(fd_stdin[P_WR]); diff --git a/src/V3Mutex.h b/src/V3Mutex.h index 9c341545e..e70b967c9 100644 --- a/src/V3Mutex.h +++ b/src/V3Mutex.h @@ -70,7 +70,6 @@ public: std::abort(); // LCOV_EXCL_LINE } } - bool lockConfig() VL_MT_SAFE { return m_lockConfig; } bool enable() VL_MT_SAFE { return m_enable; } }; diff --git a/src/V3Number.cpp b/src/V3Number.cpp index 8ac571c58..c683ed828 100644 --- a/src/V3Number.cpp +++ b/src/V3Number.cpp @@ -277,11 +277,11 @@ void V3Number::create(const char* sourcep) { break; } case '_': break; - default: { + default: { // LCOV_EXCL_START // Likely impossible as parser prevents hitting it - v3error("Illegal character in decimal constant: " << *cp); // LCOV_EXCL_LINE + v3error("Illegal character in decimal constant: " << *cp); break; - } + } // LCOV_EXCL_STOP } } obit = width(); @@ -357,18 +357,18 @@ void V3Number::create(const char* sourcep) { case 'x': setBit(obit++,'x'); setBit(obit++,'x'); setBit(obit++,'x'); setBit(obit++,'x'); break; // clang-format on case '_': break; - default: + default: // LCOV_EXCL_START // Likely impossible as parser prevents hitting it - v3error("Illegal character in hex constant: " << *cp); // LCOV_EXCL_LINE + v3error("Illegal character in hex constant: " << *cp); break; - } + } // LCOV_EXCL_STOP break; } - default: + default: // LCOV_EXCL_START // Likely impossible as parser prevents hitting it - v3error("Illegal base character: " << base); // LCOV_EXCL_LINE + v3error("Illegal base character: " << base); break; - } + } // LCOV_EXCL_STOP } } diff --git a/src/V3Options.cpp b/src/V3Options.cpp index 364280c77..4b44706c3 100644 --- a/src/V3Options.cpp +++ b/src/V3Options.cpp @@ -1322,7 +1322,7 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, m_debugLevel[optp] = std::atoi(valp); }); DECL_OPTION("-debug-abort", CbCall, []() { - V3Error::vlAbort(); + V3Error::vlAbort(); // LCOV_EXCL_LINE }).undocumented(); // See also --debug-sigseg DECL_OPTION("-debug-check", OnOff, &m_debugCheck); DECL_OPTION("-debug-collision", OnOff, &m_debugCollision).undocumented(); diff --git a/src/V3String.h b/src/V3String.h index 54b1ce1fc..eec386b6c 100644 --- a/src/V3String.h +++ b/src/V3String.h @@ -223,7 +223,6 @@ public: // CONFIG STATIC METHODS // Length at which to start hashing, 0=disable static void maxLength(size_t flag) { s_maxLength = flag; } - static size_t maxLength() { return s_maxLength; } static string dehash(const string& in); }; diff --git a/src/V3Trace.cpp b/src/V3Trace.cpp index 55a52a9e8..ddf9305ae 100644 --- a/src/V3Trace.cpp +++ b/src/V3Trace.cpp @@ -225,6 +225,8 @@ class TraceVisitor final : public VNVisitor { } } } + if (dumpLevel() || debug() >= 9) + dupFinder.dumpFile(v3Global.debugFilename("trace") + ".hash", false); } void graphSimplify(bool initial) { diff --git a/src/V3Width.cpp b/src/V3Width.cpp index 87c0e000c..97cbbf73c 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -8322,10 +8322,8 @@ class WidthVisitor final : public VNVisitor { void replaceWithSFormat(AstMethodCall* nodep, const string& format) { // For string.itoa and similar, replace with SFormatF const AstArg* argp = VN_CAST(nodep->pinsp(), Arg); - if (!argp) { - nodep->v3error("Argument needed for string." + nodep->prettyName() + " method"); - return; - } + UASSERT_OBJ(argp, nodep, + "Argument needed for string method, call methodOkArguments before here"); AstNodeVarRef* const fromp = VN_AS(nodep->fromp()->unlinkFrBack(), VarRef); AstNode* const newp = new AstAssign{ nodep->fileline(), fromp, diff --git a/src/verilog.l b/src/verilog.l index df4d3d6ab..35e98feb0 100644 --- a/src/verilog.l +++ b/src/verilog.l @@ -67,7 +67,9 @@ static double lexParseDouble(FileLine* fl, const char* textp, size_t length) { const string text = std::string{textp, length}; bool success = false; const double d = VString::parseDouble(text, &success); - if (!success) fl->v3error("Syntax error parsing real: '" << textp << "'"); + // Below never fails, instead can't lex the number + if (VL_UNCOVERABLE(!success)) + fl->v3error("Syntax error parsing real: '" << textp << "'"); // LCOV_EXCL_LINE return d; } diff --git a/test_regress/t/t_debug_emitv.py b/test_regress/t/t_debug_emitv.py index 15e089a81..a412106da 100755 --- a/test_regress/t/t_debug_emitv.py +++ b/test_regress/t/t_debug_emitv.py @@ -14,7 +14,10 @@ test.scenarios("vlt") test.lint( # We also have dump-tree turned on, so hit a lot of AstNode*::dump() functions # Likewise XML - v_flags=["--lint-only --dumpi-tree 9 --dumpi-V3EmitV 9 --debug-emitv --timing"]) + v_flags=[ + "--lint-only --timing", + "--dumpi-tree 9 --dumpi-V3EmitV 9 --debug-emitv" # Dev coverage of the V3EmitV code + ]) output_vs = test.glob_some(test.obj_dir + "/" + test.vm_prefix + "_*_width.tree.v") diff --git a/test_regress/t/t_dist_warn_coverage.py b/test_regress/t/t_dist_warn_coverage.py index f09209621..35a6bb608 100755 --- a/test_regress/t/t_dist_warn_coverage.py +++ b/test_regress/t/t_dist_warn_coverage.py @@ -16,22 +16,19 @@ Outputs = {} Suppressed = {} for s in [ + # Cannot hit, and comment as to why + # Instead of adding here, consider adding a LCOV_EXCL_LINE/START/STOP to the sources on the message ' exited with ', # Is hit; driver.py filters out ' loading non-variable', # Instead 'storing to parameter' or syntax error - '--pipe-filter: Can\'t pipe: ', # Can't test - '--pipe-filter: fork failed: ', # Can't test 'Assigned pin is neither input nor output', # Instead earlier error 'Define missing argument \'', # Instead get Define passed too many arguments 'Define or directive not defined: `', # Instead V3ParseImp will warn - 'Enum ranges must be integral, per spec', # Hard to hit 'Expecting define formal arguments. Found: ', # Instead define syntax error - 'Syntax error parsing real: \'', # Instead can't lex the number 'Syntax error: Range \':\', \'+:\' etc are not allowed in the instance ', # Instead get syntax error 'dynamic new() not expected in this context (expected under an assign)', # Instead get syntax error # Not yet analyzed '--pipe-filter protocol error, unexpected: ', '--pipe-filter returned bad status', - 'Argument needed for string.', 'Array initialization has too few elements, need element ', 'Assignment pattern with no members', 'Can\'t find varpin scope of ', @@ -110,6 +107,8 @@ def read_messages(): with open(filename, 'r', encoding="utf8") as fh: lineno = 0 read_next = None + excl = False + excl_next = False for origline in fh: line = origline @@ -118,6 +117,12 @@ def read_messages(): continue if re.match(r'^\s*/\*', line): continue + excl = excl_next + if 'LCOV_EXCL_START' in line: + excl = True + excl_next = True + if 'LCOV_EXCL_STOP' in line: + excl_next = False # Reenables coverage on next line, not this one if re.search(r'\b(v3error|v3warn|v3fatal|BBUNSUP)\b\($', line): if 'LCOV_EXCL_LINE' not in line: read_next = True @@ -131,6 +136,8 @@ def read_messages(): read_next = False if 'LCOV_EXCL_LINE' in line: continue + if excl: + continue if "\\" in line: # \" messes up next part continue m = re.search(r'"([^"]*)"', line) diff --git a/test_regress/t/t_flag_csplit.v b/test_regress/t/t_flag_csplit.v index a7a8a2541..38caf31dd 100644 --- a/test_regress/t/t_flag_csplit.v +++ b/test_regress/t/t_flag_csplit.v @@ -55,7 +55,7 @@ module sub (input clk, input [31:0] i, output [31:0] z); assign z = z_tmp; always @(posedge z_tmp == 32'b11) begin - $display("%m z_tmp[0]: %d", z_tmp); + $display("%m z_tmp[0]: %0d", z_tmp); end endmodule diff --git a/test_regress/t/t_flag_csplit_groups.py b/test_regress/t/t_flag_csplit_groups.py index d02a0d351..25362da59 100755 --- a/test_regress/t/t_flag_csplit_groups.py +++ b/test_regress/t/t_flag_csplit_groups.py @@ -82,12 +82,13 @@ def check_gcc_flags(filename): if not test.make_version or float(test.make_version) < 4.1: test.skip("Test requires GNU Make version >= 4.1") -test.compile(v_flags2=["--trace-vcd", +test.compile(v_flags2=["--exe", + "--trace-vcd", "--output-split 1", "--output-groups 2", "--output-split-cfuncs 1", - "--exe", "--stats", + "--dumpi-V3EmitMk 9", # Dev coverage of the V3EmitMk debug printer "../" + test.main_filename], verilator_make_gmake=False) # yapf:disable diff --git a/test_regress/t/t_flag_getenv.py b/test_regress/t/t_flag_getenv.py index 82aee49d3..7410af807 100755 --- a/test_regress/t/t_flag_getenv.py +++ b/test_regress/t/t_flag_getenv.py @@ -20,7 +20,8 @@ test.run(cmd=[os.environ["VERILATOR_ROOT"] + "/bin/verilator --getenv FOOBARTEST test.file_grep(test.compile_log_filename, r'gotit') for var in [ - 'MAKE', 'PERL', 'PYTHON3', 'SYSTEMC', 'SYSTEMC_ARCH', 'SYSTEMC_LIBDIR', 'VERILATOR_ROOT' + 'MAKE', 'PERL', 'PYTHON3', 'SYSTEMC', 'SYSTEMC_ARCH', 'SYSTEMC_INCLUDE', 'SYSTEMC_LIBDIR', + 'VERILATOR_ROOT' ]: test.run(cmd=[os.environ["VERILATOR_ROOT"] + "/bin/verilator", "--getenv", var], logfile=test.obj_dir + "/simx.log", diff --git a/test_regress/t/t_trace_event.py b/test_regress/t/t_trace_event.py index cc6494c42..a39922fcf 100755 --- a/test_regress/t/t_trace_event.py +++ b/test_regress/t/t_trace_event.py @@ -11,7 +11,10 @@ import vltest_bootstrap test.scenarios('simulator') -test.compile(verilator_flags2=['--trace-vcd --binary']) +test.compile(verilator_flags2=[ + '--trace-vcd --binary', + '--dumpi-V3Trace 9' # Dev coverage of the V3DumpFinder debug code +]) test.execute()