From 57a937df03dd76b617a3a974caec53420564d7a1 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sat, 16 May 2020 07:43:22 -0400 Subject: [PATCH] Misc internal coverage cleanups --- include/verilated_save.cpp | 8 ++++---- include/verilated_vcd_c.cpp | 9 +++++---- include/verilated_vcd_c.h | 11 ++++++++++- nodist/code_coverage | 2 +- nodist/code_coverage.dat | 2 +- src/V3Scoreboard.h | 2 +- 6 files changed, 22 insertions(+), 12 deletions(-) diff --git a/include/verilated_save.cpp b/include/verilated_save.cpp index e5df393b2..38c56878d 100644 --- a/include/verilated_save.cpp +++ b/include/verilated_save.cpp @@ -123,8 +123,8 @@ void VerilatedSave::open(const char* filenamep) VL_MT_UNSAFE_ONE { if (isOpen()) return; VL_DEBUG_IF(VL_DBG_MSGF("- save: opening save file %s\n", filenamep);); - if (filenamep[0] == '|') { - assert(0); // Not supported yet. + if (VL_UNCOVERABLE(filenamep[0] == '|')) { + assert(0); // LCOV_EXCL_LINE // Not supported yet. } else { // cppcheck-suppress duplicateExpression m_fd = ::open(filenamep, @@ -146,8 +146,8 @@ void VerilatedRestore::open(const char* filenamep) VL_MT_UNSAFE_ONE { if (isOpen()) return; VL_DEBUG_IF(VL_DBG_MSGF("- restore: opening restore file %s\n", filenamep);); - if (filenamep[0] == '|') { - assert(0); // Not supported yet. + if (VL_UNCOVERABLE(filenamep[0] == '|')) { + assert(0); // LCOV_EXCL_LINE // Not supported yet. } else { // cppcheck-suppress duplicateExpression m_fd = ::open(filenamep, O_CREAT | O_RDONLY | O_LARGEFILE | O_CLOEXEC, 0666); diff --git a/include/verilated_vcd_c.cpp b/include/verilated_vcd_c.cpp index b17281519..bc8ce6eb0 100644 --- a/include/verilated_vcd_c.cpp +++ b/include/verilated_vcd_c.cpp @@ -203,8 +203,8 @@ void VerilatedVcd::openNext(bool incFilename) { } m_filename = name; } - if (m_filename[0] == '|') { - assert(0); // Not supported yet. + if (VL_UNCOVERABLE(m_filename[0] == '|')) { + assert(0); // LCOV_EXCL_LINE // Not supported yet. } else { // cppcheck-suppress duplicateExpression if (!m_filep->open(m_filename)) { @@ -904,9 +904,9 @@ void vcdInit(void*, VerilatedVcd* vcdp, vluint32_t) { /**/ // Note need to add 6 for next code. /**/ vcdp->declDouble(0x1c, "doub", -1, 0); /**/ // Note need to add 2 for next code. - /**/ vcdp->declDouble(0x1e, "flo", -1, 0); + /**/ vcdp->declFloat(0x1e, "flo", -1, 0); /**/ vcdp->declArray(0x20, "q2", -1, 0, 95, 0); - // Note need to add 4 for next code. + /**/ // Note need to add 4 for next code. } void vcdFull(void*, VerilatedVcd* vcdp) { @@ -948,6 +948,7 @@ void vcdTestMain(const char* filenamep) { doub = 0; { VerilatedVcdC* vcdp = new VerilatedVcdC; + vcdp->evcd(true); vcdp->spTrace()->addInitCb(&vcdInit, 0); vcdp->spTrace()->addFullCb(&vcdFull, 0); vcdp->spTrace()->addChgCb(&vcdChange, 0); diff --git a/include/verilated_vcd_c.h b/include/verilated_vcd_c.h index 972c8c0e7..6c1b39e6d 100644 --- a/include/verilated_vcd_c.h +++ b/include/verilated_vcd_c.h @@ -336,8 +336,8 @@ public: } } -protected: // METHODS + // Old/standalone API only void evcd(bool flag) { m_evcd = flag; } #endif // VL_TRACE_VCD_OLD_API }; @@ -405,6 +405,15 @@ public: /// Internal class access inline VerilatedVcd* spTrace() { return &m_sptrace; } + +#ifdef VL_TRACE_VCD_OLD_API + //========================================================================= + // Note: These are only for testing for backward compatibility with foreign + // code and is not used by Verilator. Do not use these as there is no + // guarantee of functionality. + /// Use evcd format + void evcd(bool flag) VL_MT_UNSAFE_ONE { m_sptrace.evcd(flag); } +#endif }; #endif // guard diff --git a/nodist/code_coverage b/nodist/code_coverage index 4f4cd17d7..18e8ac368 100755 --- a/nodist/code_coverage +++ b/nodist/code_coverage @@ -178,7 +178,7 @@ sub test { if ($Opt_Stage <= 9) { travis_fold_start("upload"); print "Stage 9: Upload\n"; - my $cmd = 'bash <(curl -s https://codecov.io/bash) -f $cc_dir/app_total.info'; + my $cmd = "bash <(curl -s https://codecov.io/bash) -f $cc_dir/app_total.info"; print "print: Not running: $cmd\n"; travis_fold_end(); } diff --git a/nodist/code_coverage.dat b/nodist/code_coverage.dat index 58e4f8d5e..88bcbc6b7 100644 --- a/nodist/code_coverage.dat +++ b/nodist/code_coverage.dat @@ -42,6 +42,6 @@ remove_source("*examples/*"); # Would just be removed with remove_source in later step remove_gcda_regexp(qr!test_regress/.*/(Vt_|Vtop_).*\.gcda!); -exclude_line_regexp(qr/(\bv3fatalSrc\b|\bVL_UNCOVERABLE\b|\bVL_FATAL)/); +exclude_line_regexp(qr/(\bv3fatalSrc\b|\bVL_UNCOVERABLE\b|\bVL_FATAL|\bUASSERT\bERROR_RSVD_WORD)/); 1; diff --git a/src/V3Scoreboard.h b/src/V3Scoreboard.h index 84621b775..9fffe9dac 100644 --- a/src/V3Scoreboard.h +++ b/src/V3Scoreboard.h @@ -125,7 +125,7 @@ public: // No more values but it's not defined to decrement an // iterator past the beginning. v3fatalSrc("Decremented iterator past beginning"); - return; + return; // LCOV_EXCL_LINE } --m_valIt; // Should find a value here, as Every value bucket is supposed