DPI svSetScope is speced to return last scope, not new one

This commit is contained in:
Wilson Snyder 2009-12-08 21:35:15 -05:00
parent 6a2aa7e4f0
commit 3386466e7a
5 changed files with 6 additions and 5 deletions

View File

@ -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) {

View File

@ -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 ";

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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());