Fix double I/O port warnings.
This commit is contained in:
parent
9c5dd8d767
commit
0dbdbffba7
|
|
@ -200,7 +200,7 @@ string AstVar::verilogKwd() const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string AstVar::vlArgType(bool named, bool forReturn) const {
|
string AstVar::vlArgType(bool named, bool forReturn, bool forFunc) const {
|
||||||
if (forReturn) named=false;
|
if (forReturn) named=false;
|
||||||
if (forReturn) v3fatalSrc("verilator internal data is never passed as return, but as first argument");
|
if (forReturn) v3fatalSrc("verilator internal data is never passed as return, but as first argument");
|
||||||
string arg;
|
string arg;
|
||||||
|
|
@ -233,7 +233,7 @@ string AstVar::vlArgType(bool named, bool forReturn) const {
|
||||||
arg += " (& "+name();
|
arg += " (& "+name();
|
||||||
arg += ")["+cvtToStr(widthWords())+"]";
|
arg += ")["+cvtToStr(widthWords())+"]";
|
||||||
} else {
|
} else {
|
||||||
if (isOutput() || (strtype && isInput())) arg += "&";
|
if (forFunc && (isOutput() || (strtype && isInput()))) arg += "&";
|
||||||
if (named) arg += " "+name();
|
if (named) arg += " "+name();
|
||||||
}
|
}
|
||||||
return arg;
|
return arg;
|
||||||
|
|
|
||||||
|
|
@ -965,7 +965,7 @@ public:
|
||||||
string scType() const; // Return SysC type: bool, uint32_t, uint64_t, sc_bv
|
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 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
|
string vlArgType(bool named, bool forReturn, bool forFunc) const; // Return Verilator internal type for argument: CData, SData, IData, WData
|
||||||
string vlEnumType() const; // Return VerilatorVarType: VLVT_UINT32, etc
|
string vlEnumType() const; // Return VerilatorVarType: VLVT_UINT32, etc
|
||||||
string vlEnumDir() const; // Return VerilatorVarDir: VLVD_INOUT, etc
|
string vlEnumDir() const; // Return VerilatorVarDir: VLVD_INOUT, etc
|
||||||
void combineType(AstVarType type);
|
void combineType(AstVarType type);
|
||||||
|
|
|
||||||
|
|
@ -604,7 +604,15 @@ public:
|
||||||
}
|
}
|
||||||
ofp()->printf(",0x%08" VL_PRI64 "x)", (vluint64_t)(nodep->num().dataWord(0)));
|
ofp()->printf(",0x%08" VL_PRI64 "x)", (vluint64_t)(nodep->num().dataWord(0)));
|
||||||
} else if (nodep->isDouble()) {
|
} else if (nodep->isDouble()) {
|
||||||
ofp()->printf("%.17g", nodep->num().toDouble());
|
if (int(nodep->num().toDouble()) == nodep->num().toDouble()
|
||||||
|
&& nodep->num().toDouble() < 1000
|
||||||
|
&& nodep->num().toDouble() > -1000) {
|
||||||
|
ofp()->printf("%3.1f", nodep->num().toDouble()); // Force decimal point
|
||||||
|
} else {
|
||||||
|
// Not %g as will not always put in decimal point, so not obvious to compiler
|
||||||
|
// is a real number
|
||||||
|
ofp()->printf("%.17e", nodep->num().toDouble());
|
||||||
|
}
|
||||||
} else if (nodep->isQuad()) {
|
} else if (nodep->isQuad()) {
|
||||||
vluint64_t num = nodep->toUQuad();
|
vluint64_t num = nodep->toUQuad();
|
||||||
if (num<10) ofp()->printf("VL_ULL(%" VL_PRI64 "d)", num);
|
if (num<10) ofp()->printf("VL_ULL(%" VL_PRI64 "d)", num);
|
||||||
|
|
@ -922,6 +930,11 @@ void EmitCStmts::emitVarDecl(AstVar* nodep, const string& prefixIfImp) {
|
||||||
puts(nodep->name());
|
puts(nodep->name());
|
||||||
emitDeclArrayBrackets(nodep);
|
emitDeclArrayBrackets(nodep);
|
||||||
puts(";\n");
|
puts(";\n");
|
||||||
|
} else if (basicp && basicp->isOpaque()) {
|
||||||
|
// strings and other fundamental c types; no VL_ macro can be used
|
||||||
|
puts(nodep->vlArgType(true,false,false));
|
||||||
|
emitDeclArrayBrackets(nodep);
|
||||||
|
puts(";\n");
|
||||||
} else { // C++ signals
|
} else { // C++ signals
|
||||||
ofp()->putAlign(nodep->isStatic(), nodep->dtypeSkipRefp()->widthAlignBytes(),
|
ofp()->putAlign(nodep->isStatic(), nodep->dtypeSkipRefp()->widthAlignBytes(),
|
||||||
nodep->dtypeSkipRefp()->widthTotalBytes());
|
nodep->dtypeSkipRefp()->widthTotalBytes());
|
||||||
|
|
@ -945,7 +958,7 @@ void EmitCStmts::emitVarDecl(AstVar* nodep, const string& prefixIfImp) {
|
||||||
}
|
}
|
||||||
} else if (basicp && basicp->isOpaque()) {
|
} else if (basicp && basicp->isOpaque()) {
|
||||||
// strings and other fundamental c types
|
// strings and other fundamental c types
|
||||||
puts(nodep->vlArgType(true,false));
|
puts(nodep->vlArgType(true,false,false));
|
||||||
emitDeclArrayBrackets(nodep);
|
emitDeclArrayBrackets(nodep);
|
||||||
puts(";\n");
|
puts(";\n");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ public:
|
||||||
args += portp->dpiArgType(true,false);
|
args += portp->dpiArgType(true,false);
|
||||||
else if (nodep->funcPublic())
|
else if (nodep->funcPublic())
|
||||||
args += portp->cPubArgType(true,false);
|
args += portp->cPubArgType(true,false);
|
||||||
else args += portp->vlArgType(true,false);
|
else args += portp->vlArgType(true,false,true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue