Skip to content

Commit

Permalink
Add coverage comment separator, print nice comments
Browse files Browse the repository at this point in the history
Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
  • Loading branch information
tgorochowik committed Dec 31, 2024
1 parent 64a1d60 commit d48366a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/V3Coverage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ class CoverageVisitor final : public VNVisitor {

void toggleVarBottom(const ToggleEnt& above, const AstVar* varp) {
char comment[100];
snprintf(comment, 100, "toggle_%p_", m_modp);
snprintf(comment, 100, "toggle_%pZ_", m_modp);
AstCoverToggle* const newp = new AstCoverToggle{
varp->fileline(),
newCoverInc(varp->fileline(), "", "v_toggle", string(comment) + varp->name() + above.m_comment, "", 0,
Expand Down Expand Up @@ -434,11 +434,11 @@ class CoverageVisitor final : public VNVisitor {
void visit(AstIf* nodep) override {
UINFO(4, " IF: " << nodep << endl);
char comment_if[100];
snprintf(comment_if, 100, "if_%p", m_modp);
snprintf(comment_if, 100, "if_%pZ", m_modp);
char comment_else[100];
snprintf(comment_else, 100, "else_%p", m_modp);
snprintf(comment_else, 100, "else_%pZ", m_modp);
char comment_elsif[100];
snprintf(comment_elsif, 100, "elsif_%p", m_modp);
snprintf(comment_elsif, 100, "elsif_%pZ", m_modp);
if (m_state.m_on) {
// An else-if. When we iterate the if, use "elsif" marking
const bool elsif
Expand Down Expand Up @@ -518,7 +518,7 @@ class CoverageVisitor final : public VNVisitor {
// We don't add an explicit "default" coverage if not provided,
// as we already have a warning when there is no default.
char comment[100];
snprintf(comment, 100, "case_%p", m_modp);
snprintf(comment, 100, "case_%pZ", m_modp);
UINFO(4, " CASEI: " << nodep << endl);
if (m_state.lineCoverageOn(nodep)) {
VL_RESTORER(m_state);
Expand Down
3 changes: 1 addition & 2 deletions src/VlcTop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ void VlcTop::writeInfo(const string& filename) {
for (const auto& point : sc.points()) {
os << "BRDA:" << sc.lineno() << ",";
os << "0,";
if (point->comment().rfind("toggle") != 0)
os << point->comment() << "_";
os << point->comment().substr(0, point->comment().find("Z")) << "_";
os << point_num << ",";
os << point->count() << "\n";

Expand Down

0 comments on commit d48366a

Please sign in to comment.