mirror of
https://github.com/verilator/verilator.git
synced 2025-01-25 07:44:14 +00:00
Remove old MSVC 6 workarounds
This commit is contained in:
parent
829db3eefa
commit
cb550e5357
@ -1663,13 +1663,11 @@ class EmitCImp : EmitCStmts {
|
|||||||
} else if (AstInitArray* initarp = VN_CAST(varp->valuep(), InitArray)) {
|
} else if (AstInitArray* initarp = VN_CAST(varp->valuep(), InitArray)) {
|
||||||
if (AstUnpackArrayDType* adtypep = VN_CAST(dtypep, UnpackArrayDType)) {
|
if (AstUnpackArrayDType* adtypep = VN_CAST(dtypep, UnpackArrayDType)) {
|
||||||
if (initarp->defaultp()) {
|
if (initarp->defaultp()) {
|
||||||
// MSVC++ pre V7 doesn't support 'for (int ...)', so declare in sep block
|
puts("for (int __Vi=0; __Vi<" + cvtToStr(adtypep->elementsConst()));
|
||||||
puts("{ int __Vi=0;");
|
|
||||||
puts(" for (; __Vi<" + cvtToStr(adtypep->elementsConst()));
|
|
||||||
puts("; ++__Vi) {\n");
|
puts("; ++__Vi) {\n");
|
||||||
emitSetVarConstant(varp->nameProtect() + "[__Vi]",
|
emitSetVarConstant(varp->nameProtect() + "[__Vi]",
|
||||||
VN_CAST(initarp->defaultp(), Const));
|
VN_CAST(initarp->defaultp(), Const));
|
||||||
puts("}}\n");
|
puts("}\n");
|
||||||
}
|
}
|
||||||
const AstInitArray::KeyItemMap& mapr = initarp->map();
|
const AstInitArray::KeyItemMap& mapr = initarp->map();
|
||||||
for (AstInitArray::KeyItemMap::const_iterator it = mapr.begin(); it != mapr.end();
|
for (AstInitArray::KeyItemMap::const_iterator it = mapr.begin(); it != mapr.end();
|
||||||
@ -1711,12 +1709,11 @@ class EmitCImp : EmitCStmts {
|
|||||||
UASSERT_OBJ(adtypep->msb() >= adtypep->lsb(), varp,
|
UASSERT_OBJ(adtypep->msb() >= adtypep->lsb(), varp,
|
||||||
"Should have swapped msb & lsb earlier.");
|
"Should have swapped msb & lsb earlier.");
|
||||||
string ivar = string("__Vi") + cvtToStr(depth);
|
string ivar = string("__Vi") + cvtToStr(depth);
|
||||||
// MSVC++ pre V7 doesn't support 'for (int ...)', so declare in sep block
|
string pre = ("for (int " + ivar + "=" + cvtToStr(0) + "; " + ivar + "<"
|
||||||
string pre = ("{ int " + ivar + "=" + cvtToStr(0) + ";" + " for (; " + ivar + "<"
|
|
||||||
+ cvtToStr(adtypep->elementsConst()) + "; ++" + ivar + ") {\n");
|
+ cvtToStr(adtypep->elementsConst()) + "; ++" + ivar + ") {\n");
|
||||||
string below = emitVarResetRecurse(varp, adtypep->subDTypep(), depth + 1,
|
string below = emitVarResetRecurse(varp, adtypep->subDTypep(), depth + 1,
|
||||||
suffix + "[" + ivar + "]");
|
suffix + "[" + ivar + "]");
|
||||||
string post = "}}\n";
|
string post = "}\n";
|
||||||
return below.empty() ? "" : pre + below + post;
|
return below.empty() ? "" : pre + below + post;
|
||||||
} else if (basicp && basicp->keyword() == AstBasicDTypeKwd::STRING) {
|
} else if (basicp && basicp->keyword() == AstBasicDTypeKwd::STRING) {
|
||||||
// String's constructor deals with it
|
// String's constructor deals with it
|
||||||
@ -2508,10 +2505,8 @@ void EmitCImp::emitSavableImp(AstNodeModule* modp) {
|
|||||||
UASSERT_OBJ(arrayp->msb() >= arrayp->lsb(), varp,
|
UASSERT_OBJ(arrayp->msb() >= arrayp->lsb(), varp,
|
||||||
"Should have swapped msb & lsb earlier.");
|
"Should have swapped msb & lsb earlier.");
|
||||||
string ivar = string("__Vi") + cvtToStr(vecnum);
|
string ivar = string("__Vi") + cvtToStr(vecnum);
|
||||||
// MSVC++ pre V7 doesn't support 'for (int ...)',
|
puts("for (int __Vi" + cvtToStr(vecnum) + "=" + cvtToStr(0));
|
||||||
// so declare in sep block
|
puts("; " + ivar + "<" + cvtToStr(arrayp->elementsConst()));
|
||||||
puts("{ int __Vi" + cvtToStr(vecnum) + "=" + cvtToStr(0) + ";");
|
|
||||||
puts(" for (; " + ivar + "<" + cvtToStr(arrayp->elementsConst()));
|
|
||||||
puts("; ++" + ivar + ") {\n");
|
puts("; ++" + ivar + ") {\n");
|
||||||
elementp = arrayp->subDTypep()->skipRefp();
|
elementp = arrayp->subDTypep()->skipRefp();
|
||||||
}
|
}
|
||||||
@ -2522,14 +2517,14 @@ void EmitCImp::emitSavableImp(AstNodeModule* modp) {
|
|||||||
&& !(basicp && basicp->keyword() == AstBasicDTypeKwd::STRING)) {
|
&& !(basicp && basicp->keyword() == AstBasicDTypeKwd::STRING)) {
|
||||||
int vecnum = vects++;
|
int vecnum = vects++;
|
||||||
string ivar = string("__Vi") + cvtToStr(vecnum);
|
string ivar = string("__Vi") + cvtToStr(vecnum);
|
||||||
puts("{ int __Vi" + cvtToStr(vecnum) + "=" + cvtToStr(0) + ";");
|
puts("for (int __Vi" + cvtToStr(vecnum) + "=" + cvtToStr(0));
|
||||||
puts(" for (; " + ivar + "<" + cvtToStr(elementp->widthWords()));
|
puts("; " + ivar + "<" + cvtToStr(elementp->widthWords()));
|
||||||
puts("; ++" + ivar + ") {\n");
|
puts("; ++" + ivar + ") {\n");
|
||||||
}
|
}
|
||||||
puts("os" + op + varp->nameProtect());
|
puts("os" + op + varp->nameProtect());
|
||||||
for (int v = 0; v < vects; ++v) puts("[__Vi" + cvtToStr(v) + "]");
|
for (int v = 0; v < vects; ++v) puts("[__Vi" + cvtToStr(v) + "]");
|
||||||
puts(";\n");
|
puts(";\n");
|
||||||
for (int v = 0; v < vects; ++v) puts("}}\n");
|
for (int v = 0; v < vects; ++v) puts("}\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2597,16 +2592,14 @@ void EmitCImp::emitSensitives() {
|
|||||||
UASSERT_OBJ(arrayp->msb() >= arrayp->lsb(), varp,
|
UASSERT_OBJ(arrayp->msb() >= arrayp->lsb(), varp,
|
||||||
"Should have swapped msb & lsb earlier.");
|
"Should have swapped msb & lsb earlier.");
|
||||||
string ivar = string("__Vi") + cvtToStr(vecnum);
|
string ivar = string("__Vi") + cvtToStr(vecnum);
|
||||||
// MSVC++ pre V7 doesn't support 'for (int ...)', so declare in sep block
|
puts("for (int __Vi" + cvtToStr(vecnum) + "=" + cvtToStr(arrayp->lsb()));
|
||||||
puts("{ int __Vi" + cvtToStr(vecnum) + "=" + cvtToStr(arrayp->lsb())
|
puts("; " + ivar + "<=" + cvtToStr(arrayp->msb()));
|
||||||
+ ";");
|
|
||||||
puts(" for (; " + ivar + "<=" + cvtToStr(arrayp->msb()));
|
|
||||||
puts("; ++" + ivar + ") {\n");
|
puts("; ++" + ivar + ") {\n");
|
||||||
}
|
}
|
||||||
puts("sensitive << " + varp->nameProtect());
|
puts("sensitive << " + varp->nameProtect());
|
||||||
for (int v = 0; v < vects; ++v) puts("[__Vi" + cvtToStr(v) + "]");
|
for (int v = 0; v < vects; ++v) puts("[__Vi" + cvtToStr(v) + "]");
|
||||||
puts(";\n");
|
puts(";\n");
|
||||||
for (int v = 0; v < vects; ++v) puts("}}\n");
|
for (int v = 0; v < vects; ++v) puts("}\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user