Fix dpiSetScope to really set the scope.

This commit is contained in:
Wilson Snyder 2009-12-16 21:28:35 -05:00
parent 45b0e63be2
commit ebe8f554c6
3 changed files with 7 additions and 5 deletions

View File

@ -201,7 +201,7 @@ public:
static const char* catName(const char* n1, const char* n2); // Returns new'ed data
// Internal: Get and set DPI context
static const VerilatedScope* dpiScope() { return t_dpiScopep; }
static void dpiScope(const VerilatedScope* scopep) { scopep=t_dpiScopep; }
static void dpiScope(const VerilatedScope* scopep) { t_dpiScopep=scopep; }
static void dpiContext(const VerilatedScope* scopep, const char* filenamep, int lineno) {
t_dpiScopep=scopep; t_dpiFilename=filenamep; t_dpiLineno=lineno; }
static void dpiClearContext() { t_dpiScopep = NULL; }

View File

@ -228,8 +228,8 @@ public:
static const char* names[] = {
"unsigned char", "char", "void*", "int", "int", "svLogic", "long long",
"double", "double", "short int", "float", "long long",
"dpiScope", "const char*",
"char*",
"dpiScope", "const char*",
""
};
return names[m_e];

View File

@ -2330,7 +2330,7 @@ struct AstFGetC : public AstNodeUniop {
ASTNODE_NODE_FUNCS(FGetC, FGETC)
virtual void numberOperate(V3Number& out, const V3Number& lhs) { V3ERROR_NA; }
virtual string emitVerilog() { return "%k$fgetc(%l)"; }
// Non-existant filehandle returns EOF
// Non-existent filehandle returns EOF
virtual string emitC() { return "(%li ? fgetc(VL_CVT_Q_FP(%li)) : -1)"; }
virtual bool cleanOut() {return false;} virtual bool cleanLhs() {return true;}
virtual bool sizeMattersLhs() {return false;}
@ -3267,7 +3267,6 @@ public:
if (setwidth) { width(setwidth,setwidth); }
}
ASTNODE_NODE_FUNCS(CMath, CMATH)
AstNode* bodysp() const { return op1p()->castNode(); } // op1= expressions to print
virtual bool isGateOptimizable() const { return false; }
virtual bool isPredictOptimizable() const { return false; }
virtual bool cleanOut() { return m_cleanOut; }
@ -3275,6 +3274,8 @@ public:
virtual string emitC() { V3ERROR_NA; return ""; }
virtual V3Hash sameHash() const { return V3Hash(); }
virtual bool same(AstNode* samep) const { return true; }
void addBodysp(AstNode* nodep) { addNOp1p(nodep); }
AstNode* bodysp() const { return op1p()->castNode(); } // op1= expressions to print
};
@ -3289,11 +3290,12 @@ struct AstCStmt : public AstNodeStmt {
addNOp1p(new AstText(fl, textStmt, true));
}
ASTNODE_NODE_FUNCS(CStmt, CSTMT)
AstNode* bodysp() const { return op1p()->castNode(); } // op1= expressions to print
virtual bool isGateOptimizable() const { return false; }
virtual bool isPredictOptimizable() const { return false; }
virtual V3Hash sameHash() const { return V3Hash(); }
virtual bool same(AstNode* samep) const { return true; }
void addBodysp(AstNode* nodep) { addNOp1p(nodep); }
AstNode* bodysp() const { return op1p()->castNode(); } // op1= expressions to print
};
//######################################################################