Part of last change; appease SystemPerl with statics

git-svn-id: file://localhost/svn/verilator/trunk/verilator@764 77ca24e4-aefa-0310-84f0-b9a241c72d87
This commit is contained in:
Wilson Snyder 2006-08-29 12:01:02 +00:00
parent 3b09ceae12
commit 81d2329e88
3 changed files with 18 additions and 5 deletions

View File

@ -68,6 +68,13 @@ public:
//=========================================================================
// Declare nets
#ifndef VL_ST_SIG
# define VL_ST_SIG8(name, msb,lsb) CData name ///< Declare signal, 1-8 bits
# define VL_ST_SIG16(name, msb,lsb) SData name ///< Declare signal, 9-16 bits
# define VL_ST_SIG64(name, msb,lsb) QData name ///< Declare signal, 33-64 bits
# define VL_ST_SIG(name, msb,lsb) IData name ///< Declare signal, 17-32 bits
# define VL_ST_SIGW(name,msb,lsb,words) WData name[words] ///< Declare signal, 65+ bits
#endif
#ifndef VL_SIG
# define VL_SIG8(name, msb,lsb) CData name ///< Declare signal, 1-8 bits
# define VL_SIG16(name, msb,lsb) SData name ///< Declare signal, 9-16 bits

View File

@ -2762,6 +2762,7 @@ private:
bool m_formCallTree:1; // Make a global function to call entire tree of functions
bool m_slow:1; // Slow routine, called once or just at init time
bool m_funcPublic:1; // From user public task/function
bool m_isStatic:1; // Function is declared static (no this)
public:
AstCFunc(FileLine* fl, const string& name, AstScope* scopep, const string& rtnType="")
: AstNode(fl) {
@ -2775,6 +2776,7 @@ public:
m_formCallTree = false;
m_slow = false;
m_funcPublic = false;
m_isStatic = false;
}
virtual ~AstCFunc() {}
virtual AstType type() const { return AstType::CFUNC;}
@ -2804,6 +2806,8 @@ public:
string argTypes() const { return m_argTypes; }
void funcType(AstCFuncType flag) { m_funcType = flag; }
AstCFuncType funcType() const { return m_funcType; }
bool isStatic() const { return m_isStatic; }
void isStatic(bool flag) { m_isStatic = flag; }
//
// If adding node accessors, see below
AstNode* argsp() const { return op1p()->castNode(); }

View File

@ -733,16 +733,17 @@ void EmitCStmts::emitVarDecl(AstVar* nodep, const string& prefixIfImp) {
// For example three VL_SIG8's needs alignment 1 but size 3.
ofp()->putAlign(nodep->isStatic(), nodep->widthAlignBytes(), nodep->arrayElements()*nodep->widthAlignBytes());
if (nodep->isStatic() && prefixIfImp=="") puts("static ");
if (nodep->isStatic()) puts("VL_ST_"); else puts("VL_");
if (nodep->widthMin() <= 8) {
puts("VL_SIG8(");
puts("SIG8(");
} else if (nodep->widthMin() <= 16) {
puts("VL_SIG16(");
puts("SIG16(");
} else if (nodep->isQuad()) {
puts("VL_SIG64(");
puts("SIG64(");
} else if (!nodep->isWide()) {
puts("VL_SIG(");
puts("SIG(");
} else {
puts("VL_SIGW(");
puts("SIGW(");
}
if (prefixIfImp!="") { puts(prefixIfImp); puts("::"); }
puts(nodep->name());
@ -1298,6 +1299,7 @@ void EmitCImp::emitIntFuncDecls(AstModule* modp) {
for (vector<AstCFunc*>::iterator it = funcsp.begin(); it != funcsp.end(); ++it) {
AstCFunc* funcp = *it;
ofp()->putsPrivate(funcp->declPrivate());
if (funcp->isStatic()) puts("static ");
puts(funcp->rtnTypeVoid()); puts("\t");
puts(funcp->name()); puts("("+cFuncArgs(funcp)+");\n");
}