Fix extra dot in coverage point hierarchy when using name()=''.

This commit is contained in:
Wilson Snyder 2024-09-23 07:34:12 -04:00
parent 0aa8356eca
commit c48d80592e
3 changed files with 5 additions and 4 deletions

View File

@ -62,6 +62,7 @@ Verilator 5.029 devel
* Fix tracing when name() is empty (#5470). [Sam Shahrestani] * Fix tracing when name() is empty (#5470). [Sam Shahrestani]
* Fix timing mode not exiting on empty events (#5472). * Fix timing mode not exiting on empty events (#5472).
* Fix --binary with .cpp PLI filenames under relative directory paths. * Fix --binary with .cpp PLI filenames under relative directory paths.
* Fix extra dot in coverage point hierarchy when using name()=''.
Verilator 5.028 2024-08-21 Verilator 5.028 2024-08-21

View File

@ -321,6 +321,8 @@ class EmitCImp final : EmitCFunc {
} }
// static doesn't need save-restore as is constant // static doesn't need save-restore as is constant
puts("static uint32_t fake_zero_count = 0;\n"); puts("static uint32_t fake_zero_count = 0;\n");
puts("std::string fullhier = std::string{VerilatedModule::name()} + hierp;\n");
puts("if (!fullhier.empty() && fullhier[0] == '.') fullhier = fullhier.substr(1);\n");
// Used for second++ instantiation of identical bin // Used for second++ instantiation of identical bin
puts("if (!enable) count32p = &fake_zero_count;\n"); puts("if (!enable) count32p = &fake_zero_count;\n");
puts("*count32p = 0;\n"); puts("*count32p = 0;\n");
@ -329,9 +331,7 @@ class EmitCImp final : EmitCFunc {
puts(" \"filename\",filenamep,"); puts(" \"filename\",filenamep,");
puts(" \"lineno\",lineno,"); puts(" \"lineno\",lineno,");
puts(" \"column\",column,\n"); puts(" \"column\",column,\n");
// Need to move hier into scopes and back out if do this puts("\"hier\",fullhier,");
// puts( "\"hier\",std::string{vlSymsp->name()} + hierp,");
puts("\"hier\",std::string{VerilatedModule::name()} + hierp,");
puts(" \"page\",pagep,"); puts(" \"page\",pagep,");
puts(" \"comment\",commentp,"); puts(" \"comment\",commentp,");
puts(" (linescovp[0] ? \"linescov\" : \"\"), linescovp);\n"); puts(" (linescovp[0] ? \"linescov\" : \"\"), linescovp);\n");

View File

@ -1,2 +1,2 @@
# SystemC::Coverage-3 # SystemC::Coverage-3
C 'ft/t_cover_main.vl9n4pagev_line/toblockS9-11h.t' 1 C 'ft/t_cover_main.vl9n4pagev_line/toblockS9-11ht' 1