Skip to content

Commit

Permalink
Use map of indices only in Verilation
Browse files Browse the repository at this point in the history
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
  • Loading branch information
RRozak committed Jan 13, 2025
1 parent dc43071 commit 76f6836
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/V3EmitCFunc.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ class EmitCLazyDecls final : public VNVisitorConst {

class EmitCFunc VL_NOT_FINAL : public EmitCConstInit {
VMemberMap m_memberMap;
std::map <AstNode*, int> m_indices;
AstVarRef* m_wideTempRefp = nullptr; // Variable that _WW macros should be setting
int m_labelNum = 0; // Next label number
bool m_inUC = false; // Inside an AstUCStmt or AstUCExpr
Expand Down Expand Up @@ -608,6 +609,7 @@ class EmitCFunc VL_NOT_FINAL : public EmitCConstInit {
void visit(AstCoverDecl* nodep) override {
putns(nodep, "vlSelf->__vlCoverInsert("); // As Declared in emitCoverageDecl
puts("&(vlSymsp->__Vcoverage[");
m_indices[nodep] = nodep->dataDeclThisp()->binNum();
puts(cvtToStr(nodep->dataDeclThisp()->binNum()));
puts("])");
// If this isn't the first instantiation of this module under this
Expand Down Expand Up @@ -636,11 +638,11 @@ class EmitCFunc VL_NOT_FINAL : public EmitCConstInit {
void visit(AstCoverInc* nodep) override {
if (v3Global.opt.threads() > 1) {
putns(nodep, "vlSymsp->__Vcoverage[");
puts(cvtToStr(nodep->declp()->dataDeclThisp()->binNum()));
puts(cvtToStr(m_indices[nodep->declp()]));
puts("].fetch_add(1, std::memory_order_relaxed);\n");
} else {
putns(nodep, "++(vlSymsp->__Vcoverage[");
puts(cvtToStr(nodep->declp()->dataDeclThisp()->binNum()));
puts(cvtToStr(m_indices[nodep->declp()]));
puts("]);\n");
}
}
Expand Down

0 comments on commit 76f6836

Please sign in to comment.