From 3386466e7a2816b66a907ef8f3fa4e5dbf9aa89c Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Tue, 8 Dec 2009 21:35:15 -0500 Subject: [PATCH] DPI svSetScope is speced to return last scope, not new one --- include/verilateddpi.cpp | 3 ++- src/V3AstNodes.cpp | 2 +- src/V3AstNodes.h | 2 +- src/V3EmitC.cpp | 2 +- src/V3Task.cpp | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/verilateddpi.cpp b/include/verilateddpi.cpp index bc6d0d816..de3dd4a09 100644 --- a/include/verilateddpi.cpp +++ b/include/verilateddpi.cpp @@ -258,9 +258,10 @@ svScope svGetScope() { } svScope svSetScope(const svScope scope) { + const VerilatedScope* prevScopep = Verilated::dpiScope(); const VerilatedScope* vscopep = (const VerilatedScope*)(scope); Verilated::dpiScope(vscopep); - return (svScope)vscopep; + return (svScope)prevScopep; } const char* svGetNameFromScope(const svScope scope) { diff --git a/src/V3AstNodes.cpp b/src/V3AstNodes.cpp index 8e06977b0..a358532f1 100644 --- a/src/V3AstNodes.cpp +++ b/src/V3AstNodes.cpp @@ -133,7 +133,7 @@ string AstVar::vlArgType(bool named, bool forReturn) const { return arg; } -string AstVar::cpubArgType(bool named, bool forReturn) const { +string AstVar::cPubArgType(bool named, bool forReturn) const { if (forReturn) named=false; string arg; if (isWide() && isInOnly()) arg += "const "; diff --git a/src/V3AstNodes.h b/src/V3AstNodes.h index 980775f2d..6c6aea34b 100644 --- a/src/V3AstNodes.h +++ b/src/V3AstNodes.h @@ -483,7 +483,7 @@ public: void varType2Out() { m_tristate=0; m_input=0; m_output=1; } void varType2In() { m_tristate=0; m_input=1; m_output=0; } string scType() const; // Return SysC type: bool, uint32_t, uint64_t, sc_bv - string cpubArgType(bool named, bool forReturn) const; // Return C /*public*/ type for argument: bool, uint32_t, uint64_t, etc. + string cPubArgType(bool named, bool forReturn) const; // Return C /*public*/ type for argument: bool, uint32_t, uint64_t, etc. string dpiArgType(bool named, bool forReturn) const; // Return DPI-C type for argument string vlArgType(bool named, bool forReturn) const; // Return Verilator internal type for argument: CData, SData, IData, WData void combineType(AstVarType type); diff --git a/src/V3EmitC.cpp b/src/V3EmitC.cpp index 34297915a..5c985ed16 100644 --- a/src/V3EmitC.cpp +++ b/src/V3EmitC.cpp @@ -91,7 +91,7 @@ public: if (portp->isIO() && !portp->isFuncReturn()) { if (args != "") args+= ", "; if (nodep->dpiImport()) args += portp->dpiArgType(true,false); - else if (nodep->funcPublic()) args += portp->cpubArgType(true,false); + else if (nodep->funcPublic()) args += portp->cPubArgType(true,false); else args += portp->vlArgType(true,false); } } diff --git a/src/V3Task.cpp b/src/V3Task.cpp index a3d38350b..4b64e137d 100644 --- a/src/V3Task.cpp +++ b/src/V3Task.cpp @@ -671,7 +671,7 @@ private: AstCFunc* cfuncp = new AstCFunc(nodep->fileline(), prefix + nodep->name() + suffix, m_scopep, - ((nodep->taskPublic() && rtnvarp)?rtnvarp->cpubArgType(true,true):"")); + ((nodep->taskPublic() && rtnvarp)?rtnvarp->cPubArgType(true,true):"")); // It's ok to combine imports because this is just a wrapper; duplicate wrappers can get merged. cfuncp->dontCombine(!nodep->dpiImport()); cfuncp->entryPoint (!nodep->dpiImport());