diff --git a/include/verilated_dpi.cpp b/include/verilated_dpi.cpp index 37b8a878e..9e2b1cf39 100644 --- a/include/verilated_dpi.cpp +++ b/include/verilated_dpi.cpp @@ -80,6 +80,7 @@ void svPutBitselLogic(svLogicVecVal* dp, int bit, svLogic s) { } void svGetPartselBit(svBitVecVal* dp, const svBitVecVal* sp, int lsb, int width) { + // Verilator supports > 32 bit widths, which is an extension to IEEE DPI // See also VL_SEL_WWI const int msb = lsb + width - 1; const int word_shift = VL_BITWORD_I(lsb); @@ -103,6 +104,7 @@ void svGetPartselBit(svBitVecVal* dp, const svBitVecVal* sp, int lsb, int width) dp[VL_WORDS_I(width) - 1] &= VL_MASK_I(width); } void svGetPartselLogic(svLogicVecVal* dp, const svLogicVecVal* sp, int lsb, int width) { + // Verilator supports > 32 bit widths, which is an extension to IEEE DPI const int msb = lsb + width - 1; const int word_shift = VL_BITWORD_I(lsb); if (VL_BITBIT_I(lsb) == 0) { diff --git a/src/V3Task.cpp b/src/V3Task.cpp index 3cab796a2..358811654 100644 --- a/src/V3Task.cpp +++ b/src/V3Task.cpp @@ -337,7 +337,7 @@ struct TaskDpiUtils final { const string frSvType = portp->basicp()->isDpiBitVec() ? "SVBV" : "SVLV"; if (portp->isWide()) { // Need to convert to wide, using special function - frstmt = "VL_SET_W_" + frSvType + "(" + cvtToStr(portp->width()) + ","; + frstmt = "VL_SET_W_" + frSvType + "(" + cvtToStr(portp->width()) + ", "; return true; } else { const AstNodeDType* const dtypep = portp->dtypep()->skipRefp(); @@ -826,7 +826,7 @@ class TaskVisitor final : public VNVisitor { linesp->addNext(srcp); linesp->addNext( new AstText{portvscp->fileline(), - "," + frName + " + " + cvtToStr(i * widthWords) + ");\n"}); + ", " + frName + " + " + cvtToStr(i * widthWords) + ");\n"}); stmtp = new AstCStmt{portvscp->fileline(), linesp}; } else { string from = frstmt; @@ -884,7 +884,7 @@ class TaskVisitor final : public VNVisitor { stmt += "if (VL_UNLIKELY(__Vfuncnum == -1)) __Vfuncnum = Verilated::exportFuncNum(\"" + nodep->cname() + "\");\n"; // If the find fails, it will throw an error - stmt += "const VerilatedScope* __Vscopep = Verilated::dpiScope();\n"; + stmt += "const VerilatedScope* const __Vscopep = Verilated::dpiScope();\n"; // If dpiScope is fails and is null; the exportFind function throws and error const string cbtype = VIdProtect::protect(v3Global.opt.prefix() + "__Vcb_" + nodep->cname() + "_t");