Fix DPI import/export to be standard compliant, #2236.

This commit is contained in:
Geza Lore 2020-04-07 19:07:47 -04:00 committed by Wilson Snyder
parent 4556b6c022
commit 0cfa828572
42 changed files with 9907 additions and 217 deletions

View File

@ -9,6 +9,8 @@ The contributors that suggested a given feature are shown in []. Thanks!
** Configuring with ccache present now defaults to using it; see OBJCACHE.
** Fix DPI import/export to be standard compliant, #2236. [Geza Lore]
**** Support $ferror, and $fflush without arguments, #1638.

View File

@ -32,7 +32,7 @@
//===================================================================
// SETTING OPERATORS
/// Return WData from svBitVecVal
/// Convert svBitVecVal to Verilator internal data
static inline void VL_SET_W_SVBV(int obits, WDataOutP owp, const svBitVecVal* lwp) VL_MT_SAFE {
int words = VL_WORDS_I(obits);
for (int i = 0; i < words - 1; ++i) {
@ -40,7 +40,14 @@ static inline void VL_SET_W_SVBV(int obits, WDataOutP owp, const svBitVecVal* lw
}
owp[words - 1] = lwp[words - 1] & VL_MASK_I(obits);
}
/// Return svBitVecVal from WData
static inline QData VL_SET_Q_SVBV(const svBitVecVal* lwp) VL_MT_SAFE {
return _VL_SET_QII(lwp[1], lwp[0]);
}
static inline IData VL_SET_I_SVBV(const svBitVecVal* lwp) VL_MT_SAFE {
return lwp[0];
}
/// Convert Verilator internal data to svBitVecVal
static inline void VL_SET_SVBV_W(int obits, svBitVecVal* owp, WDataInP lwp) VL_MT_SAFE {
int words = VL_WORDS_I(obits);
for (int i = 0; i < words - 1; ++i) {
@ -48,8 +55,14 @@ static inline void VL_SET_SVBV_W(int obits, svBitVecVal* owp, WDataInP lwp) VL_M
}
owp[words - 1] = lwp[words - 1] & VL_MASK_I(obits);
}
static inline void VL_SET_SVBV_I(int, svBitVecVal* owp, IData ld) VL_MT_SAFE {
owp[0] = ld;
}
static inline void VL_SET_SVBV_Q(int, svBitVecVal* owp, QData ld) VL_MT_SAFE {
VL_SET_WQ(owp, ld);
}
/// Convert svLogicVecVal to/from WData
/// Convert svLogicVecVal to Verilator internal data
/// Note these functions ignore X/Z in svLogicVecVal
static inline void VL_SET_W_SVLV(int obits, WDataOutP owp, const svLogicVecVal* lwp) VL_MT_SAFE {
int words = VL_WORDS_I(obits);
@ -64,6 +77,9 @@ static inline QData VL_SET_Q_SVLV(const svLogicVecVal* lwp) VL_MT_SAFE {
static inline IData VL_SET_I_SVLV(const svLogicVecVal* lwp) VL_MT_SAFE {
return lwp[0].aval;
}
/// Convert Verilator internal data to svLogicVecVal
/// Note these functions never create X/Z in svLogicVecVal
static inline void VL_SET_SVLV_W(int obits, svLogicVecVal* owp, WDataInP lwp) VL_MT_SAFE {
int words = VL_WORDS_I(obits);
for (int i = 0; i < words; ++i) {

View File

@ -1209,6 +1209,11 @@ AstNodeDType* AstNode::findLogicRangeDType(const VNumRange& range, int widthMin,
return v3Global.rootp()->typeTablep()
->findLogicBitDType(fileline(), AstBasicDTypeKwd::LOGIC, range, widthMin, numeric);
}
AstNodeDType* AstNode::findBitRangeDType(const VNumRange& range, int widthMin,
AstNumeric numeric) const {
return v3Global.rootp()->typeTablep()
->findLogicBitDType(fileline(), AstBasicDTypeKwd::BIT, range, widthMin, numeric);
}
AstBasicDType* AstNode::findInsertSameDType(AstBasicDType* nodep) {
return v3Global.rootp()->typeTablep()
->findInsertSameDType(nodep);

View File

@ -397,12 +397,12 @@ public:
const char* dpiType() const {
static const char* const names[] = {
"%E-unk",
"unsigned char", "char", "void*", "int", "int", "svLogic", "long long",
"double", "short int", "float", "long long",
"svBit", "char", "void*", "int", "%E-integer", "svLogic", "long long",
"double", "short", "float", "%E-time",
"const char*",
"dpiScope", "const char*",
"IData", "QData",
"svLogic", // Though shouldn't be needed
"%E-logic-implicit",
" MAX"
};
return names[m_e];
@ -446,7 +446,7 @@ public:
|| m_e==UINT32 || m_e==UINT64;
}
bool isFourstate() const {
return m_e==INTEGER || m_e==LOGIC || m_e==LOGIC_IMPLICIT;
return m_e == INTEGER || m_e == LOGIC || m_e == LOGIC_IMPLICIT || m_e == TIME;
}
bool isZeroInit() const { // Otherwise initializes to X
return (m_e==BIT || m_e==BYTE || m_e==CHANDLE || m_e==INT || m_e==LONGINT || m_e==SHORTINT
@ -462,15 +462,6 @@ public:
bool isBitLogic() const { // Bit/logic vector types; can form a packed array
return (m_e==LOGIC || m_e==BIT);
}
bool isDpiBitVal() const { // DPI uses svBitVecVal
return m_e==BIT;
}
bool isDpiLogicVal() const { // DPI uses svLogicVecVal
return m_e==INTEGER || m_e==LOGIC || m_e==LOGIC_IMPLICIT || m_e==TIME;
}
bool isDpiUnreturnable() const { // Not legal as DPI function return
return isDpiLogicVal();
}
bool isDpiUnsignable() const { // Can add "unsigned" to DPI
return (m_e==BYTE || m_e==SHORTINT || m_e==INT || m_e==LONGINT || m_e==INTEGER);
}
@ -1561,6 +1552,8 @@ public:
AstNodeDType* findLogicDType(int width, int widthMin, AstNumeric numeric) const;
AstNodeDType* findLogicRangeDType(const VNumRange& range, int widthMin,
AstNumeric numeric) const;
AstNodeDType* findBitRangeDType(const VNumRange& range, int widthMin,
AstNumeric numeric) const;
AstNodeDType* findBasicDType(AstBasicDTypeKwd kwd) const;
AstBasicDType* findInsertSameDType(AstBasicDType* nodep);
@ -2117,9 +2110,13 @@ public:
virtual void dump(std::ostream& str) const;
// For basicp() we reuse the size to indicate a "fake" basic type of same size
virtual AstBasicDType* basicp() const {
return (isFourstate()
? VN_CAST(findLogicDType(width(), width(), numeric()), BasicDType)
: VN_CAST(findBitDType(width(), width(), numeric()), BasicDType)); }
return (isFourstate() ? VN_CAST(findLogicRangeDType(VNumRange(width() - 1, 0, false),
width(), numeric()),
BasicDType)
: VN_CAST(findBitRangeDType(VNumRange(width() - 1, 0, false),
width(), numeric()),
BasicDType));
}
virtual AstNodeDType* skipRefp() const { return (AstNodeDType*)this; }
virtual AstNodeDType* skipRefToConstp() const { return (AstNodeDType*)this; }
virtual AstNodeDType* skipRefToEnump() const { return (AstNodeDType*)this; }

View File

@ -499,31 +499,21 @@ string AstVar::dpiArgType(bool named, bool forReturn) const {
arg = "const svOpenArrayHandle";
} else if (!basicp()) {
arg = "UNKNOWN";
} else if (basicp()->keyword().isDpiBitVal()) {
if (widthMin() == 1) {
arg = "unsigned char";
if (!forReturn && isWritable()) arg += "*";
} else if (basicp()->isDpiBitVec()) {
if (forReturn) {
arg = "svBitVecVal";
} else if (isReadOnly()) {
arg = "const svBitVecVal*";
} else {
if (forReturn) {
arg = "svBitVecVal";
} else if (isReadOnly()) {
arg = "const svBitVecVal*";
} else {
arg = "svBitVecVal*";
}
arg = "svBitVecVal*";
}
} else if (basicp()->keyword().isDpiLogicVal()) {
if (widthMin() == 1) {
arg = "unsigned char";
if (!forReturn && isWritable()) arg += "*";
} else if (basicp()->isDpiLogicVec()) {
if (forReturn) {
arg = "svLogicVecVal";
} else if (isReadOnly()) {
arg = "const svLogicVecVal*";
} else {
if (forReturn) {
arg = "svLogicVecVal";
} else if (isReadOnly()) {
arg = "const svLogicVecVal*";
} else {
arg = "svLogicVecVal*";
}
arg = "svLogicVecVal*";
}
} else {
arg = basicp()->keyword().dpiType();

View File

@ -753,6 +753,15 @@ public:
bool isSloppy() const { return keyword().isSloppy(); }
bool isZeroInit() const { return keyword().isZeroInit(); }
bool isRanged() const { return rangep() || m.m_nrange.ranged(); }
bool isDpiBitVec() const { // DPI uses svBitVecVal
return keyword() == AstBasicDTypeKwd::BIT && isRanged();
}
bool isDpiLogicVec() const { // DPI uses svLogicVecVal
return keyword().isFourstate() && !(keyword() == AstBasicDTypeKwd::LOGIC && !isRanged());
}
bool isDpiPrimitive() const { // DPI uses a primitive type
return !isDpiBitVec() && !isDpiLogicVec();
}
const VNumRange& nrange() const { return m.m_nrange; } // Generally the msb/lsb/etc funcs should be used instead
int msb() const { return (rangep() ? rangep()->msbConst() : m.m_nrange.hi()); }
int lsb() const { return (rangep() ? rangep()->lsbConst() : m.m_nrange.lo()); }

View File

@ -367,7 +367,7 @@ class ProtectVisitor : public AstNVisitor {
string cInputConnection(AstVar* varp) {
string frstmt;
bool useSetWSvlv = V3Task::dpiToInternalFrStmt(varp, varp->name(), true, frstmt);
bool useSetWSvlv = V3Task::dpiToInternalFrStmt(varp, varp->name(), frstmt);
if (useSetWSvlv) {
return frstmt+" handlep__V->"+varp->name()+", "+varp->name()+");\n";
}
@ -424,11 +424,10 @@ class ProtectVisitor : public AstNVisitor {
m_seqAssignsp->addText(fl, varp->name()+" = "+varp->name()+"_seq__V;\n");
m_comboAssignsp->addText(fl, varp->name()+" = "+varp->name()+"_combo__V;\n");
m_cComboParamsp->addText(fl, varp->dpiArgType(true, false)+"\n");
m_cComboOutsp->addText(fl, V3Task::assignInternalToDpi(varp, false, true, "", "",
"handlep__V->"));
m_cComboOutsp->addText(fl,
V3Task::assignInternalToDpi(varp, true, "", "", "handlep__V->"));
m_cSeqParamsp->addText(fl, varp->dpiArgType(true, false)+"\n");
m_cSeqOutsp->addText(fl, V3Task::assignInternalToDpi(varp, false, true, "", "",
"handlep__V->"));
m_cSeqOutsp->addText(fl, V3Task::assignInternalToDpi(varp, true, "", "", "handlep__V->"));
}
public:

View File

@ -597,34 +597,25 @@ private:
}
AstNode* createDpiTemp(AstVar* portp, const string& suffix) {
bool bitvec = (portp->basicp()->keyword().isDpiBitVal() && portp->width() > 32);
bool logicvec = (portp->basicp()->keyword().isDpiLogicVal() && portp->width() > 1);
string stmt;
if (bitvec) {
stmt += "svBitVecVal "+portp->name()+suffix;
stmt += " ["+cvtToStr(portp->widthWords())+"]";
} else if (logicvec) {
stmt += "svLogicVecVal "+portp->name()+suffix;
stmt += " ["+cvtToStr(portp->widthWords())+"]";
} else {
stmt += portp->dpiArgType(true, true);
stmt += " "+portp->name()+suffix;
string stmt = portp->dpiArgType(false, true) + " " +portp->name()+suffix;
if (!portp->basicp()->isDpiPrimitive()) {
stmt += "[" + cvtToStr(portp->widthWords()) + "]";
}
stmt += ";\n";
return new AstCStmt(portp->fileline(), stmt);
}
AstNode* createAssignInternalToDpi(AstVar* portp, bool isRtn, bool isPtr,
const string& frSuffix, const string& toSuffix) {
string stmt = V3Task::assignInternalToDpi(portp, isRtn, isPtr, frSuffix, toSuffix);
AstNode* createAssignInternalToDpi(AstVar* portp, bool isPtr, const string& frSuffix,
const string& toSuffix) {
string stmt = V3Task::assignInternalToDpi(portp, isPtr, frSuffix, toSuffix);
return new AstCStmt(portp->fileline(), stmt);
}
AstNode* createAssignDpiToInternal(AstVarScope* portvscp, const string& frName, bool cvt) {
AstNode* createAssignDpiToInternal(AstVarScope* portvscp, const string& frName) {
// Create assignment from DPI temporary into internal format
AstVar* portp = portvscp->varp();
string frstmt;
bool useSetWSvlv = V3Task::dpiToInternalFrStmt(portp, frName, cvt, frstmt);
bool useSetWSvlv = V3Task::dpiToInternalFrStmt(portp, frName, frstmt);
if (useSetWSvlv) {
AstNode* linesp = new AstText(portp->fileline(), frstmt);
linesp->addNext(new AstVarRef(portp->fileline(), portvscp, true));
@ -712,7 +703,10 @@ private:
argnodesp = argnodesp->addNextNull(refp);
if (portp->isNonOutput()) {
dpip->addStmtsp(createAssignDpiToInternal(outvscp, portp->name(), false));
std::string frName
= portp->isInoutish() && portp->basicp()->isDpiPrimitive() ? "*" : "";
frName += portp->name();
dpip->addStmtsp(createAssignDpiToInternal(outvscp, frName));
}
}
}
@ -749,15 +743,16 @@ private:
for (AstNode* stmtp = nodep->stmtsp(); stmtp; stmtp=stmtp->nextp()) {
if (AstVar* portp = VN_CAST(stmtp, Var)) {
if (portp->isIO() && portp->isWritable() && !portp->isFuncReturn()) {
dpip->addStmtsp(createAssignInternalToDpi(portp, false, true, "__Vcvt", ""));
dpip->addStmtsp(createAssignInternalToDpi(portp, true, "__Vcvt", ""));
}
}
}
if (rtnvarp) {
dpip->addStmtsp(createDpiTemp(rtnvarp, ""));
dpip->addStmtsp(createAssignInternalToDpi(rtnvarp, true, false, "__Vcvt", ""));
string stmt = "return "+rtnvarp->name()+";\n";
dpip->addStmtsp(createAssignInternalToDpi(rtnvarp, false, "__Vcvt", ""));
string stmt = "return " + rtnvarp->name();
stmt += rtnvarp->basicp()->isDpiPrimitive() ? ";\n" : "[0];\n";
dpip->addStmtsp(new AstCStmt(nodep->fileline(), stmt));
}
makePortList(nodep, dpip);
@ -842,15 +837,10 @@ private:
&& portp->name() != "__Vscopep" // Passed to dpiContext, not callee
&& portp->name() != "__Vfilenamep"
&& portp->name() != "__Vlineno") {
bool openarray = portp->isDpiOpenArray();
bool bitvec = (portp->basicp()->keyword().isDpiBitVal()
&& portp->width() > 32);
bool logicvec = (portp->basicp()->keyword().isDpiLogicVal()
&& portp->width() > 1);
if (args != "") { args+= ", "; }
if (openarray) {
if (portp->isDpiOpenArray()) {
// Ideally we'd make a table of variable
// characteristics, and reuse it wherever we can
// At least put them into the module's CTOR as static?
@ -870,18 +860,16 @@ private:
args += "&"+name;
}
else {
if (bitvec) {}
else if (logicvec) {}
else if (portp->isWritable()) args += "&";
else if (portp->basicp() && portp->basicp()->keyword().isDpiBitVal()
&& portp->width() != 1) args += "&"; // it's a svBitVecVal (2-32 bits wide)
if (portp->isWritable() && portp->basicp()->isDpiPrimitive()) {
args += "&";
}
args += portp->name()+"__Vcvt";
cfuncp->addStmtsp(createDpiTemp(portp, "__Vcvt"));
if (portp->isNonOutput()) {
cfuncp->addStmtsp(createAssignInternalToDpi(
portp, false, false, "", "__Vcvt"));
cfuncp->addStmtsp(
createAssignInternalToDpi(portp, false, "", "__Vcvt"));
}
}
}
@ -897,8 +885,9 @@ private:
{ // Call the user function
string stmt;
if (rtnvscp) { // isFunction will no longer work as we unlinked the return var
stmt += (rtnvscp->varp()->dpiArgType(true, true)
+ " "+rtnvscp->varp()->name()+"__Vcvt = ");
cfuncp->addStmtsp(createDpiTemp(rtnvscp->varp(), "__Vcvt"));
stmt = rtnvscp->varp()->name() + "__Vcvt";
stmt += rtnvscp->varp()->basicp()->isDpiPrimitive() ? " = " : "[0] = ";
}
stmt += nodep->cname()+"("+args+");\n";
cfuncp->addStmtsp(new AstCStmt(nodep->fileline(), stmt));
@ -911,7 +900,8 @@ private:
if (portp->isIO() && (portp->isWritable() || portp->isFuncReturn())
&& !portp->isDpiOpenArray()) {
AstVarScope* portvscp = VN_CAST(portp->user2p(), VarScope); // Remembered when we created it earlier
cfuncp->addStmtsp(createAssignDpiToInternal(portvscp, portp->name()+"__Vcvt", true));
cfuncp->addStmtsp(
createAssignDpiToInternal(portvscp, portp->name() + "__Vcvt"));
}
}
}
@ -927,14 +917,30 @@ private:
AstVar* portp = VN_CAST(nodep->fvarp(), Var);
UASSERT_OBJ(portp, nodep, "function without function output variable");
if (!portp->isFuncReturn()) nodep->v3error("Not marked as function return var");
if (portp->isWide()) nodep->v3error("Unsupported: Public functions with return > 64 bits wide. (Make it a output instead.)");
if (ftaskNoInline || nodep->dpiExport()) portp->funcReturn(false); // Converting return to 'outputs'
if ((nodep->dpiImport() || nodep->dpiExport())
&& portp->dtypep()->basicp()
&& portp->dtypep()->basicp()->keyword().isDpiUnreturnable()) {
portp->v3error("DPI function may not return type "
<<portp->basicp()->prettyTypeName()
<<" (IEEE 1800-2017 35.5.5)");
if (nodep->dpiImport() || nodep->dpiExport()) {
AstBasicDType* bdtypep = portp->dtypep()->basicp();
if (!bdtypep->isDpiPrimitive()) {
if (bdtypep->isDpiBitVec() && portp->width() > 32) {
portp->v3error("DPI function may not return a > 32 bits wide type "
"other than basic types.\n"
+ V3Error::warnMore()
+ "... Suggest make it an output argument instead?");
}
if (bdtypep->isDpiLogicVec()) {
portp->v3error("DPI function may not return a 4-state type "
"other than a single 'logic' (IEEE 1800-2017 35.5.5)");
}
}
} else {
if (portp->isWide()) {
nodep->v3error("Unsupported: Public functions with return > 64 bits wide.\n"
+ V3Error::warnMore()
+ "... Suggest make it an output argument instead?");
}
}
if (ftaskNoInline || nodep->dpiExport()) {
portp->funcReturn(false); // Converting return to 'outputs'
}
portp->unlinkFrBack();
rtnvarp = portp;
@ -1451,34 +1457,22 @@ V3TaskConnects V3Task::taskConnects(AstNodeFTaskRef* nodep, AstNode* taskStmtsp)
return tconnects;
}
string V3Task::assignInternalToDpi(AstVar* portp, bool isRtn, bool isPtr,
string V3Task::assignInternalToDpi(AstVar* portp, bool isPtr,
const string& frSuffix, const string& toSuffix,
const string& frPrefix) {
// Create assignment from internal format into DPI temporary
bool bitvec = (portp->basicp()->keyword().isDpiBitVal() && portp->width() > 32);
bool logicvec = (portp->basicp()->keyword().isDpiLogicVal() && portp->width() > 1);
if (isRtn && (bitvec || logicvec)) {
portp->v3error("DPI functions cannot return > 32 bits or four-state;"
" use a two-state type or task instead: "<<portp->prettyNameQ());
// Code below works, but won't compile right, and IEEE illegal
}
string stmt;
string ket;
// Someday we'll have better type support, and this can make variables and casts.
// But for now, we'll just text-bash it.
string frName = frPrefix+portp->name()+frSuffix;
string toName = portp->name()+toSuffix;
if (bitvec) {
if (portp->isWide()) {
stmt += ("VL_SET_SVBV_W("+cvtToStr(portp->width())
+", "+toName+", "+frName+")");
} else {
stmt += "VL_SET_WQ("+toName+", "+frName+")";
}
} else if (logicvec) {
if (portp->basicp()->isDpiBitVec()) {
stmt += ("VL_SET_SVBV_" + string(portp->dtypep()->charIQWN()) + "("
+ cvtToStr(portp->width()) + ", " + toName + ", " + frName + ")");
} else if (portp->basicp()->isDpiLogicVec()) {
stmt += ("VL_SET_SVLV_" + string(portp->dtypep()->charIQWN()) + "("
+ cvtToStr(portp->width())
+ ", "+toName+", "+frName+")");
+ cvtToStr(portp->width()) + ", " + toName + ", " + frName + ")");
} else {
if (isPtr) stmt += "*"; // DPI outputs are pointers
stmt += toName+" = ";
@ -1495,36 +1489,21 @@ string V3Task::assignInternalToDpi(AstVar* portp, bool isRtn, bool isPtr,
return stmt;
}
bool V3Task::dpiToInternalFrStmt(AstVar* portp, const string& frName, bool cvt, string& frstmt) {
bool V3Task::dpiToInternalFrStmt(AstVar* portp, const string& frName, string& frstmt) {
if (portp->basicp() && portp->basicp()->keyword()==AstBasicDTypeKwd::CHANDLE) {
frstmt = "VL_CVT_VP_Q("+frName+")";
}
else if (portp->basicp() && portp->basicp()->keyword().isDpiBitVal()
&& portp->width() != 1 && portp->isQuad()) {
// SV is vector, Verilator isn't
frstmt = "VL_SET_QW("+frName+")";
}
else if (portp->basicp() && portp->basicp()->keyword().isDpiLogicVal()
&& portp->width() != 1 && portp->isQuad()) {
frstmt = "VL_SET_Q_SVLV("+frName+")";
}
else if (portp->basicp() && portp->basicp()->keyword().isDpiLogicVal()
&& portp->width() != 1 && !portp->isWide()) {
frstmt = "VL_SET_I_SVLV("+frName+")";
}
else if (!cvt
&& portp->basicp() && portp->basicp()->keyword().isDpiBitVal()
&& portp->width() != 1 && !portp->isWide()) {
frstmt = "*"+frName; // it's a svBitVecVal, which other code won't think is arrayed (as WData aren't), but really is
}
else if (portp->basicp() && portp->basicp()->keyword().isDpiLogicVal()
&& portp->width() != 1 && portp->isWide()) {
// Need to convert to wide, using special function
frstmt = "VL_SET_W_SVLV("+cvtToStr(portp->width()) + ",";
return true;
}
else {
} else if ((portp->basicp() && portp->basicp()->isDpiPrimitive())) {
frstmt = frName;
} else {
const string frSvType = portp->basicp()->isDpiBitVec() ? "SVBV" : "SVLV";
if (portp->isWide()) {
// Need to convert to wide, using special function
frstmt = "VL_SET_W_" + frSvType + "(" + cvtToStr(portp->width()) + ",";
return true;
} else {
frstmt = "VL_SET_" + string(portp->dtypep()->charIQWN()) + "_" + frSvType + "("
+ frName + ")";
}
}
return false;
}

View File

@ -37,11 +37,9 @@ public:
static void taskAll(AstNetlist* nodep);
/// Return vector of [port, pin-connects-to] (SLOW)
static V3TaskConnects taskConnects(AstNodeFTaskRef* nodep, AstNode* taskStmtsp);
static string assignInternalToDpi(AstVar* portp, bool isRtn, bool isPtr,
const string& frSuffix, const string& toSuffix,
const string& frPrefix="");
static bool dpiToInternalFrStmt(AstVar* portp, const string& frName, bool cvt,
string& frstmt);
static string assignInternalToDpi(AstVar* portp, bool isPtr, const string& frSuffix,
const string& toSuffix, const string& frPrefix = "");
static bool dpiToInternalFrStmt(AstVar* portp, const string& frName, string& frstmt);
};
#endif // Guard

View File

@ -1756,7 +1756,7 @@ private:
for (itemp = nodep->membersp();
itemp && itemp->nextp(); itemp=VN_CAST(itemp->nextp(), MemberDType)) ;
for (AstMemberDType* backip; itemp; itemp=backip) {
if (nodep->isFourstate()) nodep->isFourstate(true);
if (itemp->isFourstate()) nodep->isFourstate(true);
backip = VN_CAST(itemp->backp(), MemberDType);
itemp->lsb(lsb);
if (VN_IS(nodep, UnionDType)) {

View File

@ -605,7 +605,7 @@ sub new {
nc_run_flags => [split(/\s+/,"+licqueue -q +assert +sv -R")],
# ModelSim
ms => 0,
ms_flags => [split(/\s+/,("-sv -work $self->{obj_dir}/work"))],
ms_flags => [split(/\s+/, ("-sv -work $self->{obj_dir}/work +define+MS=1 -ccflags \"-DMS=1\""))],
ms_flags2 => [], # Overridden in some sim files
ms_pli => 1, # need to use pli
ms_run_flags => [split(/\s+/,"-lib $self->{obj_dir}/work -c -do 'run -all;quit' ")],

View File

@ -1,7 +1,5 @@
+librescan +libext+.v
-y t
-y obj_dir/
+incdir+t
+incdir+../include
+incdir+obj_dir/

View File

@ -246,7 +246,7 @@ int main() {
for (int i = 0; !Verilated::gotFinish() && (i < 4); i++) {
dut->clk = 1 - dut->clk;
a = 1 - (int)a_read();
a_write(a);
a_write(reinterpret_cast<const svBitVecVal*>(&a));
logReg(dut->clk, "write a", a, " (before clk)");
a = a_read();
logReg(dut->clk, "read a", a, " (before clk)");
@ -275,7 +275,7 @@ int main() {
for (int i = 0; !Verilated::gotFinish() && (i < 4); i++) {
dut->clk = 1 - dut->clk;
b = (int)b_read() - 1;
b_write((const svBitVecVal*)&b);
b_write(reinterpret_cast<const svBitVecVal*>(&b));
logRegHex(dut->clk, "write b", 8, b, " (before clk)");
b = (int)b_read();
logRegHex(dut->clk, "read b", 8, b, " (before clk)");
@ -304,7 +304,7 @@ int main() {
for (int i = 0; !Verilated::gotFinish() && (i < 4); i++) {
dut->clk = 1 - dut->clk;
mem32 = (int)mem32_read() - 1;
mem32_write((const svBitVecVal*)&mem32);
mem32_write(reinterpret_cast<const svBitVecVal*>(&mem32));
logRegHex(dut->clk, "write mem32", 8, mem32, " (before clk)");
mem32 = (int)mem32_read();
logRegHex(dut->clk, "read mem32", 8, mem32, " (before clk)");
@ -426,7 +426,7 @@ int main() {
logRegHex(dut->clk, "read b [3:0]", 4, b_slice, " (before write)");
b_slice--;
b_slice_write((const svBitVecVal*)&b_slice);
b_slice_write(reinterpret_cast<const svBitVecVal*>(&b_slice));
logRegHex(dut->clk, "write b [3:0]", 4, b_slice, " (before clk)");
int b_after = (int)b_read();
@ -465,7 +465,7 @@ int main() {
logRegHex(dut->clk, "read mem32 [7:6,2:0]", 5, mem32_slice, " (before write)");
mem32_slice--;
mem32_slice_write((const svBitVecVal*)&mem32_slice);
mem32_slice_write(reinterpret_cast<const svBitVecVal*>(&mem32_slice));
logRegHex(dut->clk, "write mem32 [7:6,2:0]", 5, mem32_slice, " (before clk)");
int mem32_after = (int)mem32_read();
@ -545,8 +545,8 @@ int main() {
e = 0x05 | (i << 4);
f = 0xa0 | i;
e_write((const svBitVecVal*)&e);
f_write((const svBitVecVal*)&f);
e_write(reinterpret_cast<const svBitVecVal*>(&e));
f_write(reinterpret_cast<const svBitVecVal*>(&f));
e = (int)e_read();
f = (int)f_read();
@ -592,7 +592,7 @@ int main() {
logRegHex(dut->clk, "read e ", 8, e, " (before write)");
int l1 = 0x5a5a;
l1_write((const svBitVecVal*)&l1);
l1_write(reinterpret_cast<const svBitVecVal*>(&l1));
logRegHex(dut->clk, "write l1 ", 15, l1, " (before clk)");
int b_after = (int)b_read();
@ -641,7 +641,7 @@ int main() {
logRegHex(dut->clk, "read f ", 8, f, " (before write)");
int l2 = 0xa5 + i;
l2_write((const svBitVecVal*)&l2);
l2_write(reinterpret_cast<const svBitVecVal*>(&l2));
logRegHex(dut->clk, "write l2", 8, l2, " (before clk)");
int e_after = (int)e_read();

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,265 @@
i_chandle 0
i_string 0
i_bit 0
i_logic 0
i_chandle_t 0
i_string_t 0
i_bit_t 0
i_logic_t 0
i_array_2_state_1 0
i_array_2_state_32 0
i_array_2_state_33 0
i_array_2_state_64 0
i_array_2_state_65 0
i_array_2_state_128 0
i_struct_2_state_1 0
i_struct_2_state_32 0
i_struct_2_state_33 0
i_struct_2_state_64 0
i_struct_2_state_65 0
i_struct_2_state_128 0
i_union_2_state_1 0
i_union_2_state_32 0
i_union_2_state_33 0
i_union_2_state_64 0
i_union_2_state_65 0
i_union_2_state_128 0
i_array_4_state_1 0
i_array_4_state_32 0
i_array_4_state_33 0
i_array_4_state_64 0
i_array_4_state_65 0
i_array_4_state_128 0
i_struct_4_state_1 0
i_struct_4_state_32 0
i_struct_4_state_33 0
i_struct_4_state_64 0
i_struct_4_state_65 0
i_struct_4_state_128 0
i_union_4_state_1 0
i_union_4_state_32 0
i_union_4_state_33 0
i_union_4_state_64 0
i_union_4_state_65 0
i_union_4_state_128 0
e_chandle 0
e_string 0
e_bit 0
e_logic 0
e_chandle_t 0
e_string_t 0
e_bit_t 0
e_logic_t 0
e_array_2_state_1 0
e_array_2_state_32 0
e_array_2_state_33 0
e_array_2_state_64 0
e_array_2_state_65 0
e_array_2_state_128 0
e_struct_2_state_1 0
e_struct_2_state_32 0
e_struct_2_state_33 0
e_struct_2_state_64 0
e_struct_2_state_65 0
e_struct_2_state_128 0
e_union_2_state_1 0
e_union_2_state_32 0
e_union_2_state_33 0
e_union_2_state_64 0
e_union_2_state_65 0
e_union_2_state_128 0
e_array_4_state_1 0
e_array_4_state_32 0
e_array_4_state_33 0
e_array_4_state_64 0
e_array_4_state_65 0
e_array_4_state_128 0
e_struct_4_state_1 0
e_struct_4_state_32 0
e_struct_4_state_33 0
e_struct_4_state_64 0
e_struct_4_state_65 0
e_struct_4_state_128 0
e_union_4_state_1 0
e_union_4_state_32 0
e_union_4_state_33 0
e_union_4_state_64 0
e_union_4_state_65 0
e_union_4_state_128 0
i_chandle 1
i_string 1
i_bit 1
i_logic 1
i_chandle_t 1
i_string_t 1
i_bit_t 1
i_logic_t 1
i_array_2_state_1 1
i_array_2_state_32 1
i_array_2_state_33 1
i_array_2_state_64 1
i_array_2_state_65 1
i_array_2_state_128 1
i_struct_2_state_1 1
i_struct_2_state_32 1
i_struct_2_state_33 1
i_struct_2_state_64 1
i_struct_2_state_65 1
i_struct_2_state_128 1
i_union_2_state_1 1
i_union_2_state_32 1
i_union_2_state_33 1
i_union_2_state_64 1
i_union_2_state_65 1
i_union_2_state_128 1
i_array_4_state_1 1
i_array_4_state_32 1
i_array_4_state_33 1
i_array_4_state_64 1
i_array_4_state_65 1
i_array_4_state_128 1
i_struct_4_state_1 1
i_struct_4_state_32 1
i_struct_4_state_33 1
i_struct_4_state_64 1
i_struct_4_state_65 1
i_struct_4_state_128 1
i_union_4_state_1 1
i_union_4_state_32 1
i_union_4_state_33 1
i_union_4_state_64 1
i_union_4_state_65 1
i_union_4_state_128 1
e_chandle 1
e_string 1
e_bit 1
e_logic 1
e_chandle_t 1
e_string_t 1
e_bit_t 1
e_logic_t 1
e_array_2_state_1 1
e_array_2_state_32 1
e_array_2_state_33 1
e_array_2_state_64 1
e_array_2_state_65 1
e_array_2_state_128 1
e_struct_2_state_1 1
e_struct_2_state_32 1
e_struct_2_state_33 1
e_struct_2_state_64 1
e_struct_2_state_65 1
e_struct_2_state_128 1
e_union_2_state_1 1
e_union_2_state_32 1
e_union_2_state_33 1
e_union_2_state_64 1
e_union_2_state_65 1
e_union_2_state_128 1
e_array_4_state_1 1
e_array_4_state_32 1
e_array_4_state_33 1
e_array_4_state_64 1
e_array_4_state_65 1
e_array_4_state_128 1
e_struct_4_state_1 1
e_struct_4_state_32 1
e_struct_4_state_33 1
e_struct_4_state_64 1
e_struct_4_state_65 1
e_struct_4_state_128 1
e_union_4_state_1 1
e_union_4_state_32 1
e_union_4_state_33 1
e_union_4_state_64 1
e_union_4_state_65 1
e_union_4_state_128 1
i_chandle 2
i_string 2
i_bit 2
i_logic 2
i_chandle_t 2
i_string_t 2
i_bit_t 2
i_logic_t 2
i_array_2_state_1 2
i_array_2_state_32 2
i_array_2_state_33 2
i_array_2_state_64 2
i_array_2_state_65 2
i_array_2_state_128 2
i_struct_2_state_1 2
i_struct_2_state_32 2
i_struct_2_state_33 2
i_struct_2_state_64 2
i_struct_2_state_65 2
i_struct_2_state_128 2
i_union_2_state_1 2
i_union_2_state_32 2
i_union_2_state_33 2
i_union_2_state_64 2
i_union_2_state_65 2
i_union_2_state_128 2
i_array_4_state_1 2
i_array_4_state_32 2
i_array_4_state_33 2
i_array_4_state_64 2
i_array_4_state_65 2
i_array_4_state_128 2
i_struct_4_state_1 2
i_struct_4_state_32 2
i_struct_4_state_33 2
i_struct_4_state_64 2
i_struct_4_state_65 2
i_struct_4_state_128 2
i_union_4_state_1 2
i_union_4_state_32 2
i_union_4_state_33 2
i_union_4_state_64 2
i_union_4_state_65 2
i_union_4_state_128 2
e_chandle 2
e_string 2
e_bit 2
e_logic 2
e_chandle_t 2
e_string_t 2
e_bit_t 2
e_logic_t 2
e_array_2_state_1 2
e_array_2_state_32 2
e_array_2_state_33 2
e_array_2_state_64 2
e_array_2_state_65 2
e_array_2_state_128 2
e_struct_2_state_1 2
e_struct_2_state_32 2
e_struct_2_state_33 2
e_struct_2_state_64 2
e_struct_2_state_65 2
e_struct_2_state_128 2
e_union_2_state_1 2
e_union_2_state_32 2
e_union_2_state_33 2
e_union_2_state_64 2
e_union_2_state_65 2
e_union_2_state_128 2
e_array_4_state_1 2
e_array_4_state_32 2
e_array_4_state_33 2
e_array_4_state_64 2
e_array_4_state_65 2
e_array_4_state_128 2
e_struct_4_state_1 2
e_struct_4_state_32 2
e_struct_4_state_33 2
e_struct_4_state_64 2
e_struct_4_state_65 2
e_struct_4_state_128 2
e_union_4_state_1 2
e_union_4_state_32 2
e_union_4_state_33 2
e_union_4_state_64 2
e_union_4_state_65 2
e_union_4_state_128 2
*-* All Finished *-*

View File

@ -0,0 +1,45 @@
#!/usr/bin/perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2020 by Geza Lore. This program is free software; you can
# redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
scenarios(simulator => 1);
if ($Self->{nc}) {
# For NC, compile twice, first just to generate DPI headers
compile(
nc_flags2 => ["+ncdpiheader+$Self->{obj_dir}/dpi-exp.h",
"+ncdpiimpheader+$Self->{obj_dir}/dpi-imp.h"]
);
}
compile(
v_flags2 => ["t/t_dpi_arg_inout_type.cpp"],
verilator_flags2 => ["-Wall -Wno-DECLFILENAME"],
# NC: Gdd the obj_dir to the C include path
nc_flags2 => ["+ncscargs+-I$Self->{obj_dir}"],
# ModelSim: Generate DPI header, add obj_dir to the C include path
ms_flags2 => ["-dpiheader $Self->{obj_dir}/dpi.h",
"-ccflags -I$Self->{obj_dir}"],
);
if ($Self->{vlt_all}) {
files_identical(
"$Self->{obj_dir}/Vt_dpi_arg_inout_type__Dpi.h",
"t/t_dpi_arg_inout_type__Dpi.out"
);
}
execute(
check_finished => 1,
expect_filename => $Self->{golden_filename},
ms_pli => 0
);
ok(1);
1;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,287 @@
// Verilated -*- C++ -*-
// DESCRIPTION: Verilator output: Prototypes for DPI import and export functions.
//
// Verilator includes this file in all generated .cpp files that use DPI functions.
// Manually include this file where DPI .c import functions are declared to ensure
// the C functions match the expectations of the DPI imports.
#include "svdpi.h"
#ifdef __cplusplus
extern "C" {
#endif
// DPI EXPORTS
// DPI export at t/t_dpi_arg_inout_type.v:571:18
extern void e_array_2_state_1(svBitVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:611:18
extern void e_array_2_state_128(svBitVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:579:18
extern void e_array_2_state_32(svBitVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:587:18
extern void e_array_2_state_33(svBitVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:595:18
extern void e_array_2_state_64(svBitVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:603:18
extern void e_array_2_state_65(svBitVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:718:18
extern void e_array_4_state_1(svLogicVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:758:18
extern void e_array_4_state_128(svLogicVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:726:18
extern void e_array_4_state_32(svLogicVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:734:18
extern void e_array_4_state_33(svLogicVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:742:18
extern void e_array_4_state_64(svLogicVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:750:18
extern void e_array_4_state_65(svLogicVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:422:18
extern void e_bit(svBit* x);
// DPI export at t/t_dpi_arg_inout_type.v:554:18
extern void e_bit_t(svBit* x);
// DPI export at t/t_dpi_arg_inout_type.v:307:18
extern void e_byte(char* x);
// DPI export at t/t_dpi_arg_inout_type.v:439:18
extern void e_byte_t(char* x);
// DPI export at t/t_dpi_arg_inout_type.v:314:18
extern void e_byte_unsigned(unsigned char* x);
// DPI export at t/t_dpi_arg_inout_type.v:446:18
extern void e_byte_unsigned_t(unsigned char* x);
// DPI export at t/t_dpi_arg_inout_type.v:397:18
extern void e_chandle(void** x);
// DPI export at t/t_dpi_arg_inout_type.v:529:18
extern void e_chandle_t(void** x);
// DPI export at t/t_dpi_arg_inout_type.v:335:18
extern void e_int(int* x);
// DPI export at t/t_dpi_arg_inout_type.v:467:18
extern void e_int_t(int* x);
// DPI export at t/t_dpi_arg_inout_type.v:342:18
extern void e_int_unsigned(unsigned int* x);
// DPI export at t/t_dpi_arg_inout_type.v:474:18
extern void e_int_unsigned_t(unsigned int* x);
// DPI export at t/t_dpi_arg_inout_type.v:373:18
extern void e_integer(svLogicVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:505:18
extern void e_integer_t(svLogicVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:430:18
extern void e_logic(svLogic* x);
// DPI export at t/t_dpi_arg_inout_type.v:562:18
extern void e_logic_t(svLogic* x);
// DPI export at t/t_dpi_arg_inout_type.v:349:18
extern void e_longint(long long* x);
// DPI export at t/t_dpi_arg_inout_type.v:481:18
extern void e_longint_t(long long* x);
// DPI export at t/t_dpi_arg_inout_type.v:356:18
extern void e_longint_unsigned(unsigned long long* x);
// DPI export at t/t_dpi_arg_inout_type.v:488:18
extern void e_longint_unsigned_t(unsigned long long* x);
// DPI export at t/t_dpi_arg_inout_type.v:381:18
extern void e_real(double* x);
// DPI export at t/t_dpi_arg_inout_type.v:513:18
extern void e_real_t(double* x);
// DPI export at t/t_dpi_arg_inout_type.v:321:18
extern void e_shortint(short* x);
// DPI export at t/t_dpi_arg_inout_type.v:453:18
extern void e_shortint_t(short* x);
// DPI export at t/t_dpi_arg_inout_type.v:328:18
extern void e_shortint_unsigned(unsigned short* x);
// DPI export at t/t_dpi_arg_inout_type.v:460:18
extern void e_shortint_unsigned_t(unsigned short* x);
// DPI export at t/t_dpi_arg_inout_type.v:409:18
extern void e_string(const char** x);
// DPI export at t/t_dpi_arg_inout_type.v:541:18
extern void e_string_t(const char** x);
// DPI export at t/t_dpi_arg_inout_type.v:620:18
extern void e_struct_2_state_1(svBitVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:660:18
extern void e_struct_2_state_128(svBitVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:628:18
extern void e_struct_2_state_32(svBitVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:636:18
extern void e_struct_2_state_33(svBitVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:644:18
extern void e_struct_2_state_64(svBitVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:652:18
extern void e_struct_2_state_65(svBitVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:767:18
extern void e_struct_4_state_1(svLogicVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:807:18
extern void e_struct_4_state_128(svLogicVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:775:18
extern void e_struct_4_state_32(svLogicVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:783:18
extern void e_struct_4_state_33(svLogicVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:791:18
extern void e_struct_4_state_64(svLogicVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:799:18
extern void e_struct_4_state_65(svLogicVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:364:18
extern void e_time(svLogicVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:496:18
extern void e_time_t(svLogicVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:669:18
extern void e_union_2_state_1(svBitVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:709:18
extern void e_union_2_state_128(svBitVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:677:18
extern void e_union_2_state_32(svBitVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:685:18
extern void e_union_2_state_33(svBitVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:693:18
extern void e_union_2_state_64(svBitVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:701:18
extern void e_union_2_state_65(svBitVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:816:18
extern void e_union_4_state_1(svLogicVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:856:18
extern void e_union_4_state_128(svLogicVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:824:18
extern void e_union_4_state_32(svLogicVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:832:18
extern void e_union_4_state_33(svLogicVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:840:18
extern void e_union_4_state_64(svLogicVecVal* x);
// DPI export at t/t_dpi_arg_inout_type.v:848:18
extern void e_union_4_state_65(svLogicVecVal* x);
// DPI IMPORTS
// DPI import at t/t_dpi_arg_inout_type.v:867:41
extern void check_exports();
// DPI import at t/t_dpi_arg_inout_type.v:154:33
extern void i_array_2_state_1(svBitVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:159:33
extern void i_array_2_state_128(svBitVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:155:33
extern void i_array_2_state_32(svBitVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:156:33
extern void i_array_2_state_33(svBitVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:157:33
extern void i_array_2_state_64(svBitVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:158:33
extern void i_array_2_state_65(svBitVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:178:33
extern void i_array_4_state_1(svLogicVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:183:33
extern void i_array_4_state_128(svLogicVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:179:33
extern void i_array_4_state_32(svLogicVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:180:33
extern void i_array_4_state_33(svLogicVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:181:33
extern void i_array_4_state_64(svLogicVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:182:33
extern void i_array_4_state_65(svLogicVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:126:33
extern void i_bit(svBit* x);
// DPI import at t/t_dpi_arg_inout_type.v:150:33
extern void i_bit_t(svBit* x);
// DPI import at t/t_dpi_arg_inout_type.v:106:33
extern void i_byte(char* x);
// DPI import at t/t_dpi_arg_inout_type.v:130:33
extern void i_byte_t(char* x);
// DPI import at t/t_dpi_arg_inout_type.v:107:33
extern void i_byte_unsigned(unsigned char* x);
// DPI import at t/t_dpi_arg_inout_type.v:131:33
extern void i_byte_unsigned_t(unsigned char* x);
// DPI import at t/t_dpi_arg_inout_type.v:124:33
extern void i_chandle(void** x);
// DPI import at t/t_dpi_arg_inout_type.v:148:33
extern void i_chandle_t(void** x);
// DPI import at t/t_dpi_arg_inout_type.v:110:33
extern void i_int(int* x);
// DPI import at t/t_dpi_arg_inout_type.v:134:33
extern void i_int_t(int* x);
// DPI import at t/t_dpi_arg_inout_type.v:111:33
extern void i_int_unsigned(unsigned int* x);
// DPI import at t/t_dpi_arg_inout_type.v:135:33
extern void i_int_unsigned_t(unsigned int* x);
// DPI import at t/t_dpi_arg_inout_type.v:118:33
extern void i_integer(svLogicVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:142:33
extern void i_integer_t(svLogicVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:127:33
extern void i_logic(svLogic* x);
// DPI import at t/t_dpi_arg_inout_type.v:151:33
extern void i_logic_t(svLogic* x);
// DPI import at t/t_dpi_arg_inout_type.v:112:33
extern void i_longint(long long* x);
// DPI import at t/t_dpi_arg_inout_type.v:136:33
extern void i_longint_t(long long* x);
// DPI import at t/t_dpi_arg_inout_type.v:113:33
extern void i_longint_unsigned(unsigned long long* x);
// DPI import at t/t_dpi_arg_inout_type.v:137:33
extern void i_longint_unsigned_t(unsigned long long* x);
// DPI import at t/t_dpi_arg_inout_type.v:120:33
extern void i_real(double* x);
// DPI import at t/t_dpi_arg_inout_type.v:144:33
extern void i_real_t(double* x);
// DPI import at t/t_dpi_arg_inout_type.v:108:33
extern void i_shortint(short* x);
// DPI import at t/t_dpi_arg_inout_type.v:132:33
extern void i_shortint_t(short* x);
// DPI import at t/t_dpi_arg_inout_type.v:109:33
extern void i_shortint_unsigned(unsigned short* x);
// DPI import at t/t_dpi_arg_inout_type.v:133:33
extern void i_shortint_unsigned_t(unsigned short* x);
// DPI import at t/t_dpi_arg_inout_type.v:125:33
extern void i_string(const char** x);
// DPI import at t/t_dpi_arg_inout_type.v:149:33
extern void i_string_t(const char** x);
// DPI import at t/t_dpi_arg_inout_type.v:162:33
extern void i_struct_2_state_1(svBitVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:167:33
extern void i_struct_2_state_128(svBitVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:163:33
extern void i_struct_2_state_32(svBitVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:164:33
extern void i_struct_2_state_33(svBitVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:165:33
extern void i_struct_2_state_64(svBitVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:166:33
extern void i_struct_2_state_65(svBitVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:186:33
extern void i_struct_4_state_1(svLogicVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:191:33
extern void i_struct_4_state_128(svLogicVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:187:33
extern void i_struct_4_state_32(svLogicVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:188:33
extern void i_struct_4_state_33(svLogicVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:189:33
extern void i_struct_4_state_64(svLogicVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:190:33
extern void i_struct_4_state_65(svLogicVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:115:33
extern void i_time(svLogicVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:139:33
extern void i_time_t(svLogicVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:170:33
extern void i_union_2_state_1(svBitVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:175:33
extern void i_union_2_state_128(svBitVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:171:33
extern void i_union_2_state_32(svBitVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:172:33
extern void i_union_2_state_33(svBitVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:173:33
extern void i_union_2_state_64(svBitVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:174:33
extern void i_union_2_state_65(svBitVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:194:33
extern void i_union_4_state_1(svLogicVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:199:33
extern void i_union_4_state_128(svLogicVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:195:33
extern void i_union_4_state_32(svLogicVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:196:33
extern void i_union_4_state_33(svLogicVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:197:33
extern void i_union_4_state_64(svLogicVecVal* x);
// DPI import at t/t_dpi_arg_inout_type.v:198:33
extern void i_union_4_state_65(svLogicVecVal* x);
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,815 @@
// -*- mode: C++; c-file-style: "cc-mode" -*-
//*************************************************************************
//
// Copyright 2020 by Geza Lore. This program is free software; you can
// redistribute it and/or modify it under the terms of either the GNU
// Lesser General Public License Version 3 or the Perl Artistic License
// Version 2.0.
// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
//
//*************************************************************************
#include <cstdio>
#include <cstdlib>
#include <cstring>
#if defined(NCSC)
// Used by NC's svdpi.h to pick up svLogicVecVal with _.aval and _.bval fields,
// rather than the IEEE 1800-2005 version which has _.a and _.b fields.
# define DPI_COMPATIBILITY_VERSION_1800v2012
#endif
#include "svdpi.h"
#if defined(VERILATOR) // Verilator
# include "Vt_dpi_arg_input_type__Dpi.h"
typedef long long sv_longint_t;
typedef unsigned long long sv_longint_unsigned_t;
# define NO_SHORTREAL
# define CONSTARG const
#elif defined(VCS) // VCS
# include "../vc_hdrs.h"
typedef long long sv_longint_t;
typedef unsigned long long sv_longint_unsigned_t;
# define NO_TIME
# define CONSTARG const
#elif defined(NCSC) // NC
# include "dpi-exp.h"
# include "dpi-imp.h"
typedef long long sv_longint_t;
typedef unsigned long long sv_longint_unsigned_t;
# define NO_TIME
# define NO_INTEGER
# define NO_SHORTREAL
// Sadly NC does not declare pass-by reference input arguments as const
# define CONSTARG
#elif defined(MS) // ModelSim
# include "dpi.h"
typedef int64_t sv_longint_t;
typedef uint64_t sv_longint_unsigned_t;
# define CONSTARG const
#else
# error "Unknown simulator for DPI test"
#endif
//======================================================================
// Implementations of imported functions
//======================================================================
#define stop() \
do { \
printf(__FILE__ ":%d Bad value\n", __LINE__); \
abort(); \
} while (0)
void check_bvals(CONSTARG svLogicVecVal* v, unsigned n);
void check_bvals(CONSTARG svLogicVecVal* v, unsigned n) {
for (unsigned i = 0; i < n; i++) {
if (v[i].bval != 0) {
printf(__FILE__ ":%d Bad svLogicVecVal bval\n", __LINE__);
abort();
}
}
}
// Basic types as per IEEE 1800-2017 35.5.6
void i_byte(char i) {
static int n = 0;
if (i != 10 - n++) stop();
}
void i_byte_unsigned(unsigned char i) {
static int n = 0;
if (i != 20 - n++) stop();
}
void i_shortint(short i) {
static int n = 0;
if (i != 30 - n++) stop();
}
void i_shortint_unsigned(unsigned short i) {
static int n = 0;
if (i != 40 - n++) stop();
}
void i_int(int i) {
static int n = 0;
if (i != 50 - n++) stop();
}
void i_int_unsigned(unsigned i) {
static int n = 0;
if (i != 60 - n++) stop();
}
void i_longint(sv_longint_t i) {
static int n = 0;
if (i != 70 - n++) stop();
}
void i_longint_unsigned(sv_longint_unsigned_t i) {
static int n = 0;
if (i != 80 - n++) stop();
}
#ifndef NO_TIME
void i_time(CONSTARG svLogicVecVal* i) {
static int n = 0;
if (i[0].aval != 90 - n++) stop();
if (i[1].aval != 0) stop();
check_bvals(i, 2);
}
#endif
#ifndef NO_INTEGER
void i_integer(CONSTARG svLogicVecVal* i) {
static int n = 0;
if (i[0].aval != 100 - n++) stop();
check_bvals(i, 1);
}
#endif
void i_real(double i) {
static int n = 0;
if (i != (-2.0 * n++ - 1.0) / 2.0) stop();
}
#ifndef NO_SHORTREAL
void i_shortreal(float i) {
static int n = 0;
if (i != (-4.0f * n++ - 1.0f) / 4.0f) stop();
}
#endif
void i_chandle(void* i) {
static int n = 0;
printf("i_chandle %d\n", n);
if (i != NULL) stop();
n++;
}
void i_string(const char* i) {
static int n = 0;
printf("i_string %d\n", n);
if (n++ % 2 == 0) {
if (strcmp(i, "World") != 0) stop();
} else {
if (strcmp(i, "Hello") != 0) stop();
}
}
void i_bit(svBit i) {
static int n = 0;
printf("i_bit %d\n", n);
if (i != !(n++ % 2)) stop();
}
void i_logic(svLogic i) {
static int n = 0;
printf("i_logic %d\n", n);
if (i != n++ % 2) stop();
}
// Basic types via typedefs
void i_byte_t(char i) {
static int n = 0;
if (i != 10 - n) stop();
n += 2;
}
void i_byte_unsigned_t(unsigned char i) {
static int n = 0;
if (i != 20 - n) stop();
n += 2;
}
void i_shortint_t(short i) {
static int n = 0;
if (i != 30 - n) stop();
n += 2;
}
void i_shortint_unsigned_t(unsigned short i) {
static int n = 0;
if (i != 40 - n) stop();
n += 2;
}
void i_int_t(int i) {
static int n = 0;
if (i != 50 - n) stop();
n += 2;
}
void i_int_unsigned_t(unsigned i) {
static int n = 0;
if (i != 60 - n) stop();
n += 2;
}
void i_longint_t(sv_longint_t i) {
static int n = 0;
if (i != 70 - n) stop();
n += 2;
}
void i_longint_unsigned_t(sv_longint_unsigned_t i) {
static int n = 0;
if (i != 80 - n) stop();
n += 2;
}
#ifndef NO_TIME
void i_time_t(CONSTARG svLogicVecVal* i) {
static int n = 0;
if (i[0].aval != 90 - n) stop();
if (i[1].aval != 0) stop();
check_bvals(i, 2);
n += 2;
}
#endif
#ifndef NO_INTEGER
void i_integer_t(CONSTARG svLogicVecVal* i) {
static int n = 0;
if (i[0].aval != 100 - n) stop();
check_bvals(i, 1);
n += 2;
}
#endif
void i_real_t(double i) {
static int n = 0;
if (i != (-2.0 * n - 1.0) / 2.0) stop();
n += 2;
}
#ifndef NO_SHORTREAL
void i_shortreal_t(float i) {
static int n = 0;
if (i != (-4.0f * n - 1.0f) / 4.0f) stop();
n += 2;
}
#endif
void i_chandle_t(void* i) {
static int n = 0;
printf("i_chandle_t %d\n", n);
if (i != NULL) stop();
n++;
}
void i_string_t(const char* i) {
static int n = 0;
printf("i_string_t %d\n", n);
if (n++ % 2 == 0) {
if (strcmp(i, "World") != 0) stop();
} else {
if (strcmp(i, "Hello") != 0) stop();
}
}
void i_bit_t(svBit i) {
static int n = 0;
printf("i_bit_t %d\n", n);
if (i != !(n++ % 2)) stop();
}
void i_logic_t(svLogic i) {
static int n = 0;
printf("i_logic_t %d\n", n);
if (i != n++ % 2) stop();
}
// 2-state packed arrays
void i_array_2_state_1(CONSTARG svBitVecVal* i) {
static int n = 0;
printf("i_array_2_state_1 %d\n", n);
if ((*i & 1) != !(n++ % 2)) stop();
}
void i_array_2_state_32(CONSTARG svBitVecVal* i) {
static int n = 0;
printf("i_array_2_state_32 %d\n", n);
if (*i != 0xffffffffU << n++) stop();
}
void i_array_2_state_33(CONSTARG svBitVecVal* i) {
static int n = 0;
printf("i_array_2_state_33 %d\n", n);
if (i[0] != 0xffffffffU << n++) stop();
if ((i[1] & 1) != 1) stop();
}
void i_array_2_state_64(CONSTARG svBitVecVal* i) {
static int n = 0;
printf("i_array_2_state_64 %d\n", n);
if (i[0] != 0xffffffffU << n++) stop();
if (i[1] != -1) stop();
}
void i_array_2_state_65(CONSTARG svBitVecVal* i) {
static int n = 0;
printf("i_array_2_state_65 %d\n", n);
if (i[0] != 0xffffffffU << n++) stop();
if (i[1] != -1) stop();
if ((i[2] & 1) != 1) stop();
}
void i_array_2_state_128(CONSTARG svBitVecVal* i) {
static int n = 0;
printf("i_array_2_state_128 %d\n", n);
if (i[0] != 0xffffffffU << n++) stop();
if (i[1] != -1) stop();
if (i[2] != -1) stop();
if (i[3] != -1) stop();
}
// 2-state packed structures
void i_struct_2_state_1(CONSTARG svBitVecVal* i) {
static int n = 0;
printf("i_struct_2_state_1 %d\n", n);
if ((*i & 1) != !(n++ % 2)) stop();
}
void i_struct_2_state_32(CONSTARG svBitVecVal* i) {
static int n = 0;
printf("i_struct_2_state_32 %d\n", n);
if (*i != 0xffffffffU << n++) stop();
}
void i_struct_2_state_33(CONSTARG svBitVecVal* i) {
static int n = 0;
printf("i_struct_2_state_33 %d\n", n);
if (i[0] != 0xffffffffU << n++) stop();
if ((i[1] & 1) != 1) stop();
}
void i_struct_2_state_64(CONSTARG svBitVecVal* i) {
static int n = 0;
printf("i_struct_2_state_64 %d\n", n);
if (i[0] != 0xffffffffU << n++) stop();
if (i[1] != -1) stop();
}
void i_struct_2_state_65(CONSTARG svBitVecVal* i) {
static int n = 0;
printf("i_struct_2_state_65 %d\n", n);
if (i[0] != 0xffffffffU << n++) stop();
if (i[1] != -1) stop();
if ((i[2] & 1) != 1) stop();
}
void i_struct_2_state_128(CONSTARG svBitVecVal* i) {
static int n = 0;
printf("i_struct_2_state_128 %d\n", n);
if (i[0] != 0xffffffffU << n++) stop();
if (i[1] != -1) stop();
if (i[2] != -1) stop();
if (i[3] != -1) stop();
}
// 2-state packed unions
void i_union_2_state_1(CONSTARG svBitVecVal* i) {
static int n = 0;
printf("i_union_2_state_1 %d\n", n);
if ((*i & 1) != !(n++ % 2)) stop();
}
void i_union_2_state_32(CONSTARG svBitVecVal* i) {
static int n = 0;
printf("i_union_2_state_32 %d\n", n);
if (*i != 0xffffffffU << n++) stop();
}
void i_union_2_state_33(CONSTARG svBitVecVal* i) {
static int n = 0;
printf("i_union_2_state_33 %d\n", n);
if (i[0] != 0xffffffffU << n++) stop();
if ((i[1] & 1) != 1) stop();
}
void i_union_2_state_64(CONSTARG svBitVecVal* i) {
static int n = 0;
printf("i_union_2_state_64 %d\n", n);
if (i[0] != 0xffffffffU << n++) stop();
if (i[1] != -1) stop();
}
void i_union_2_state_65(CONSTARG svBitVecVal* i) {
static int n = 0;
printf("i_union_2_state_65 %d\n", n);
if (i[0] != 0xffffffffU << n++) stop();
if (i[1] != -1) stop();
if ((i[2] & 1) != 1) stop();
}
void i_union_2_state_128(CONSTARG svBitVecVal* i) {
static int n = 0;
printf("i_union_2_state_128 %d\n", n);
if (i[0] != 0xffffffffU << n++) stop();
if (i[1] != -1) stop();
if (i[2] != -1) stop();
if (i[3] != -1) stop();
}
// 4-state packed arrays
void i_array_4_state_1(CONSTARG svLogicVecVal* i) {
static int n = 0;
printf("i_array_4_state_1 %d\n", n);
if ((i->aval & 1) != !(n++ % 2)) stop();
check_bvals(i, 1);
}
void i_array_4_state_32(CONSTARG svLogicVecVal* i) {
static int n = 0;
printf("i_array_4_state_32 %d\n", n);
if (i->aval != 0xffffffffU << n++) stop();
check_bvals(i, 1);
}
void i_array_4_state_33(CONSTARG svLogicVecVal* i) {
static int n = 0;
printf("i_array_4_state_33 %d\n", n);
if (i[0].aval != 0xffffffffU << n++) stop();
if ((i[1].aval & 1) != 1) stop();
check_bvals(i, 2);
}
void i_array_4_state_64(CONSTARG svLogicVecVal* i) {
static int n = 0;
printf("i_array_4_state_64 %d\n", n);
if (i[0].aval != 0xffffffffU << n++) stop();
if (i[1].aval != -1) stop();
check_bvals(i, 2);
}
void i_array_4_state_65(CONSTARG svLogicVecVal* i) {
static int n = 0;
printf("i_array_4_state_65 %d\n", n);
if (i[0].aval != 0xffffffffU << n++) stop();
if (i[1].aval != -1) stop();
if ((i[2].aval & 1) != 1) stop();
check_bvals(i, 3);
}
void i_array_4_state_128(CONSTARG svLogicVecVal* i) {
static int n = 0;
printf("i_array_4_state_128 %d\n", n);
if (i[0].aval != 0xffffffffU << n++) stop();
if (i[1].aval != -1) stop();
if (i[2].aval != -1) stop();
if (i[3].aval != -1) stop();
check_bvals(i, 4);
}
// 4-state packed structures
void i_struct_4_state_1(CONSTARG svLogicVecVal* i) {
static int n = 0;
printf("i_struct_4_state_1 %d\n", n);
if ((i->aval & 1) != !(n++ % 2)) stop();
check_bvals(i, 1);
}
void i_struct_4_state_32(CONSTARG svLogicVecVal* i) {
static int n = 0;
printf("i_struct_4_state_32 %d\n", n);
if (i->aval != 0xffffffffU << n++) stop();
check_bvals(i, 1);
}
void i_struct_4_state_33(CONSTARG svLogicVecVal* i) {
static int n = 0;
printf("i_struct_4_state_33 %d\n", n);
if (i[0].aval != 0xffffffffU << n++) stop();
if ((i[1].aval & 1) != 1) stop();
check_bvals(i, 2);
}
void i_struct_4_state_64(CONSTARG svLogicVecVal* i) {
static int n = 0;
printf("i_struct_4_state_64 %d\n", n);
if (i[0].aval != 0xffffffffU << n++) stop();
if (i[1].aval != -1) stop();
check_bvals(i, 2);
}
void i_struct_4_state_65(CONSTARG svLogicVecVal* i) {
static int n = 0;
printf("i_struct_4_state_65 %d\n", n);
if (i[0].aval != 0xffffffffU << n++) stop();
if (i[1].aval != -1) stop();
if ((i[2].aval & 1) != 1) stop();
check_bvals(i, 3);
}
void i_struct_4_state_128(CONSTARG svLogicVecVal* i) {
static int n = 0;
printf("i_struct_4_state_128 %d\n", n);
if (i[0].aval != 0xffffffffU << n++) stop();
if (i[1].aval != -1) stop();
if (i[2].aval != -1) stop();
if (i[3].aval != -1) stop();
check_bvals(i, 4);
}
// 4-state packed unions
void i_union_4_state_1(CONSTARG svLogicVecVal* i) {
static int n = 0;
printf("i_union_4_state_1 %d\n", n);
if ((i->aval & 1) != !(n++ % 2)) stop();
check_bvals(i, 1);
}
void i_union_4_state_32(CONSTARG svLogicVecVal* i) {
static int n = 0;
printf("i_union_4_state_32 %d\n", n);
if (i->aval != 0xffffffffU << n++) stop();
check_bvals(i, 1);
}
void i_union_4_state_33(CONSTARG svLogicVecVal* i) {
static int n = 0;
printf("i_union_4_state_33 %d\n", n);
if (i[0].aval != 0xffffffffU << n++) stop();
if ((i[1].aval & 1) != 1) stop();
check_bvals(i, 2);
}
void i_union_4_state_64(CONSTARG svLogicVecVal* i) {
static int n = 0;
printf("i_union_4_state_64 %d\n", n);
if (i[0].aval != 0xffffffffU << n++) stop();
if (i[1].aval != -1) stop();
check_bvals(i, 2);
}
void i_union_4_state_65(CONSTARG svLogicVecVal* i) {
static int n = 0;
printf("i_union_4_state_65 %d\n", n);
if (i[0].aval != 0xffffffffU << n++) stop();
if (i[1].aval != -1) stop();
if ((i[2].aval & 1) != 1) stop();
check_bvals(i, 3);
}
void i_union_4_state_128(CONSTARG svLogicVecVal* i) {
static int n = 0;
printf("i_union_4_state_128 %d\n", n);
if (i[0].aval != 0xffffffffU << n++) stop();
if (i[1].aval != -1) stop();
if (i[2].aval != -1) stop();
if (i[3].aval != -1) stop();
check_bvals(i, 4);
}
//======================================================================
// Check exported functions
//======================================================================
void set_bvals(svLogicVecVal* v, unsigned n);
void set_bvals(svLogicVecVal* v, unsigned n) {
for (unsigned i = 0; i < n; i++) {
v[i].bval = 0;
}
}
void check_exports() {
static int n = 0;
#ifndef NO_TIME
svLogicVecVal x_time[2];
svLogicVecVal x_time_t[2];
#endif
#ifndef NO_INTEGER
svLogicVecVal x_integer[1];
svLogicVecVal x_integer_t[1];
#endif
#ifndef NO_TIME
set_bvals(x_time, 2);
set_bvals(x_time_t, 2);
#endif
#ifndef NO_INTEGER
set_bvals(x_integer, 1);
set_bvals(x_integer_t, 1);
#endif
// Basic types as per IEEE 1800-2017 35.5.6
e_byte(10 + n);
e_byte_unsigned(20 + n);
e_shortint(30 + n);
e_shortint_unsigned(40 + n);
e_int(50 + n);
e_int_unsigned(60 + n);
e_longint(70 + n);
e_longint_unsigned(80 + n);
#ifndef NO_TIME
x_time[0].aval = 90 + n;
x_time[1].aval = 0;
e_time(x_time);
#endif
#ifndef NO_INTEGER
x_integer[0].aval = 100 + n;
e_integer(x_integer);
#endif
e_real(1.0 * n + 0.5);
#ifndef NO_SHORTREAL
e_shortreal(1.0f * n + 0.25f);
#endif
e_chandle(n % 2 ? reinterpret_cast<void*>(&e_chandle) : NULL);
e_string(n % 2 ? "World" : "Hello");
e_bit(n % 2);
e_logic(!(n % 2));
// Basic types via tyepdef
e_byte_t(10 + 2 * n);
e_byte_unsigned_t(20 + 2 * n);
e_shortint_t(30 + 2 * n);
e_shortint_unsigned_t(40 + 2 * n);
e_int_t(50 + 2 * n);
e_int_unsigned_t(60 + 2 * n);
e_longint_t(70 + 2 * n);
e_longint_unsigned_t(80 + 2 * n);
#ifndef NO_TIME
x_time_t[0].aval = 90 + 2 * n;
x_time_t[1].aval = 0;
e_time_t(x_time_t);
#endif
#ifndef NO_INTEGER
x_integer_t[0].aval = 100 + 2 * n;
e_integer_t(x_integer_t);
#endif
e_real_t(1.0 * (2 * n) + 0.5);
#ifndef NO_SHORTREAL
e_shortreal_t(1.0f * (2 * n) + 0.25f);
#endif
e_chandle_t(n % 2 ? NULL : reinterpret_cast<void*>(&e_chandle_t));
e_string_t(n % 2 ? "Hello" : "World");
e_bit_t(n % 2);
e_logic_t(!(n % 2));
const int m = n == 0 ? 0 : n - 1;
svBitVecVal b1[1];
svBitVecVal b2[2];
svBitVecVal b3[3];
svBitVecVal b4[4];
b3[0] = 0xffffffff;
b4[0] = 0xffffffff;
b4[1] = 0xffffffff;
b4[2] = 0xffffffff;
// 2-state packed arrays
b1[0] = n % 2;
e_array_2_state_1(b1);
b1[0] = 0xffffffff >> n;
e_array_2_state_32(b1);
b2[1] = 1 >> n;
b2[0] = 0xffffffff >> m;
e_array_2_state_33(b2);
b2[1] = 0xffffffff >> n;
b2[0] = 0xffffffff;
e_array_2_state_64(b2);
b3[2] = 1 >> n;
b3[1] = 0xffffffff >> m;
e_array_2_state_65(b3);
b4[3] = 0xffffffff >> n;
e_array_2_state_128(b4);
// 2-state packed structures
b1[0] = n % 2;
e_struct_2_state_1(b1);
b1[0] = 0xffffffff >> n;
e_struct_2_state_32(b1);
b2[1] = 1 >> n;
b2[0] = 0xffffffff >> m;
e_struct_2_state_33(b2);
b2[1] = 0xffffffff >> n;
b2[0] = 0xffffffff;
e_struct_2_state_64(b2);
b3[2] = 1 >> n;
b3[1] = 0xffffffff >> m;
e_struct_2_state_65(b3);
b4[3] = 0xffffffff >> n;
e_struct_2_state_128(b4);
// 2-state packed unions
b1[0] = n % 2;
e_union_2_state_1(b1);
b1[0] = 0xffffffff >> n;
e_union_2_state_32(b1);
b2[1] = 1 >> n;
b2[0] = 0xffffffff >> m;
e_union_2_state_33(b2);
b2[1] = 0xffffffff >> n;
b2[0] = 0xffffffff;
e_union_2_state_64(b2);
b3[2] = 1 >> n;
b3[1] = 0xffffffff >> m;
e_union_2_state_65(b3);
b4[3] = 0xffffffff >> n;
e_union_2_state_128(b4);
svLogicVecVal l1[1];
svLogicVecVal l2[2];
svLogicVecVal l3[3];
svLogicVecVal l4[4];
// bvals should be ignored, leave them un-initialized
set_bvals(l1, 1);
set_bvals(l2, 2);
set_bvals(l3, 3);
set_bvals(l4, 4);
l3[0].aval = 0xffffffff;
l4[0].aval = 0xffffffff;
l4[1].aval = 0xffffffff;
l4[2].aval = 0xffffffff;
// 4-state packed arrays
l1[0].aval = n % 2;
e_array_4_state_1(l1);
l1[0].aval = 0xffffffff >> n;
e_array_4_state_32(l1);
l2[1].aval = 1 >> n;
l2[0].aval = 0xffffffff >> m;
e_array_4_state_33(l2);
l2[1].aval = 0xffffffff >> n;
l2[0].aval = 0xffffffff;
e_array_4_state_64(l2);
l3[2].aval = 1 >> n;
l3[1].aval = 0xffffffff >> m;
e_array_4_state_65(l3);
l4[3].aval = 0xffffffff >> n;
e_array_4_state_128(l4);
// 4-state packed structures
l1[0].aval = n % 2;
e_struct_4_state_1(l1);
l1[0].aval = 0xffffffff >> n;
e_struct_4_state_32(l1);
l2[1].aval = 1 >> n;
l2[0].aval = 0xffffffff >> m;
e_struct_4_state_33(l2);
l2[1].aval = 0xffffffff >> n;
l2[0].aval = 0xffffffff;
e_struct_4_state_64(l2);
l3[2].aval = 1 >> n;
l3[1].aval = 0xffffffff >> m;
e_struct_4_state_65(l3);
l4[3].aval = 0xffffffff >> n;
e_struct_4_state_128(l4);
// 4-state packed unions
l1[0].aval = n % 2;
e_union_4_state_1(l1);
l1[0].aval = 0xffffffff >> n;
e_union_4_state_32(l1);
l2[1].aval = 1 >> n;
l2[0].aval = 0xffffffff >> m;
e_union_4_state_33(l2);
l2[1].aval = 0xffffffff >> n;
l2[0].aval = 0xffffffff;
e_union_4_state_64(l2);
l3[2].aval = 1 >> n;
l3[1].aval = 0xffffffff >> m;
e_union_4_state_65(l3);
l4[3].aval = 0xffffffff >> n;
e_union_4_state_128(l4);
n++;
}

View File

@ -0,0 +1,265 @@
i_chandle 0
i_string 0
i_bit 0
i_logic 0
i_chandle_t 0
i_string_t 0
i_bit_t 0
i_logic_t 0
i_array_2_state_1 0
i_array_2_state_32 0
i_array_2_state_33 0
i_array_2_state_64 0
i_array_2_state_65 0
i_array_2_state_128 0
i_struct_2_state_1 0
i_struct_2_state_32 0
i_struct_2_state_33 0
i_struct_2_state_64 0
i_struct_2_state_65 0
i_struct_2_state_128 0
i_union_2_state_1 0
i_union_2_state_32 0
i_union_2_state_33 0
i_union_2_state_64 0
i_union_2_state_65 0
i_union_2_state_128 0
i_array_4_state_1 0
i_array_4_state_32 0
i_array_4_state_33 0
i_array_4_state_64 0
i_array_4_state_65 0
i_array_4_state_128 0
i_struct_4_state_1 0
i_struct_4_state_32 0
i_struct_4_state_33 0
i_struct_4_state_64 0
i_struct_4_state_65 0
i_struct_4_state_128 0
i_union_4_state_1 0
i_union_4_state_32 0
i_union_4_state_33 0
i_union_4_state_64 0
i_union_4_state_65 0
i_union_4_state_128 0
e_chandle 0
e_string 0
e_bit 0
e_logic 0
e_chandle_t 0
e_string_t 0
e_bit_t 0
e_logic_t 0
e_array_2_state_1 0
e_array_2_state_32 0
e_array_2_state_33 0
e_array_2_state_64 0
e_array_2_state_65 0
e_array_2_state_128 0
e_struct_2_state_1 0
e_struct_2_state_32 0
e_struct_2_state_33 0
e_struct_2_state_64 0
e_struct_2_state_65 0
e_struct_2_state_128 0
e_union_2_state_1 0
e_union_2_state_32 0
e_union_2_state_33 0
e_union_2_state_64 0
e_union_2_state_65 0
e_union_2_state_128 0
e_array_4_state_1 0
e_array_4_state_32 0
e_array_4_state_33 0
e_array_4_state_64 0
e_array_4_state_65 0
e_array_4_state_128 0
e_struct_4_state_1 0
e_struct_4_state_32 0
e_struct_4_state_33 0
e_struct_4_state_64 0
e_struct_4_state_65 0
e_struct_4_state_128 0
e_union_4_state_1 0
e_union_4_state_32 0
e_union_4_state_33 0
e_union_4_state_64 0
e_union_4_state_65 0
e_union_4_state_128 0
i_chandle 1
i_string 1
i_bit 1
i_logic 1
i_chandle_t 1
i_string_t 1
i_bit_t 1
i_logic_t 1
i_array_2_state_1 1
i_array_2_state_32 1
i_array_2_state_33 1
i_array_2_state_64 1
i_array_2_state_65 1
i_array_2_state_128 1
i_struct_2_state_1 1
i_struct_2_state_32 1
i_struct_2_state_33 1
i_struct_2_state_64 1
i_struct_2_state_65 1
i_struct_2_state_128 1
i_union_2_state_1 1
i_union_2_state_32 1
i_union_2_state_33 1
i_union_2_state_64 1
i_union_2_state_65 1
i_union_2_state_128 1
i_array_4_state_1 1
i_array_4_state_32 1
i_array_4_state_33 1
i_array_4_state_64 1
i_array_4_state_65 1
i_array_4_state_128 1
i_struct_4_state_1 1
i_struct_4_state_32 1
i_struct_4_state_33 1
i_struct_4_state_64 1
i_struct_4_state_65 1
i_struct_4_state_128 1
i_union_4_state_1 1
i_union_4_state_32 1
i_union_4_state_33 1
i_union_4_state_64 1
i_union_4_state_65 1
i_union_4_state_128 1
e_chandle 1
e_string 1
e_bit 1
e_logic 1
e_chandle_t 1
e_string_t 1
e_bit_t 1
e_logic_t 1
e_array_2_state_1 1
e_array_2_state_32 1
e_array_2_state_33 1
e_array_2_state_64 1
e_array_2_state_65 1
e_array_2_state_128 1
e_struct_2_state_1 1
e_struct_2_state_32 1
e_struct_2_state_33 1
e_struct_2_state_64 1
e_struct_2_state_65 1
e_struct_2_state_128 1
e_union_2_state_1 1
e_union_2_state_32 1
e_union_2_state_33 1
e_union_2_state_64 1
e_union_2_state_65 1
e_union_2_state_128 1
e_array_4_state_1 1
e_array_4_state_32 1
e_array_4_state_33 1
e_array_4_state_64 1
e_array_4_state_65 1
e_array_4_state_128 1
e_struct_4_state_1 1
e_struct_4_state_32 1
e_struct_4_state_33 1
e_struct_4_state_64 1
e_struct_4_state_65 1
e_struct_4_state_128 1
e_union_4_state_1 1
e_union_4_state_32 1
e_union_4_state_33 1
e_union_4_state_64 1
e_union_4_state_65 1
e_union_4_state_128 1
i_chandle 2
i_string 2
i_bit 2
i_logic 2
i_chandle_t 2
i_string_t 2
i_bit_t 2
i_logic_t 2
i_array_2_state_1 2
i_array_2_state_32 2
i_array_2_state_33 2
i_array_2_state_64 2
i_array_2_state_65 2
i_array_2_state_128 2
i_struct_2_state_1 2
i_struct_2_state_32 2
i_struct_2_state_33 2
i_struct_2_state_64 2
i_struct_2_state_65 2
i_struct_2_state_128 2
i_union_2_state_1 2
i_union_2_state_32 2
i_union_2_state_33 2
i_union_2_state_64 2
i_union_2_state_65 2
i_union_2_state_128 2
i_array_4_state_1 2
i_array_4_state_32 2
i_array_4_state_33 2
i_array_4_state_64 2
i_array_4_state_65 2
i_array_4_state_128 2
i_struct_4_state_1 2
i_struct_4_state_32 2
i_struct_4_state_33 2
i_struct_4_state_64 2
i_struct_4_state_65 2
i_struct_4_state_128 2
i_union_4_state_1 2
i_union_4_state_32 2
i_union_4_state_33 2
i_union_4_state_64 2
i_union_4_state_65 2
i_union_4_state_128 2
e_chandle 2
e_string 2
e_bit 2
e_logic 2
e_chandle_t 2
e_string_t 2
e_bit_t 2
e_logic_t 2
e_array_2_state_1 2
e_array_2_state_32 2
e_array_2_state_33 2
e_array_2_state_64 2
e_array_2_state_65 2
e_array_2_state_128 2
e_struct_2_state_1 2
e_struct_2_state_32 2
e_struct_2_state_33 2
e_struct_2_state_64 2
e_struct_2_state_65 2
e_struct_2_state_128 2
e_union_2_state_1 2
e_union_2_state_32 2
e_union_2_state_33 2
e_union_2_state_64 2
e_union_2_state_65 2
e_union_2_state_128 2
e_array_4_state_1 2
e_array_4_state_32 2
e_array_4_state_33 2
e_array_4_state_64 2
e_array_4_state_65 2
e_array_4_state_128 2
e_struct_4_state_1 2
e_struct_4_state_32 2
e_struct_4_state_33 2
e_struct_4_state_64 2
e_struct_4_state_65 2
e_struct_4_state_128 2
e_union_4_state_1 2
e_union_4_state_32 2
e_union_4_state_33 2
e_union_4_state_64 2
e_union_4_state_65 2
e_union_4_state_128 2
*-* All Finished *-*

View File

@ -0,0 +1,45 @@
#!/usr/bin/perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2020 by Geza Lore. This program is free software; you can
# redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
scenarios(simulator => 1);
if ($Self->{nc}) {
# For NC, compile twice, first just to generate DPI headers
compile(
nc_flags2 => ["+ncdpiheader+$Self->{obj_dir}/dpi-exp.h",
"+ncdpiimpheader+$Self->{obj_dir}/dpi-imp.h"]
);
}
compile(
v_flags2 => ["t/t_dpi_arg_input_type.cpp"],
verilator_flags2 => ["-Wall -Wno-DECLFILENAME"],
# NC: Gdd the obj_dir to the C include path
nc_flags2 => ["+ncscargs+-I$Self->{obj_dir}"],
# ModelSim: Generate DPI header, add obj_dir to the C include path
ms_flags2 => ["-dpiheader $Self->{obj_dir}/dpi.h",
"-ccflags -I$Self->{obj_dir}"],
);
if ($Self->{vlt_all}) {
files_identical(
"$Self->{obj_dir}/Vt_dpi_arg_input_type__Dpi.h",
"t/t_dpi_arg_input_type__Dpi.out"
);
}
execute(
check_finished => 1,
expect_filename => $Self->{golden_filename},
ms_pli => 0
);
ok(1);
1;

View File

@ -0,0 +1,917 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// Copyright 2020 by Geza Lore. This program is free software; you can
// redistribute it and/or modify it under the terms of either the GNU
// Lesser General Public License Version 3 or the Perl Artistic License
// Version 2.0.
// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
`ifdef VCS
`define NO_TIME
`endif
`ifdef NC
`define NO_TIME
`define NO_INTEGER
`define NO_SHORTREAL
`endif
`ifdef MS
`endif
`ifdef VERILATOR
`define NO_SHORTREAL
`define NULL 64'd0
`else
`define NULL null
`endif
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
`ifdef VERILATOR
wire _unused = &{1'b0, clk};
`endif
// Legal input argument types for DPI functions
//======================================================================
// Type definitions
//======================================================================
// Basic types as per IEEE 1800-2017 35.5.6
typedef byte byte_t;
typedef byte unsigned byte_unsigned_t;
typedef shortint shortint_t;
typedef shortint unsigned shortint_unsigned_t;
typedef int int_t;
typedef int unsigned int_unsigned_t;
typedef longint longint_t;
typedef longint unsigned longint_unsigned_t;
`ifndef NO_TIME
typedef time time_t;
`endif
`ifndef NO_INTEGER
typedef integer integer_t;
`endif
typedef real real_t;
`ifndef NO_SHORTREAL
typedef shortreal shortreal_t;
`endif
typedef chandle chandle_t;
typedef string string_t;
typedef bit bit_t;
typedef logic logic_t;
// 2-state packed structures
typedef struct packed { bit x; } struct_2_state_1;
typedef struct packed { bit [15:0] x; bit [15:0] y; } struct_2_state_32;
typedef struct packed { bit [15:0] x; bit [16:0] y; } struct_2_state_33;
typedef struct packed { bit [31:0] x; bit [31:0] y; } struct_2_state_64;
typedef struct packed { bit [31:0] x; bit [32:0] y; } struct_2_state_65;
typedef struct packed { bit [63:0] x; bit [63:0] y; } struct_2_state_128;
// 2-state packed unions
typedef union packed { bit x; bit y; } union_2_state_1;
typedef union packed { bit [31:0] x; bit [31:0] y; } union_2_state_32;
typedef union packed { bit [32:0] x; bit [32:0] y; } union_2_state_33;
typedef union packed { bit [63:0] x; bit [63:0] y; } union_2_state_64;
typedef union packed { bit [64:0] x; bit [64:0] y; } union_2_state_65;
typedef union packed { bit [127:0] x; bit [127:0] y; } union_2_state_128;
// 4-state packed structures
typedef struct packed { logic x; } struct_4_state_1;
typedef struct packed { logic [15:0] x; bit [15:0] y; } struct_4_state_32;
typedef struct packed { logic [15:0] x; bit [16:0] y; } struct_4_state_33;
typedef struct packed { logic [31:0] x; bit [31:0] y; } struct_4_state_64;
typedef struct packed { logic [31:0] x; bit [32:0] y; } struct_4_state_65;
typedef struct packed { logic [63:0] x; bit [63:0] y; } struct_4_state_128;
// 4-state packed unions
typedef union packed { logic x; bit y; } union_4_state_1;
typedef union packed { logic [31:0] x; bit [31:0] y; } union_4_state_32;
typedef union packed { logic [32:0] x; bit [32:0] y; } union_4_state_33;
typedef union packed { logic [63:0] x; bit [63:0] y; } union_4_state_64;
typedef union packed { logic [64:0] x; bit [64:0] y; } union_4_state_65;
typedef union packed { logic [127:0] x; bit [127:0] y; } union_4_state_128;
//======================================================================
// Imports
//======================================================================
// Basic types as per IEEE 1800-2017 35.5.6
import "DPI-C" function void i_byte (input byte i);
import "DPI-C" function void i_byte_unsigned (input byte unsigned i);
import "DPI-C" function void i_shortint (input shortint i);
import "DPI-C" function void i_shortint_unsigned (input shortint unsigned i);
import "DPI-C" function void i_int (input int i);
import "DPI-C" function void i_int_unsigned (input int unsigned i);
import "DPI-C" function void i_longint (input longint i);
import "DPI-C" function void i_longint_unsigned (input longint unsigned i);
`ifndef NO_TIME
import "DPI-C" function void i_time (input time i);
`endif
`ifndef NO_INTEGER
import "DPI-C" function void i_integer (input integer i);
`endif
import "DPI-C" function void i_real (input real i);
`ifndef NO_SHORTREAL
import "DPI-C" function void i_shortreal (input shortreal i);
`endif
import "DPI-C" function void i_chandle (input chandle i);
import "DPI-C" function void i_string (input string i);
import "DPI-C" function void i_bit (input bit i);
import "DPI-C" function void i_logic (input logic i);
// Basic types via typedef
import "DPI-C" function void i_byte_t (input byte_t i);
import "DPI-C" function void i_byte_unsigned_t (input byte_unsigned_t i);
import "DPI-C" function void i_shortint_t (input shortint_t i);
import "DPI-C" function void i_shortint_unsigned_t (input shortint_unsigned_t i);
import "DPI-C" function void i_int_t (input int_t i);
import "DPI-C" function void i_int_unsigned_t (input int_unsigned_t i);
import "DPI-C" function void i_longint_t (input longint_t i);
import "DPI-C" function void i_longint_unsigned_t (input longint_unsigned_t i);
`ifndef NO_TIME
import "DPI-C" function void i_time_t (input time_t i);
`endif
`ifndef NO_INTEGER
import "DPI-C" function void i_integer_t (input integer_t i);
`endif
import "DPI-C" function void i_real_t (input real_t i);
`ifndef NO_SHORTREAL
import "DPI-C" function void i_shortreal_t (input shortreal_t i);
`endif
import "DPI-C" function void i_chandle_t (input chandle_t i);
import "DPI-C" function void i_string_t (input string_t i);
import "DPI-C" function void i_bit_t (input bit_t i);
import "DPI-C" function void i_logic_t (input logic_t i);
// 2-state packed arrays
import "DPI-C" function void i_array_2_state_1 (input bit [ 0:0] i);
import "DPI-C" function void i_array_2_state_32 (input bit [ 31:0] i);
import "DPI-C" function void i_array_2_state_33 (input bit [ 32:0] i);
import "DPI-C" function void i_array_2_state_64 (input bit [ 63:0] i);
import "DPI-C" function void i_array_2_state_65 (input bit [ 64:0] i);
import "DPI-C" function void i_array_2_state_128(input bit [127:0] i);
// 2-state packed structures
import "DPI-C" function void i_struct_2_state_1 (input struct_2_state_1 i);
import "DPI-C" function void i_struct_2_state_32 (input struct_2_state_32 i);
import "DPI-C" function void i_struct_2_state_33 (input struct_2_state_33 i);
import "DPI-C" function void i_struct_2_state_64 (input struct_2_state_64 i);
import "DPI-C" function void i_struct_2_state_65 (input struct_2_state_65 i);
import "DPI-C" function void i_struct_2_state_128 (input struct_2_state_128 i);
// 2-state packed unions
import "DPI-C" function void i_union_2_state_1 (input union_2_state_1 i);
import "DPI-C" function void i_union_2_state_32 (input union_2_state_32 i);
import "DPI-C" function void i_union_2_state_33 (input union_2_state_33 i);
import "DPI-C" function void i_union_2_state_64 (input union_2_state_64 i);
import "DPI-C" function void i_union_2_state_65 (input union_2_state_65 i);
import "DPI-C" function void i_union_2_state_128(input union_2_state_128 i);
// 4-state packed arrays
import "DPI-C" function void i_array_4_state_1 (input logic [ 0:0] i);
import "DPI-C" function void i_array_4_state_32 (input logic [ 31:0] i);
import "DPI-C" function void i_array_4_state_33 (input logic [ 32:0] i);
import "DPI-C" function void i_array_4_state_64 (input logic [ 63:0] i);
import "DPI-C" function void i_array_4_state_65 (input logic [ 64:0] i);
import "DPI-C" function void i_array_4_state_128(input logic [127:0] i);
// 4-state packed structures
import "DPI-C" function void i_struct_4_state_1 (input struct_4_state_1 i);
import "DPI-C" function void i_struct_4_state_32 (input struct_4_state_32 i);
import "DPI-C" function void i_struct_4_state_33 (input struct_4_state_33 i);
import "DPI-C" function void i_struct_4_state_64 (input struct_4_state_64 i);
import "DPI-C" function void i_struct_4_state_65 (input struct_4_state_65 i);
import "DPI-C" function void i_struct_4_state_128 (input struct_4_state_128 i);
// 4-state packed unions
import "DPI-C" function void i_union_4_state_1 (input union_4_state_1 i);
import "DPI-C" function void i_union_4_state_32 (input union_4_state_32 i);
import "DPI-C" function void i_union_4_state_33 (input union_4_state_33 i);
import "DPI-C" function void i_union_4_state_64 (input union_4_state_64 i);
import "DPI-C" function void i_union_4_state_65 (input union_4_state_65 i);
import "DPI-C" function void i_union_4_state_128(input union_4_state_128 i);
//======================================================================
// Exports
//======================================================================
// Basic types as per IEEE 1800-2017 35.5.6
export "DPI-C" function e_byte;
export "DPI-C" function e_byte_unsigned;
export "DPI-C" function e_shortint;
export "DPI-C" function e_shortint_unsigned;
export "DPI-C" function e_int;
export "DPI-C" function e_int_unsigned;
export "DPI-C" function e_longint;
export "DPI-C" function e_longint_unsigned;
`ifndef NO_TIME
export "DPI-C" function e_time;
`endif
`ifndef NO_INTEGER
export "DPI-C" function e_integer;
`endif
export "DPI-C" function e_real;
`ifndef NO_SHORTREAL
export "DPI-C" function e_shortreal;
`endif
export "DPI-C" function e_chandle;
export "DPI-C" function e_string;
export "DPI-C" function e_bit;
export "DPI-C" function e_logic;
// Basic types via typedef
export "DPI-C" function e_byte_t;
export "DPI-C" function e_byte_unsigned_t;
export "DPI-C" function e_shortint_t;
export "DPI-C" function e_shortint_unsigned_t;
export "DPI-C" function e_int_t;
export "DPI-C" function e_int_unsigned_t;
export "DPI-C" function e_longint_t;
export "DPI-C" function e_longint_unsigned_t;
`ifndef NO_TIME
export "DPI-C" function e_time_t;
`endif
`ifndef NO_INTEGER
export "DPI-C" function e_integer_t;
`endif
export "DPI-C" function e_real_t;
`ifndef NO_SHORTREAL
export "DPI-C" function e_shortreal_t;
`endif
export "DPI-C" function e_chandle_t;
export "DPI-C" function e_string_t;
export "DPI-C" function e_bit_t;
export "DPI-C" function e_logic_t;
// 2-state packed arrays
export "DPI-C" function e_array_2_state_1;
export "DPI-C" function e_array_2_state_32;
export "DPI-C" function e_array_2_state_33;
export "DPI-C" function e_array_2_state_64;
export "DPI-C" function e_array_2_state_65;
export "DPI-C" function e_array_2_state_128;
// 2-state packed structures
export "DPI-C" function e_struct_2_state_1;
export "DPI-C" function e_struct_2_state_32;
export "DPI-C" function e_struct_2_state_33;
export "DPI-C" function e_struct_2_state_64;
export "DPI-C" function e_struct_2_state_65;
export "DPI-C" function e_struct_2_state_128;
// 2-state packed unions
export "DPI-C" function e_union_2_state_1;
export "DPI-C" function e_union_2_state_32;
export "DPI-C" function e_union_2_state_33;
export "DPI-C" function e_union_2_state_64;
export "DPI-C" function e_union_2_state_65;
export "DPI-C" function e_union_2_state_128;
// 4-state packed arrays
export "DPI-C" function e_array_4_state_1;
export "DPI-C" function e_array_4_state_32;
export "DPI-C" function e_array_4_state_33;
export "DPI-C" function e_array_4_state_64;
export "DPI-C" function e_array_4_state_65;
export "DPI-C" function e_array_4_state_128;
// 4-state packed structures
export "DPI-C" function e_struct_4_state_1;
export "DPI-C" function e_struct_4_state_32;
export "DPI-C" function e_struct_4_state_33;
export "DPI-C" function e_struct_4_state_64;
export "DPI-C" function e_struct_4_state_65;
export "DPI-C" function e_struct_4_state_128;
// 4-state packed unions
export "DPI-C" function e_union_4_state_1;
export "DPI-C" function e_union_4_state_32;
export "DPI-C" function e_union_4_state_33;
export "DPI-C" function e_union_4_state_64;
export "DPI-C" function e_union_4_state_65;
export "DPI-C" function e_union_4_state_128;
//======================================================================
// Definitions of exported functions
//======================================================================
// Basic types as per IEEE 1800-2017 35.5.6
byte n_byte = 0;
function void e_byte(input byte i);
if (i !== 8'd10 + n_byte) $stop;
n_byte++;
endfunction
byte n_byte_unsigned = 0;
function void e_byte_unsigned(input byte unsigned i);
if (i !== 8'd20 + n_byte_unsigned) $stop;
n_byte_unsigned++;
endfunction
shortint n_shortint = 0;
function void e_shortint(input shortint i);
if (i !== 16'd30 + n_shortint) $stop;
n_shortint++;
endfunction
shortint n_shortint_unsigned = 0;
function void e_shortint_unsigned(input shortint unsigned i);
if (i !== 16'd40 + n_shortint_unsigned) $stop;
n_shortint_unsigned++;
endfunction
int n_int = 0;
function void e_int(input int i);
if (i !== 32'd50 + n_int) $stop;
n_int++;
endfunction
int n_int_unsigned = 0;
function void e_int_unsigned(input int unsigned i);
if (i !== 32'd60 + n_int_unsigned) $stop;
n_int_unsigned++;
endfunction
longint n_longint = 0;
function void e_longint(input longint i);
if (i !== 64'd70 + n_longint) $stop;
n_longint++;
endfunction
longint n_longint_unsigned = 0;
function void e_longint_unsigned(input longint unsigned i);
if (i !== 64'd80 + n_longint_unsigned) $stop;
n_longint_unsigned++;
endfunction
`ifndef NO_TIME
longint n_time = 0;
function void e_time(input time i);
if (i !== 64'd90 + n_time) $stop;
n_time++;
endfunction
`endif
`ifndef NO_INTEGER
int n_integer = 0;
function void e_integer(input integer i);
if (i !== 32'd100 + n_integer) $stop;
n_integer++;
endfunction
`endif
int n_real = 0;
function void e_real(input real i);
if (i != real'(2*n_real + 1) / 2.0) $stop;
n_real++;
endfunction
`ifndef NO_SHORTREAL
int n_shortreal = 0;
function void e_shortreal(input shortreal i);
if (i != shortreal'(4*n_shortreal + 1)/ 4.0) $stop;
n_shortreal++;
endfunction
`endif
int n_chandle = 0;
function void e_chandle(input chandle i);
$display("e_chandle %1d", n_chandle);
if (!n_chandle[0]) begin
if (i !== `NULL) $stop;
end else begin
if (i === `NULL) $stop;
end
n_chandle++;
endfunction
int n_string = 0;
function void e_string(input string i);
$display("e_string %1d", n_string);
if (!n_string[0]) begin
if (i != "Hello") $stop;
end else begin
if (i != "World") $stop;
end
n_string++;
endfunction
int n_bit = 0;
function void e_bit(input bit i);
$display("e_bit %1d", n_bit);
if (i !== n_bit[0]) $stop;
n_bit++;
endfunction
int n_logic = 0;
function void e_logic(input logic i);
$display("e_logic %1d", n_logic);
if (i !== ~n_logic[0]) $stop;
n_logic++;
endfunction
// Basic types via typedefs
byte_t n_byte_t = 0;
function void e_byte_t(input byte_t i);
if (i !== 8'd10 + n_byte_t) $stop;
n_byte_t += 2;
endfunction
byte n_byte_unsigned_t = 0;
function void e_byte_unsigned_t(input byte_unsigned_t i);
if (i !== 8'd20 + n_byte_unsigned_t) $stop;
n_byte_unsigned_t += 2;
endfunction
shortint_t n_shortint_t = 0;
function void e_shortint_t(input shortint_t i);
if (i !== 16'd30 + n_shortint_t) $stop;
n_shortint_t += 2;
endfunction
shortint n_shortint_unsigned_t = 0;
function void e_shortint_unsigned_t(input shortint_unsigned_t i);
if (i !== 16'd40 + n_shortint_unsigned_t) $stop;
n_shortint_unsigned_t += 2;
endfunction
int_t n_int_t = 0;
function void e_int_t(input int_t i);
if (i !== 32'd50 + n_int_t) $stop;
n_int_t += 2;
endfunction
int n_int_unsigned_t = 0;
function void e_int_unsigned_t(input int_unsigned_t i);
if (i !== 32'd60 + n_int_unsigned_t) $stop;
n_int_unsigned_t += 2;
endfunction
longint_t n_longint_t = 0;
function void e_longint_t(input longint_t i);
if (i !== 64'd70 + n_longint_t) $stop;
n_longint_t += 2;
endfunction
longint n_longint_unsigned_t = 0;
function void e_longint_unsigned_t(input longint_unsigned_t i);
if (i !== 64'd80 + n_longint_unsigned_t) $stop;
n_longint_unsigned_t += 2;
endfunction
`ifndef NO_TIME
longint n_time_t = 0;
function void e_time_t(input time_t i);
if (i !== 64'd90 + n_time_t) $stop;
n_time_t += 2;
endfunction
`endif
`ifndef NO_INTEGER
int n_integer_t = 0;
function void e_integer_t(input integer_t i);
if (i !== 32'd100 + n_integer_t) $stop;
n_integer_t += 2;
endfunction
`endif
int n_real_t = 0;
function void e_real_t(input real_t i);
if (i != real'(2*n_real_t + 1) / 2.0) $stop;
n_real_t += 2;
endfunction
`ifndef NO_SHORTREAL
int n_shortreal_t = 0;
function void e_shortreal_t(input shortreal_t i);
if (i != shortreal'(4*n_shortreal_t + 1)/ 4.0) $stop;
n_shortreal_t += 2;
endfunction
`endif
int n_chandle_t = 0;
function void e_chandle_t(input chandle_t i);
$display("e_chandle_t %1d", n_chandle_t);
if (!n_chandle_t[0]) begin
if (i === `NULL) $stop;
end else begin
if (i !== `NULL) $stop;
end
n_chandle_t++;
endfunction
int n_string_t = 0;
function void e_string_t(input string_t i);
$display("e_string_t %1d", n_string_t);
if (!n_string_t[0]) begin
if (i != "World") $stop;
end else begin
if (i != "Hello") $stop;
end
n_string_t++;
endfunction
int n_bit_t = 0;
function void e_bit_t(input bit_t i);
$display("e_bit_t %1d", n_bit_t);
if (i !== n_bit_t[0]) $stop;
n_bit_t++;
endfunction
int n_logic_t = 0;
function void e_logic_t(input logic_t i);
$display("e_logic_t %1d", n_logic_t);
if (i !== ~n_logic_t[0]) $stop;
n_logic_t++;
endfunction
// 2-state packed arrays
int n_array_2_state_1 = 0;
function void e_array_2_state_1(input bit [ 0:0] i);
$display("e_array_2_state_1 %1d", n_array_2_state_1);
if (i !== n_array_2_state_1[0]) $stop;
n_array_2_state_1++;
endfunction
int n_array_2_state_32 = 0;
function void e_array_2_state_32(input bit [31:0] i);
$display("e_array_2_state_32 %1d", n_array_2_state_32);
if (i !== ~32'd0 >> n_array_2_state_32) $stop;
n_array_2_state_32++;
endfunction
int n_array_2_state_33 = 0;
function void e_array_2_state_33(input bit [32:0] i);
$display("e_array_2_state_33 %1d", n_array_2_state_33);
if (i !== ~33'd0 >> n_array_2_state_33) $stop;
n_array_2_state_33++;
endfunction
int n_array_2_state_64 = 0;
function void e_array_2_state_64(input bit [63:0] i);
$display("e_array_2_state_64 %1d", n_array_2_state_64);
if (i !== ~64'd0 >> n_array_2_state_64) $stop;
n_array_2_state_64++;
endfunction
int n_array_2_state_65 = 0;
function void e_array_2_state_65(input bit [64:0] i);
$display("e_array_2_state_65 %1d", n_array_2_state_65);
if (i !== ~65'd0 >> n_array_2_state_65) $stop;
n_array_2_state_65++;
endfunction
int n_array_2_state_128 = 0;
function void e_array_2_state_128(input bit [127:0] i);
$display("e_array_2_state_128 %1d", n_array_2_state_128);
if (i !== ~128'd0 >> n_array_2_state_128) $stop;
n_array_2_state_128++;
endfunction
// 2-state packed structures
int n_struct_2_state_1 = 0;
function void e_struct_2_state_1(input struct_2_state_1 i);
$display("e_struct_2_state_1 %1d", n_struct_2_state_1);
if (i !== n_struct_2_state_1[0]) $stop;
n_struct_2_state_1++;
endfunction
int n_struct_2_state_32 = 0;
function void e_struct_2_state_32(input struct_2_state_32 i);
$display("e_struct_2_state_32 %1d", n_struct_2_state_32);
if (i !== ~32'd0 >> n_struct_2_state_32) $stop;
n_struct_2_state_32++;
endfunction
int n_struct_2_state_33 = 0;
function void e_struct_2_state_33(input struct_2_state_33 i);
$display("e_struct_2_state_33 %1d", n_struct_2_state_33);
if (i !== ~33'd0 >> n_struct_2_state_33) $stop;
n_struct_2_state_33++;
endfunction
int n_struct_2_state_64 = 0;
function void e_struct_2_state_64(input struct_2_state_64 i);
$display("e_struct_2_state_64 %1d", n_struct_2_state_64);
if (i !== ~64'd0 >> n_struct_2_state_64) $stop;
n_struct_2_state_64++;
endfunction
int n_struct_2_state_65 = 0;
function void e_struct_2_state_65(input struct_2_state_65 i);
$display("e_struct_2_state_65 %1d", n_struct_2_state_65);
if (i !== ~65'd0 >> n_struct_2_state_65) $stop;
n_struct_2_state_65++;
endfunction
int n_struct_2_state_128 = 0;
function void e_struct_2_state_128(input struct_2_state_128 i);
$display("e_struct_2_state_128 %1d", n_struct_2_state_128);
if (i !== ~128'd0 >> n_struct_2_state_128) $stop;
n_struct_2_state_128++;
endfunction
// 2-state packed unions
int n_union_2_state_1 = 0;
function void e_union_2_state_1(input union_2_state_1 i);
$display("e_union_2_state_1 %1d", n_union_2_state_1);
if (i !== n_union_2_state_1[0]) $stop;
n_union_2_state_1++;
endfunction
int n_union_2_state_32 = 0;
function void e_union_2_state_32(input union_2_state_32 i);
$display("e_union_2_state_32 %1d", n_union_2_state_32);
if (i !== ~32'd0 >> n_union_2_state_32) $stop;
n_union_2_state_32++;
endfunction
int n_union_2_state_33 = 0;
function void e_union_2_state_33(input union_2_state_33 i);
$display("e_union_2_state_33 %1d", n_union_2_state_33);
if (i !== ~33'd0 >> n_union_2_state_33) $stop;
n_union_2_state_33++;
endfunction
int n_union_2_state_64 = 0;
function void e_union_2_state_64(input union_2_state_64 i);
$display("e_union_2_state_64 %1d", n_union_2_state_64);
if (i !== ~64'd0 >> n_union_2_state_64) $stop;
n_union_2_state_64++;
endfunction
int n_union_2_state_65 = 0;
function void e_union_2_state_65(input union_2_state_65 i);
$display("e_union_2_state_65 %1d", n_union_2_state_65);
if (i !== ~65'd0 >> n_union_2_state_65) $stop;
n_union_2_state_65++;
endfunction
int n_union_2_state_128 = 0;
function void e_union_2_state_128(input union_2_state_128 i);
$display("e_union_2_state_128 %1d", n_union_2_state_128);
if (i !== ~128'd0 >> n_union_2_state_128) $stop;
n_union_2_state_128++;
endfunction
// 4-state packed arrays
int n_array_4_state_1 = 0;
function void e_array_4_state_1(input logic [ 0:0] i);
$display("e_array_4_state_1 %1d", n_array_4_state_1);
if (i !== n_array_4_state_1[0]) $stop;
n_array_4_state_1++;
endfunction
int n_array_4_state_32 = 0;
function void e_array_4_state_32(input logic [31:0] i);
$display("e_array_4_state_32 %1d", n_array_4_state_32);
if (i !== ~32'd0 >> n_array_4_state_32) $stop;
n_array_4_state_32++;
endfunction
int n_array_4_state_33 = 0;
function void e_array_4_state_33(input logic [32:0] i);
$display("e_array_4_state_33 %1d", n_array_4_state_33);
if (i !== ~33'd0 >> n_array_4_state_33) $stop;
n_array_4_state_33++;
endfunction
int n_array_4_state_64 = 0;
function void e_array_4_state_64(input logic [63:0] i);
$display("e_array_4_state_64 %1d", n_array_4_state_64);
if (i !== ~64'd0 >> n_array_4_state_64) $stop;
n_array_4_state_64++;
endfunction
int n_array_4_state_65 = 0;
function void e_array_4_state_65(input logic [64:0] i);
$display("e_array_4_state_65 %1d", n_array_4_state_65);
if (i !== ~65'd0 >> n_array_4_state_65) $stop;
n_array_4_state_65++;
endfunction
int n_array_4_state_128 = 0;
function void e_array_4_state_128(input logic [127:0] i);
$display("e_array_4_state_128 %1d", n_array_4_state_128);
if (i !== ~128'd0 >> n_array_4_state_128) $stop;
n_array_4_state_128++;
endfunction
// 4-state packed structures
int n_struct_4_state_1 = 0;
function void e_struct_4_state_1(input struct_4_state_1 i);
$display("e_struct_4_state_1 %1d", n_struct_4_state_1);
if (i !== n_struct_4_state_1[0]) $stop;
n_struct_4_state_1++;
endfunction
int n_struct_4_state_32 = 0;
function void e_struct_4_state_32(input struct_4_state_32 i);
$display("e_struct_4_state_32 %1d", n_struct_4_state_32);
if (i !== ~32'd0 >> n_struct_4_state_32) $stop;
n_struct_4_state_32++;
endfunction
int n_struct_4_state_33 = 0;
function void e_struct_4_state_33(input struct_4_state_33 i);
$display("e_struct_4_state_33 %1d", n_struct_4_state_33);
if (i !== ~33'd0 >> n_struct_4_state_33) $stop;
n_struct_4_state_33++;
endfunction
int n_struct_4_state_64 = 0;
function void e_struct_4_state_64(input struct_4_state_64 i);
$display("e_struct_4_state_64 %1d", n_struct_4_state_64);
if (i !== ~64'd0 >> n_struct_4_state_64) $stop;
n_struct_4_state_64++;
endfunction
int n_struct_4_state_65 = 0;
function void e_struct_4_state_65(input struct_4_state_65 i);
$display("e_struct_4_state_65 %1d", n_struct_4_state_65);
if (i !== ~65'd0 >> n_struct_4_state_65) $stop;
n_struct_4_state_65++;
endfunction
int n_struct_4_state_128 = 0;
function void e_struct_4_state_128(input struct_4_state_128 i);
$display("e_struct_4_state_128 %1d", n_struct_4_state_128);
if (i !== ~128'd0 >> n_struct_4_state_128) $stop;
n_struct_4_state_128++;
endfunction
// 4-state packed unions
int n_union_4_state_1 = 0;
function void e_union_4_state_1(input union_4_state_1 i);
$display("e_union_4_state_1 %1d", n_union_4_state_1);
if (i !== n_union_4_state_1[0]) $stop;
n_union_4_state_1++;
endfunction
int n_union_4_state_32 = 0;
function void e_union_4_state_32(input union_4_state_32 i);
$display("e_union_4_state_32 %1d", n_union_4_state_32);
if (i !== ~32'd0 >> n_union_4_state_32) $stop;
n_union_4_state_32++;
endfunction
int n_union_4_state_33 = 0;
function void e_union_4_state_33(input union_4_state_33 i);
$display("e_union_4_state_33 %1d", n_union_4_state_33);
if (i !== ~33'd0 >> n_union_4_state_33) $stop;
n_union_4_state_33++;
endfunction
int n_union_4_state_64 = 0;
function void e_union_4_state_64(input union_4_state_64 i);
$display("e_union_4_state_64 %1d", n_union_4_state_64);
if (i !== ~64'd0 >> n_union_4_state_64) $stop;
n_union_4_state_64++;
endfunction
int n_union_4_state_65 = 0;
function void e_union_4_state_65(input union_4_state_65 i);
$display("e_union_4_state_65 %1d", n_union_4_state_65);
if (i !== ~65'd0 >> n_union_4_state_65) $stop;
n_union_4_state_65++;
endfunction
int n_union_4_state_128 = 0;
function void e_union_4_state_128(input union_4_state_128 i);
$display("e_union_4_state_128 %1d", n_union_4_state_128);
if (i !== ~128'd0 >> n_union_4_state_128) $stop;
n_union_4_state_128++;
endfunction
//======================================================================
// Invoke all functions 3 times (they have side effects)
//======================================================================
import "DPI-C" context function void check_exports();
initial begin
for (int i = 0 ; i < 3; i++) begin
// Check the imports
// Basic types as per IEEE 1800-2017 35.5.6
i_byte( 8'd10 - 8'(i));
i_byte_unsigned( 8'd20 - 8'(i));
i_shortint( 16'd30 - 16'(i));
i_shortint_unsigned( 16'd40 - 16'(i));
i_int( 32'd50 - 32'(i));
i_int_unsigned( 32'd60 - 32'(i));
i_longint( 64'd70 - 64'(i));
i_longint_unsigned( 64'd80 - 64'(i));
`ifndef NO_TIME
i_time( 64'd90 - 64'(i));
`endif
`ifndef NO_INTEGER
i_integer( 32'd100- 32'(i));
`endif
i_real( -1.0*i - 0.50);
`ifndef NO_SHORTREAL
i_shortreal( -1.0*i - 0.25);
`endif
if (~i[0]) begin
i_chandle(`NULL);
i_string("World");
end else begin
i_chandle(`NULL);
i_string("Hello");
end
i_bit(~i[0]);
i_logic(i[0]);
// Basic types via typedefs
i_byte_t( 8'd10 - 8'(2*i));
i_byte_unsigned_t( 8'd20 - 8'(2*i));
i_shortint_t( 16'd30 - 16'(2*i));
i_shortint_unsigned_t( 16'd40 - 16'(2*i));
i_int_t( 32'd50 - 32'(2*i));
i_int_unsigned_t( 32'd60 - 32'(2*i));
i_longint_t( 64'd70 - 64'(2*i));
i_longint_unsigned_t( 64'd80 - 64'(2*i));
`ifndef NO_TIME
i_time_t( 64'd90 - 64'(2*i));
`endif
`ifndef NO_INTEGER
i_integer_t( 32'd100- 32'(2*i));
`endif
i_real_t( -1.0*(2*i) - 0.50);
`ifndef NO_SHORTREAL
i_shortreal_t( -1.0*(2*i) - 0.25);
`endif
if (~i[0]) begin
i_chandle_t(`NULL);
i_string_t("World");
end else begin
i_chandle_t(`NULL);
i_string_t("Hello");
end
i_bit_t(~i[0]);
i_logic_t(i[0]);
// 2-state packed arrays
i_array_2_state_1(~i[0]);
i_array_2_state_32(~32'd0 << i);
i_array_2_state_33(~33'd0 << i);
i_array_2_state_64(~64'd0 << i);
i_array_2_state_65(~65'd0 << i);
i_array_2_state_128(~128'd0 << i);
// 2-state packed structures
i_struct_2_state_1(~i[0]);
i_struct_2_state_32(~32'd0 << i);
i_struct_2_state_33(~33'd0 << i);
i_struct_2_state_64(~64'd0 << i);
i_struct_2_state_65(~65'd0 << i);
i_struct_2_state_128(~128'd0 << i);
// 2-state packed unions
i_union_2_state_1(~i[0]);
i_union_2_state_32(~32'd0 << i);
i_union_2_state_33(~33'd0 << i);
i_union_2_state_64(~64'd0 << i);
i_union_2_state_65(~65'd0 << i);
i_union_2_state_128(~128'd0 << i);
// 4-state packed arrays
i_array_4_state_1(~i[0]);
i_array_4_state_32(~32'd0 << i);
i_array_4_state_33(~33'd0 << i);
i_array_4_state_64(~64'd0 << i);
i_array_4_state_65(~65'd0 << i);
i_array_4_state_128(~128'd0 << i);
// 4-state packed structures
i_struct_4_state_1(~i[0]);
i_struct_4_state_32(~32'd0 << i);
i_struct_4_state_33(~33'd0 << i);
i_struct_4_state_64(~64'd0 << i);
i_struct_4_state_65(~65'd0 << i);
i_struct_4_state_128(~128'd0 << i);
// 4-state packed unions
i_union_4_state_1(~i[0]);
i_union_4_state_32(~32'd0 << i);
i_union_4_state_33(~33'd0 << i);
i_union_4_state_64(~64'd0 << i);
i_union_4_state_65(~65'd0 << i);
i_union_4_state_128(~128'd0 << i);
// Check the exports
check_exports();
end
$write("*-* All Finished *-*\n");
$finish;
end
endmodule

View File

@ -0,0 +1,287 @@
// Verilated -*- C++ -*-
// DESCRIPTION: Verilator output: Prototypes for DPI import and export functions.
//
// Verilator includes this file in all generated .cpp files that use DPI functions.
// Manually include this file where DPI .c import functions are declared to ensure
// the C functions match the expectations of the DPI imports.
#include "svdpi.h"
#ifdef __cplusplus
extern "C" {
#endif
// DPI EXPORTS
// DPI export at t/t_dpi_arg_input_type.v:537:18
extern void e_array_2_state_1(const svBitVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:572:18
extern void e_array_2_state_128(const svBitVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:544:18
extern void e_array_2_state_32(const svBitVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:551:18
extern void e_array_2_state_33(const svBitVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:558:18
extern void e_array_2_state_64(const svBitVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:565:18
extern void e_array_2_state_65(const svBitVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:666:18
extern void e_array_4_state_1(const svLogicVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:701:18
extern void e_array_4_state_128(const svLogicVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:673:18
extern void e_array_4_state_32(const svLogicVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:680:18
extern void e_array_4_state_33(const svLogicVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:687:18
extern void e_array_4_state_64(const svLogicVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:694:18
extern void e_array_4_state_65(const svLogicVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:407:18
extern void e_bit(svBit i);
// DPI export at t/t_dpi_arg_input_type.v:522:18
extern void e_bit_t(svBit i);
// DPI export at t/t_dpi_arg_input_type.v:307:18
extern void e_byte(char i);
// DPI export at t/t_dpi_arg_input_type.v:422:18
extern void e_byte_t(char i);
// DPI export at t/t_dpi_arg_input_type.v:313:18
extern void e_byte_unsigned(unsigned char i);
// DPI export at t/t_dpi_arg_input_type.v:428:18
extern void e_byte_unsigned_t(unsigned char i);
// DPI export at t/t_dpi_arg_input_type.v:385:18
extern void e_chandle(void* i);
// DPI export at t/t_dpi_arg_input_type.v:500:18
extern void e_chandle_t(void* i);
// DPI export at t/t_dpi_arg_input_type.v:331:18
extern void e_int(int i);
// DPI export at t/t_dpi_arg_input_type.v:446:18
extern void e_int_t(int i);
// DPI export at t/t_dpi_arg_input_type.v:337:18
extern void e_int_unsigned(unsigned int i);
// DPI export at t/t_dpi_arg_input_type.v:452:18
extern void e_int_unsigned_t(unsigned int i);
// DPI export at t/t_dpi_arg_input_type.v:364:18
extern void e_integer(const svLogicVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:479:18
extern void e_integer_t(const svLogicVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:414:18
extern void e_logic(svLogic i);
// DPI export at t/t_dpi_arg_input_type.v:529:18
extern void e_logic_t(svLogic i);
// DPI export at t/t_dpi_arg_input_type.v:343:18
extern void e_longint(long long i);
// DPI export at t/t_dpi_arg_input_type.v:458:18
extern void e_longint_t(long long i);
// DPI export at t/t_dpi_arg_input_type.v:349:18
extern void e_longint_unsigned(unsigned long long i);
// DPI export at t/t_dpi_arg_input_type.v:464:18
extern void e_longint_unsigned_t(unsigned long long i);
// DPI export at t/t_dpi_arg_input_type.v:371:18
extern void e_real(double i);
// DPI export at t/t_dpi_arg_input_type.v:486:18
extern void e_real_t(double i);
// DPI export at t/t_dpi_arg_input_type.v:319:18
extern void e_shortint(short i);
// DPI export at t/t_dpi_arg_input_type.v:434:18
extern void e_shortint_t(short i);
// DPI export at t/t_dpi_arg_input_type.v:325:18
extern void e_shortint_unsigned(unsigned short i);
// DPI export at t/t_dpi_arg_input_type.v:440:18
extern void e_shortint_unsigned_t(unsigned short i);
// DPI export at t/t_dpi_arg_input_type.v:396:18
extern void e_string(const char* i);
// DPI export at t/t_dpi_arg_input_type.v:511:18
extern void e_string_t(const char* i);
// DPI export at t/t_dpi_arg_input_type.v:580:18
extern void e_struct_2_state_1(const svBitVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:615:18
extern void e_struct_2_state_128(const svBitVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:587:18
extern void e_struct_2_state_32(const svBitVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:594:18
extern void e_struct_2_state_33(const svBitVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:601:18
extern void e_struct_2_state_64(const svBitVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:608:18
extern void e_struct_2_state_65(const svBitVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:709:18
extern void e_struct_4_state_1(const svLogicVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:744:18
extern void e_struct_4_state_128(const svLogicVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:716:18
extern void e_struct_4_state_32(const svLogicVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:723:18
extern void e_struct_4_state_33(const svLogicVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:730:18
extern void e_struct_4_state_64(const svLogicVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:737:18
extern void e_struct_4_state_65(const svLogicVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:356:18
extern void e_time(const svLogicVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:471:18
extern void e_time_t(const svLogicVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:623:18
extern void e_union_2_state_1(const svBitVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:658:18
extern void e_union_2_state_128(const svBitVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:630:18
extern void e_union_2_state_32(const svBitVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:637:18
extern void e_union_2_state_33(const svBitVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:644:18
extern void e_union_2_state_64(const svBitVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:651:18
extern void e_union_2_state_65(const svBitVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:752:18
extern void e_union_4_state_1(const svLogicVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:787:18
extern void e_union_4_state_128(const svLogicVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:759:18
extern void e_union_4_state_32(const svLogicVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:766:18
extern void e_union_4_state_33(const svLogicVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:773:18
extern void e_union_4_state_64(const svLogicVecVal* i);
// DPI export at t/t_dpi_arg_input_type.v:780:18
extern void e_union_4_state_65(const svLogicVecVal* i);
// DPI IMPORTS
// DPI import at t/t_dpi_arg_input_type.v:797:41
extern void check_exports();
// DPI import at t/t_dpi_arg_input_type.v:154:33
extern void i_array_2_state_1(const svBitVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:159:33
extern void i_array_2_state_128(const svBitVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:155:33
extern void i_array_2_state_32(const svBitVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:156:33
extern void i_array_2_state_33(const svBitVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:157:33
extern void i_array_2_state_64(const svBitVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:158:33
extern void i_array_2_state_65(const svBitVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:178:33
extern void i_array_4_state_1(const svLogicVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:183:33
extern void i_array_4_state_128(const svLogicVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:179:33
extern void i_array_4_state_32(const svLogicVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:180:33
extern void i_array_4_state_33(const svLogicVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:181:33
extern void i_array_4_state_64(const svLogicVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:182:33
extern void i_array_4_state_65(const svLogicVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:126:33
extern void i_bit(svBit i);
// DPI import at t/t_dpi_arg_input_type.v:150:33
extern void i_bit_t(svBit i);
// DPI import at t/t_dpi_arg_input_type.v:106:33
extern void i_byte(char i);
// DPI import at t/t_dpi_arg_input_type.v:130:33
extern void i_byte_t(char i);
// DPI import at t/t_dpi_arg_input_type.v:107:33
extern void i_byte_unsigned(unsigned char i);
// DPI import at t/t_dpi_arg_input_type.v:131:33
extern void i_byte_unsigned_t(unsigned char i);
// DPI import at t/t_dpi_arg_input_type.v:124:33
extern void i_chandle(void* i);
// DPI import at t/t_dpi_arg_input_type.v:148:33
extern void i_chandle_t(void* i);
// DPI import at t/t_dpi_arg_input_type.v:110:33
extern void i_int(int i);
// DPI import at t/t_dpi_arg_input_type.v:134:33
extern void i_int_t(int i);
// DPI import at t/t_dpi_arg_input_type.v:111:33
extern void i_int_unsigned(unsigned int i);
// DPI import at t/t_dpi_arg_input_type.v:135:33
extern void i_int_unsigned_t(unsigned int i);
// DPI import at t/t_dpi_arg_input_type.v:118:33
extern void i_integer(const svLogicVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:142:33
extern void i_integer_t(const svLogicVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:127:33
extern void i_logic(svLogic i);
// DPI import at t/t_dpi_arg_input_type.v:151:33
extern void i_logic_t(svLogic i);
// DPI import at t/t_dpi_arg_input_type.v:112:33
extern void i_longint(long long i);
// DPI import at t/t_dpi_arg_input_type.v:136:33
extern void i_longint_t(long long i);
// DPI import at t/t_dpi_arg_input_type.v:113:33
extern void i_longint_unsigned(unsigned long long i);
// DPI import at t/t_dpi_arg_input_type.v:137:33
extern void i_longint_unsigned_t(unsigned long long i);
// DPI import at t/t_dpi_arg_input_type.v:120:33
extern void i_real(double i);
// DPI import at t/t_dpi_arg_input_type.v:144:33
extern void i_real_t(double i);
// DPI import at t/t_dpi_arg_input_type.v:108:33
extern void i_shortint(short i);
// DPI import at t/t_dpi_arg_input_type.v:132:33
extern void i_shortint_t(short i);
// DPI import at t/t_dpi_arg_input_type.v:109:33
extern void i_shortint_unsigned(unsigned short i);
// DPI import at t/t_dpi_arg_input_type.v:133:33
extern void i_shortint_unsigned_t(unsigned short i);
// DPI import at t/t_dpi_arg_input_type.v:125:33
extern void i_string(const char* i);
// DPI import at t/t_dpi_arg_input_type.v:149:33
extern void i_string_t(const char* i);
// DPI import at t/t_dpi_arg_input_type.v:162:33
extern void i_struct_2_state_1(const svBitVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:167:33
extern void i_struct_2_state_128(const svBitVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:163:33
extern void i_struct_2_state_32(const svBitVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:164:33
extern void i_struct_2_state_33(const svBitVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:165:33
extern void i_struct_2_state_64(const svBitVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:166:33
extern void i_struct_2_state_65(const svBitVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:186:33
extern void i_struct_4_state_1(const svLogicVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:191:33
extern void i_struct_4_state_128(const svLogicVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:187:33
extern void i_struct_4_state_32(const svLogicVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:188:33
extern void i_struct_4_state_33(const svLogicVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:189:33
extern void i_struct_4_state_64(const svLogicVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:190:33
extern void i_struct_4_state_65(const svLogicVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:115:33
extern void i_time(const svLogicVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:139:33
extern void i_time_t(const svLogicVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:170:33
extern void i_union_2_state_1(const svBitVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:175:33
extern void i_union_2_state_128(const svBitVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:171:33
extern void i_union_2_state_32(const svBitVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:172:33
extern void i_union_2_state_33(const svBitVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:173:33
extern void i_union_2_state_64(const svBitVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:174:33
extern void i_union_2_state_65(const svBitVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:194:33
extern void i_union_4_state_1(const svLogicVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:199:33
extern void i_union_4_state_128(const svLogicVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:195:33
extern void i_union_4_state_32(const svLogicVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:196:33
extern void i_union_4_state_33(const svLogicVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:197:33
extern void i_union_4_state_64(const svLogicVecVal* i);
// DPI import at t/t_dpi_arg_input_type.v:198:33
extern void i_union_4_state_65(const svLogicVecVal* i);
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,966 @@
// -*- mode: C++; c-file-style: "cc-mode" -*-
//*************************************************************************
//
// Copyright 2020 by Geza Lore. This program is free software; you can
// redistribute it and/or modify it under the terms of either the GNU
// Lesser General Public License Version 3 or the Perl Artistic License
// Version 2.0.
// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
//
//*************************************************************************
#include <cstdio>
#include <cstdlib>
#include <cstring>
#if defined(NCSC)
// Used by NC's svdpi.h to pick up svLogicVecVal with _.aval and _.bval fields,
// rather than the IEEE 1800-2005 version which has _.a and _.b fields.
# define DPI_COMPATIBILITY_VERSION_1800v2012
#endif
#include "svdpi.h"
#if defined(VERILATOR) // Verilator
# include "Vt_dpi_arg_output_type__Dpi.h"
typedef long long sv_longint_t;
typedef unsigned long long sv_longint_unsigned_t;
# define NO_SHORTREAL
#elif defined(VCS) // VCS
# include "../vc_hdrs.h"
typedef long long sv_longint_t;
typedef unsigned long long sv_longint_unsigned_t;
# define NO_TIME
#elif defined(NCSC) // NC
# include "dpi-exp.h"
# include "dpi-imp.h"
typedef long long sv_longint_t;
typedef unsigned long long sv_longint_unsigned_t;
# define NO_TIME
# define NO_INTEGER
# define NO_SHORTREAL
#elif defined(MS) // ModelSim
# include "dpi.h"
typedef int64_t sv_longint_t;
typedef uint64_t sv_longint_unsigned_t;
# else
# error "Unknown simulator for DPI test"
#endif
//======================================================================
// Implementations of imported functions
//======================================================================
void set_bvals(svLogicVecVal* v, unsigned n);
void set_bvals(svLogicVecVal* v, unsigned n) {
for (unsigned i = 0; i < n; i++) {
v[i].bval = 0;
}
}
// Basic types as per IEEE 1800-2017 35.5.6
void i_byte(char* o) {
static int n = 0;
*o = 10 - n++;
}
void i_byte_unsigned(unsigned char* o) {
static int n = 0;
*o = 20 - n++;
}
void i_shortint(short* o) {
static int n = 0;
*o = 30 - n++;
}
void i_shortint_unsigned(unsigned short* o) {
static int n = 0;
*o = 40 - n++;
}
void i_int(int* o) {
static int n = 0;
*o = 50 - n++;
}
void i_int_unsigned(unsigned* o) {
static int n = 0;
*o = 60 - n++;
}
void i_longint(sv_longint_t* o) {
static int n = 0;
*o = 70 - n++;
}
void i_longint_unsigned(sv_longint_unsigned_t* o) {
static int n = 0;
*o = 80 - n++;
}
#ifndef NO_TIME
void i_time(svLogicVecVal* o) {
static int n = 0;
o[0].aval = 90 - n++;
o[1].aval = 0;
set_bvals(o, 2);
}
#endif
#ifndef NO_INTEGER
void i_integer(svLogicVecVal* o) {
static int n = 0;
o->aval = 100 - n++;
set_bvals(o, 1);
}
#endif
void i_real(double* o) {
static int n = 0;
*o = (-2.0 * n++ - 1.0) / 2.0;
}
#ifndef NO_SHORTREAL
void i_shortreal(float* o) {
static int n = 0;
*o = (-4.0f * n++ - 1.0f) / 4.0f;
}
#endif
void i_chandle(void** o) {
static int n = 0;
printf("i_chandle %d\n", n);
*o = n++ % 2 ? reinterpret_cast<void*>(&i_chandle) : NULL;
}
void i_string(const char** o) {
static int n = 0;
printf("i_string %d\n", n);
*o = n++ % 2 ? "Hello" : "World";
}
void i_bit(svBit* o) {
static int n = 0;
printf("i_bit %d\n", n);
*o = !(n++ % 2);
}
void i_logic(svLogic* o) {
static int n = 0;
printf("i_logic %d\n", n);
*o = n++ % 2;
}
// Basic types via typedefs
void i_byte_t(char* o) {
static int n = 0;
const char r = 10 - n;
n += 2;
*o = r;
}
void i_byte_unsigned_t(unsigned char* o) {
static int n = 0;
const unsigned char r = 20 - n;
n += 2;
*o = r;
}
void i_shortint_t(short* o) {
static int n = 0;
const short r = 30 - n;
n += 2;
*o = r;
}
void i_shortint_unsigned_t(unsigned short* o) {
static int n = 0;
const unsigned short r = 40 - n;
n += 2;
*o = r;
}
void i_int_t(int* o) {
static int n = 0;
const int r = 50 - n;
n += 2;
*o = r;
}
void i_int_unsigned_t(unsigned* o) {
static int n = 0;
const unsigned r = 60 - n;
n += 2;
*o = r;
}
void i_longint_t(sv_longint_t* o) {
static int n = 0;
const long long r = 70 - n;
n += 2;
*o = r;
}
void i_longint_unsigned_t(sv_longint_unsigned_t* o) {
static int n = 0;
const unsigned long long r = 80 - n;
n += 2;
*o = r;
}
#ifndef NO_TIME
void i_time_t(svLogicVecVal* o) {
static int n = 0;
o[0].aval = 90 - n;
o[1].aval = 0;
set_bvals(o, 2);
n += 2;
}
#endif
#ifndef NO_INTEGER
void i_integer_t(svLogicVecVal* o) {
static int n = 0;
o->aval = 100 - n;
set_bvals(o, 1);
n += 2;
}
#endif
void i_real_t(double* o) {
static int n = 0;
const double r = (-2.0 * n - 1.0) / 2.0;
n += 2;
*o = r;
}
#ifndef NO_SHORTREAL
void i_shortreal_t(float* o) {
static int n = 0;
const float r = (-4.0f * n - 1.0f) / 4.0f;
n += 2;
*o = r;
}
#endif
void i_chandle_t(void** o) {
static int n = 0;
printf("i_chandle_t %d\n", n);
*o = n++ % 2 ? reinterpret_cast<void*>(&i_chandle) : NULL;
}
void i_string_t(const char** o) {
static int n = 0;
printf("i_string_t %d\n", n);
*o = n++ % 2 ? "Hello" : "World";
}
void i_bit_t(svBit* o) {
static int n = 0;
printf("i_bit_t %d\n", n);
*o = !(n++ % 2);
}
void i_logic_t(svLogic* o) {
static int n = 0;
printf("i_logic_t %d\n", n);
*o = n++ % 2;
}
// 2-state packed arrays
void i_array_2_state_1(svBitVecVal* o) {
static int n = 0;
printf("i_array_2_state_1 %d\n", n);
*o = !(n++ % 2);
}
void i_array_2_state_32(svBitVecVal* o) {
static int n = 0;
printf("i_array_2_state_32 %d\n", n);
*o = 0xffffffffU << n++;
}
void i_array_2_state_33(svBitVecVal* o) {
static int n = 0;
printf("i_array_2_state_33 %d\n", n);
o[0] = 0xffffffffU << n++;
o[1] = 1;
}
void i_array_2_state_64(svBitVecVal* o) {
static int n = 0;
printf("i_array_2_state_64 %d\n", n);
o[0] = 0xffffffffU << n++;
o[1] = -1;
}
void i_array_2_state_65(svBitVecVal* o) {
static int n = 0;
printf("i_array_2_state_65 %d\n", n);
o[0] = 0xffffffffU << n++;
o[1] = -1;
o[2] = 1;
}
void i_array_2_state_128(svBitVecVal* o) {
static int n = 0;
printf("i_array_2_state_128 %d\n", n);
o[0] = 0xffffffffU << n++;
o[1] = -1;
o[2] = -1;
o[3] = -1;
}
// 2-state packed structures
void i_struct_2_state_1(svBitVecVal* o) {
static int n = 0;
printf("i_struct_2_state_1 %d\n", n);
*o = !(n++ % 2);
}
void i_struct_2_state_32(svBitVecVal* o) {
static int n = 0;
printf("i_struct_2_state_32 %d\n", n);
*o = 0xffffffffU << n++;
}
void i_struct_2_state_33(svBitVecVal* o) {
static int n = 0;
printf("i_struct_2_state_33 %d\n", n);
o[0] = 0xffffffffU << n++;
o[1] = 1;
}
void i_struct_2_state_64(svBitVecVal* o) {
static int n = 0;
printf("i_struct_2_state_64 %d\n", n);
o[0] = 0xffffffffU << n++;
o[1] = -1;
}
void i_struct_2_state_65(svBitVecVal* o) {
static int n = 0;
printf("i_struct_2_state_65 %d\n", n);
o[0] = 0xffffffffU << n++;
o[1] = -1;
o[2] = 1;
}
void i_struct_2_state_128(svBitVecVal* o) {
static int n = 0;
printf("i_struct_2_state_128 %d\n", n);
o[0] = 0xffffffffU << n++;
o[1] = -1;
o[2] = -1;
o[3] = -1;
}
// 2-state packed unions
void i_union_2_state_1(svBitVecVal* o) {
static int n = 0;
printf("i_union_2_state_1 %d\n", n);
*o = !(n++ % 2);
}
void i_union_2_state_32(svBitVecVal* o) {
static int n = 0;
printf("i_union_2_state_32 %d\n", n);
*o = 0xffffffffU << n++;
}
void i_union_2_state_33(svBitVecVal* o) {
static int n = 0;
printf("i_union_2_state_33 %d\n", n);
o[0] = 0xffffffffU << n++;
o[1] = 1;
}
void i_union_2_state_64(svBitVecVal* o) {
static int n = 0;
printf("i_union_2_state_64 %d\n", n);
o[0] = 0xffffffffU << n++;
o[1] = -1;
}
void i_union_2_state_65(svBitVecVal* o) {
static int n = 0;
printf("i_union_2_state_65 %d\n", n);
o[0] = 0xffffffffU << n++;
o[1] = -1;
o[2] = 1;
}
void i_union_2_state_128(svBitVecVal* o) {
static int n = 0;
printf("i_union_2_state_128 %d\n", n);
o[0] = 0xffffffffU << n++;
o[1] = -1;
o[2] = -1;
o[3] = -1;
}
// 4-state packed arrays
void i_array_4_state_1(svLogicVecVal* o) {
static int n = 0;
printf("i_array_4_state_1 %d\n", n);
o->aval = !(n++ % 2);
set_bvals(o, 1);
}
void i_array_4_state_32(svLogicVecVal* o) {
static int n = 0;
printf("i_array_4_state_32 %d\n", n);
o->aval = 0xffffffffU << n++;
set_bvals(o, 1);
}
void i_array_4_state_33(svLogicVecVal* o) {
static int n = 0;
printf("i_array_4_state_33 %d\n", n);
o[0].aval = 0xffffffffU << n++;
o[1].aval = 1;
set_bvals(o, 2);
}
void i_array_4_state_64(svLogicVecVal* o) {
static int n = 0;
printf("i_array_4_state_64 %d\n", n);
o[0].aval = 0xffffffffU << n++;
o[1].aval = -1;
set_bvals(o, 2);
}
void i_array_4_state_65(svLogicVecVal* o) {
static int n = 0;
printf("i_array_4_state_65 %d\n", n);
o[0].aval = 0xffffffffU << n++;
o[1].aval = -1;
o[2].aval = 1;
set_bvals(o, 3);
}
void i_array_4_state_128(svLogicVecVal* o) {
static int n = 0;
printf("i_array_4_state_128 %d\n", n);
o[0].aval = 0xffffffffU << n++;
o[1].aval = -1;
o[2].aval = -1;
o[3].aval = -1;
set_bvals(o, 4);
}
// 4-state packed structures
void i_struct_4_state_1(svLogicVecVal* o) {
static int n = 0;
printf("i_struct_4_state_1 %d\n", n);
o->aval = !(n++ % 2);
set_bvals(o, 1);
}
void i_struct_4_state_32(svLogicVecVal* o) {
static int n = 0;
printf("i_struct_4_state_32 %d\n", n);
o->aval = 0xffffffffU << n++;
set_bvals(o, 1);
}
void i_struct_4_state_33(svLogicVecVal* o) {
static int n = 0;
printf("i_struct_4_state_33 %d\n", n);
o[0].aval = 0xffffffffU << n++;
o[1].aval = 1;
set_bvals(o, 2);
}
void i_struct_4_state_64(svLogicVecVal* o) {
static int n = 0;
printf("i_struct_4_state_64 %d\n", n);
o[0].aval = 0xffffffffU << n++;
o[1].aval = -1;
set_bvals(o, 2);
}
void i_struct_4_state_65(svLogicVecVal* o) {
static int n = 0;
printf("i_struct_4_state_65 %d\n", n);
o[0].aval = 0xffffffffU << n++;
o[1].aval = -1;
o[2].aval = 1;
set_bvals(o, 3);
}
void i_struct_4_state_128(svLogicVecVal* o) {
static int n = 0;
printf("i_struct_4_state_128 %d\n", n);
o[0].aval = 0xffffffffU << n++;
o[1].aval = -1;
o[2].aval = -1;
o[3].aval = -1;
set_bvals(o, 4);
}
// 4-state packed unions
void i_union_4_state_1(svLogicVecVal* o) {
static int n = 0;
printf("i_union_4_state_1 %d\n", n);
o->aval = !(n++ % 2);
set_bvals(o, 1);
}
void i_union_4_state_32(svLogicVecVal* o) {
static int n = 0;
printf("i_union_4_state_32 %d\n", n);
o->aval = 0xffffffffU << n++;
set_bvals(o, 1);
}
void i_union_4_state_33(svLogicVecVal* o) {
static int n = 0;
printf("i_union_4_state_33 %d\n", n);
o[0].aval = 0xffffffffU << n++;
o[1].aval = 1;
set_bvals(o, 2);
}
void i_union_4_state_64(svLogicVecVal* o) {
static int n = 0;
printf("i_union_4_state_64 %d\n", n);
o[0].aval = 0xffffffffU << n++;
o[1].aval = -1;
set_bvals(o, 2);
}
void i_union_4_state_65(svLogicVecVal* o) {
static int n = 0;
printf("i_union_4_state_65 %d\n", n);
o[0].aval = 0xffffffffU << n++;
o[1].aval = -1;
o[2].aval = 1;
set_bvals(o, 3);
}
void i_union_4_state_128(svLogicVecVal* o) {
static int n = 0;
printf("i_union_4_state_128 %d\n", n);
o[0].aval = 0xffffffffU << n++;
o[1].aval = -1;
o[2].aval = -1;
o[3].aval = -1;
set_bvals(o, 4);
}
//======================================================================
// Check exported functions
//======================================================================
#define stop() \
do { \
printf(__FILE__ ":%d Bad value\n", __LINE__); \
abort(); \
} while (0)
void check_bvals(const svLogicVecVal* v, unsigned n);
void check_bvals(const svLogicVecVal* v, unsigned n) {
for (unsigned i = 0; i < n; i++) {
if (v[i].bval != 0) {
printf(__FILE__ ":%d Bad svLogicVecVal bval\n", __LINE__);
abort();
}
}
}
void check_exports() {
static unsigned n = 0;
char x_byte;
unsigned char x_byte_unsigned;
short x_shortint;
unsigned short x_shortint_unsigned;
int x_int;
unsigned x_int_unsigned;
sv_longint_t x_longint;
sv_longint_unsigned_t x_longint_unsigned;
#ifndef NO_TIME
svLogicVecVal x_time[2];
#endif
#ifndef NO_INTEGER
svLogicVecVal x_integer[1];
#endif
double x_real;
#ifndef NO_SHORTREAL
float x_shortreal;
#endif
void* x_chandle;
const char* x_string;
svBit x_bit;
svLogic x_logic;
char x_byte_t;
unsigned char x_byte_unsigned_t;
short x_shortint_t;
unsigned short x_shortint_unsigned_t;
int x_int_t;
unsigned x_int_unsigned_t;
sv_longint_t x_longint_t;
sv_longint_unsigned_t x_longint_unsigned_t;
#ifndef NO_TIME
svLogicVecVal x_time_t[2];
#endif
#ifndef NO_INTEGER
svLogicVecVal x_integer_t[1];
#endif
double x_real_t;
#ifndef NO_SHORTREAL
float x_shortreal_t;
#endif
void* x_chandle_t;
const char* x_string_t;
svBit x_bit_t;
svLogic x_logic_t;
svBitVecVal x_array_2_state_1[1];
svBitVecVal x_array_2_state_32[1];
svBitVecVal x_array_2_state_33[2];
svBitVecVal x_array_2_state_64[2];
svBitVecVal x_array_2_state_65[3];
svBitVecVal x_array_2_state_128[4];
svBitVecVal x_struct_2_state_1[1];
svBitVecVal x_struct_2_state_32[1];
svBitVecVal x_struct_2_state_33[2];
svBitVecVal x_struct_2_state_64[2];
svBitVecVal x_struct_2_state_65[3];
svBitVecVal x_struct_2_state_128[4];
svBitVecVal x_union_2_state_1[1];
svBitVecVal x_union_2_state_32[1];
svBitVecVal x_union_2_state_33[2];
svBitVecVal x_union_2_state_64[2];
svBitVecVal x_union_2_state_65[3];
svBitVecVal x_union_2_state_128[4];
svLogicVecVal x_array_4_state_1[1];
svLogicVecVal x_array_4_state_32[1];
svLogicVecVal x_array_4_state_33[2];
svLogicVecVal x_array_4_state_64[2];
svLogicVecVal x_array_4_state_65[3];
svLogicVecVal x_array_4_state_128[4];
svLogicVecVal x_struct_4_state_1[1];
svLogicVecVal x_struct_4_state_32[1];
svLogicVecVal x_struct_4_state_33[2];
svLogicVecVal x_struct_4_state_64[2];
svLogicVecVal x_struct_4_state_65[3];
svLogicVecVal x_struct_4_state_128[4];
svLogicVecVal x_union_4_state_1[1];
svLogicVecVal x_union_4_state_32[1];
svLogicVecVal x_union_4_state_33[2];
svLogicVecVal x_union_4_state_64[2];
svLogicVecVal x_union_4_state_65[3];
svLogicVecVal x_union_4_state_128[4];
// Basic types as per IEEE 1800-2017 35.5.6
e_byte(&x_byte);
if (x_byte != 10 + n) stop();
e_byte_unsigned(&x_byte_unsigned);
if (x_byte_unsigned != 20 + n) stop();
e_shortint(&x_shortint);
if (x_shortint != 30 + n) stop();
e_shortint_unsigned(&x_shortint_unsigned);
if (x_shortint_unsigned != 40 + n) stop();
e_int(&x_int);
if (x_int != 50 + n) stop();
e_int_unsigned(&x_int_unsigned);
if (x_int_unsigned != 60 + n) stop();
e_longint(&x_longint);
if (x_longint != 70 + n) stop();
e_longint_unsigned(&x_longint_unsigned);
if (x_longint_unsigned != 80 + n) stop();
#ifndef NO_TIME
e_time(x_time);
if (x_time[0].aval != 90 + n || x_time[1].aval != 0) stop();
check_bvals(x_time, 2);
#endif
#ifndef NO_INTEGER
e_integer(x_integer);
if (x_integer[0].aval != 100 + n) stop();
check_bvals(x_integer, 1);
#endif
e_real(&x_real);
if (x_real != 1.0 * n + 0.5) stop();
#ifndef NO_SHORTREAL
e_shortreal(&x_shortreal);
if (x_shortreal != 1.0f * n + 0.25f) stop();
#endif
e_chandle(&x_chandle);
if (x_chandle != NULL) stop();
e_string(&x_string);
if (n % 2 == 0) {
if (strcmp(x_string, "Hello") != 0) stop();
} else {
if (strcmp(x_string, "World") != 0) stop();
}
e_bit(&x_bit);
if (x_bit != n % 2) stop();
e_logic(&x_logic);
if (x_logic != !(n % 2)) stop();
// Basic types via tyepdef
e_byte_t(&x_byte_t);
if (x_byte_t != 10 + 2 * n) stop();
e_byte_unsigned_t(&x_byte_unsigned_t);
if (x_byte_unsigned_t != 20 + 2 * n) stop();
e_shortint_t(&x_shortint_t);
if (x_shortint_t != 30 + 2 * n) stop();
e_shortint_unsigned_t(&x_shortint_unsigned_t);
if (x_shortint_unsigned_t != 40 + 2 * n) stop();
e_int_t(&x_int_t);
if (x_int_t != 50 + 2 * n) stop();
e_int_unsigned_t(&x_int_unsigned_t);
if (x_int_unsigned_t != 60 + 2 * n) stop();
e_longint_t(&x_longint_t);
if (x_longint_t != 70 + 2 * n) stop();
e_longint_unsigned_t(&x_longint_unsigned_t);
if (x_longint_unsigned_t != 80 + 2 * n) stop();
#ifndef NO_TIME
e_time_t(x_time_t);
if (x_time_t[0].aval != 90 + 2 * n || x_time_t[1].aval != 0) stop();
check_bvals(x_time_t, 2);
#endif
#ifndef NO_INTEGER
e_integer_t(x_integer_t);
if (x_integer_t[0].aval != 100 + 2 * n) stop();
check_bvals(x_integer_t, 1);
#endif
e_real_t(&x_real_t);
if (x_real_t != 1.0 * (2 * n) + 0.5) stop();
#ifndef NO_SHORTREAL
e_shortreal_t(&x_shortreal_t);
if (x_shortreal_t != 1.0f * (2 * n) + 0.25f) stop();
#endif
e_chandle_t(&x_chandle_t);
if (x_chandle_t != NULL) stop();
e_string_t(&x_string_t);
if (n % 2 == 0) {
if (strcmp(x_string_t, "Hello") != 0) stop();
} else {
if (strcmp(x_string_t, "World") != 0) stop();
}
e_bit_t(&x_bit_t);
if (x_bit_t != n % 2) stop();
e_logic_t(&x_logic_t);
if (x_logic_t != !(n % 2)) stop();
const int m = n == 0 ? 0 : n - 1;
// 2-state packed arrays
e_array_2_state_1(x_array_2_state_1);
if (x_array_2_state_1[0] != n % 2) stop();
e_array_2_state_32(x_array_2_state_32);
if (x_array_2_state_32[0] != 0xffffffff >> n) stop();
e_array_2_state_33(x_array_2_state_33);
if (x_array_2_state_33[1] != 1 >> n) stop();
if (x_array_2_state_33[0] != 0xffffffff >> m) stop();
e_array_2_state_64(x_array_2_state_64);
if (x_array_2_state_64[1] != 0xffffffff >> n) stop();
if (x_array_2_state_64[0] != 0xffffffff) stop();
e_array_2_state_65(x_array_2_state_65);
if (x_array_2_state_65[2] != 1 >> n) stop();
if (x_array_2_state_65[1] != 0xffffffff >> m) stop();
if (x_array_2_state_65[0] != 0xffffffff) stop();
e_array_2_state_128(x_array_2_state_128);
if (x_array_2_state_128[3] != 0xffffffff >> n) stop();
if (x_array_2_state_128[2] != 0xffffffff) stop();
if (x_array_2_state_128[1] != 0xffffffff) stop();
if (x_array_2_state_64[0] != 0xffffffff) stop();
// 2-state packed structures
e_struct_2_state_1(x_struct_2_state_1);
if (x_struct_2_state_1[0] != n % 2) stop();
e_struct_2_state_32(x_struct_2_state_32);
if (x_struct_2_state_32[0] != 0xffffffff >> n) stop();
e_struct_2_state_33(x_struct_2_state_33);
if (x_struct_2_state_33[1] != 1 >> n) stop();
if (x_struct_2_state_33[0] != 0xffffffff >> m) stop();
e_struct_2_state_64(x_struct_2_state_64);
if (x_struct_2_state_64[1] != 0xffffffff >> n) stop();
if (x_struct_2_state_64[0] != 0xffffffff) stop();
e_struct_2_state_65(x_struct_2_state_65);
if (x_struct_2_state_65[2] != 1 >> n) stop();
if (x_struct_2_state_65[1] != 0xffffffff >> m) stop();
if (x_struct_2_state_65[0] != 0xffffffff) stop();
e_struct_2_state_128(x_struct_2_state_128);
if (x_struct_2_state_128[3] != 0xffffffff >> n) stop();
if (x_struct_2_state_128[2] != 0xffffffff) stop();
if (x_struct_2_state_128[1] != 0xffffffff) stop();
if (x_struct_2_state_64[0] != 0xffffffff) stop();
// 2-state packed unions
e_union_2_state_1(x_union_2_state_1);
if (x_union_2_state_1[0] != n % 2) stop();
e_union_2_state_32(x_union_2_state_32);
if (x_union_2_state_32[0] != 0xffffffff >> n) stop();
e_union_2_state_33(x_union_2_state_33);
if (x_union_2_state_33[1] != 1 >> n) stop();
if (x_union_2_state_33[0] != 0xffffffff >> m) stop();
e_union_2_state_64(x_union_2_state_64);
if (x_union_2_state_64[1] != 0xffffffff >> n) stop();
if (x_union_2_state_64[0] != 0xffffffff) stop();
e_union_2_state_65(x_union_2_state_65);
if (x_union_2_state_65[2] != 1 >> n) stop();
if (x_union_2_state_65[1] != 0xffffffff >> m) stop();
if (x_union_2_state_65[0] != 0xffffffff) stop();
e_union_2_state_128(x_union_2_state_128);
if (x_union_2_state_128[3] != 0xffffffff >> n) stop();
if (x_union_2_state_128[2] != 0xffffffff) stop();
if (x_union_2_state_128[1] != 0xffffffff) stop();
if (x_union_2_state_64[0] != 0xffffffff) stop();
// 4-state packed arrays
e_array_4_state_1(x_array_4_state_1);
if (x_array_4_state_1[0].aval != n % 2) stop();
e_array_4_state_32(x_array_4_state_32);
if (x_array_4_state_32[0].aval != 0xffffffff >> n) stop();
e_array_4_state_33(x_array_4_state_33);
if (x_array_4_state_33[1].aval != 1 >> n) stop();
if (x_array_4_state_33[0].aval != 0xffffffff >> m) stop();
e_array_4_state_64(x_array_4_state_64);
if (x_array_4_state_64[1].aval != 0xffffffff >> n) stop();
if (x_array_4_state_64[0].aval != 0xffffffff) stop();
e_array_4_state_65(x_array_4_state_65);
if (x_array_4_state_65[2].aval != 1 >> n) stop();
if (x_array_4_state_65[1].aval != 0xffffffff >> m) stop();
if (x_array_4_state_65[0].aval != 0xffffffff) stop();
e_array_4_state_128(x_array_4_state_128);
if (x_array_4_state_128[3].aval != 0xffffffff >> n) stop();
if (x_array_4_state_128[2].aval != 0xffffffff) stop();
if (x_array_4_state_128[1].aval != 0xffffffff) stop();
if (x_array_4_state_64[0].aval != 0xffffffff) stop();
check_bvals(x_array_4_state_1, 1);
check_bvals(x_array_4_state_32, 1);
check_bvals(x_array_4_state_33, 2);
check_bvals(x_array_4_state_64, 2);
check_bvals(x_array_4_state_65, 3);
check_bvals(x_array_4_state_128, 4);
// 4-state packed structures
e_struct_4_state_1(x_struct_4_state_1);
if (x_struct_4_state_1[0].aval != n % 2) stop();
e_struct_4_state_32(x_struct_4_state_32);
if (x_struct_4_state_32[0].aval != 0xffffffff >> n) stop();
e_struct_4_state_33(x_struct_4_state_33);
if (x_struct_4_state_33[1].aval != 1 >> n) stop();
if (x_struct_4_state_33[0].aval != 0xffffffff >> m) stop();
e_struct_4_state_64(x_struct_4_state_64);
if (x_struct_4_state_64[1].aval != 0xffffffff >> n) stop();
if (x_struct_4_state_64[0].aval != 0xffffffff) stop();
e_struct_4_state_65(x_struct_4_state_65);
if (x_struct_4_state_65[2].aval != 1 >> n) stop();
if (x_struct_4_state_65[1].aval != 0xffffffff >> m) stop();
if (x_struct_4_state_65[0].aval != 0xffffffff) stop();
e_struct_4_state_128(x_struct_4_state_128);
if (x_struct_4_state_128[3].aval != 0xffffffff >> n) stop();
if (x_struct_4_state_128[2].aval != 0xffffffff) stop();
if (x_struct_4_state_128[1].aval != 0xffffffff) stop();
if (x_struct_4_state_64[0].aval != 0xffffffff) stop();
check_bvals(x_struct_4_state_1, 1);
check_bvals(x_struct_4_state_32, 1);
check_bvals(x_struct_4_state_33, 2);
check_bvals(x_struct_4_state_64, 2);
check_bvals(x_struct_4_state_65, 3);
check_bvals(x_struct_4_state_128, 4);
// 4-state packed unions
e_union_4_state_1(x_union_4_state_1);
if (x_union_4_state_1[0].aval != n % 2) stop();
e_union_4_state_32(x_union_4_state_32);
if (x_union_4_state_32[0].aval != 0xffffffff >> n) stop();
e_union_4_state_33(x_union_4_state_33);
if (x_union_4_state_33[1].aval != 1 >> n) stop();
if (x_union_4_state_33[0].aval != 0xffffffff >> m) stop();
e_union_4_state_64(x_union_4_state_64);
if (x_union_4_state_64[1].aval != 0xffffffff >> n) stop();
if (x_union_4_state_64[0].aval != 0xffffffff) stop();
e_union_4_state_65(x_union_4_state_65);
if (x_union_4_state_65[2].aval != 1 >> n) stop();
if (x_union_4_state_65[1].aval != 0xffffffff >> m) stop();
if (x_union_4_state_65[0].aval != 0xffffffff) stop();
e_union_4_state_128(x_union_4_state_128);
if (x_union_4_state_128[3].aval != 0xffffffff >> n) stop();
if (x_union_4_state_128[2].aval != 0xffffffff) stop();
if (x_union_4_state_128[1].aval != 0xffffffff) stop();
if (x_union_4_state_64[0].aval != 0xffffffff) stop();
check_bvals(x_union_4_state_1, 1);
check_bvals(x_union_4_state_32, 1);
check_bvals(x_union_4_state_33, 2);
check_bvals(x_union_4_state_64, 2);
check_bvals(x_union_4_state_65, 3);
check_bvals(x_union_4_state_128, 4);
n++;
}

View File

@ -0,0 +1,265 @@
i_chandle 0
i_string 0
i_bit 0
i_logic 0
i_chandle_t 0
i_string_t 0
i_bit_t 0
i_logic_t 0
i_array_2_state_1 0
i_array_2_state_32 0
i_array_2_state_33 0
i_array_2_state_64 0
i_array_2_state_65 0
i_array_2_state_128 0
i_struct_2_state_1 0
i_struct_2_state_32 0
i_struct_2_state_33 0
i_struct_2_state_64 0
i_struct_2_state_65 0
i_struct_2_state_128 0
i_union_2_state_1 0
i_union_2_state_32 0
i_union_2_state_33 0
i_union_2_state_64 0
i_union_2_state_65 0
i_union_2_state_128 0
i_array_4_state_1 0
i_array_4_state_32 0
i_array_4_state_33 0
i_array_4_state_64 0
i_array_4_state_65 0
i_array_4_state_128 0
i_struct_4_state_1 0
i_struct_4_state_32 0
i_struct_4_state_33 0
i_struct_4_state_64 0
i_struct_4_state_65 0
i_struct_4_state_128 0
i_union_4_state_1 0
i_union_4_state_32 0
i_union_4_state_33 0
i_union_4_state_64 0
i_union_4_state_65 0
i_union_4_state_128 0
e_chandle 0
e_string 0
e_bit 0
e_logic 0
e_chandle_t 0
e_string_t 0
e_bit_t 0
e_logic_t 0
e_array_2_state_1 0
e_array_2_state_32 0
e_array_2_state_33 0
e_array_2_state_64 0
e_array_2_state_65 0
e_array_2_state_128 0
e_struct_2_state_1 0
e_struct_2_state_32 0
e_struct_2_state_33 0
e_struct_2_state_64 0
e_struct_2_state_65 0
e_struct_2_state_128 0
e_union_2_state_1 0
e_union_2_state_32 0
e_union_2_state_33 0
e_union_2_state_64 0
e_union_2_state_65 0
e_union_2_state_128 0
e_array_4_state_1 0
e_array_4_state_32 0
e_array_4_state_33 0
e_array_4_state_64 0
e_array_4_state_65 0
e_array_4_state_128 0
e_struct_4_state_1 0
e_struct_4_state_32 0
e_struct_4_state_33 0
e_struct_4_state_64 0
e_struct_4_state_65 0
e_struct_4_state_128 0
e_union_4_state_1 0
e_union_4_state_32 0
e_union_4_state_33 0
e_union_4_state_64 0
e_union_4_state_65 0
e_union_4_state_128 0
i_chandle 1
i_string 1
i_bit 1
i_logic 1
i_chandle_t 1
i_string_t 1
i_bit_t 1
i_logic_t 1
i_array_2_state_1 1
i_array_2_state_32 1
i_array_2_state_33 1
i_array_2_state_64 1
i_array_2_state_65 1
i_array_2_state_128 1
i_struct_2_state_1 1
i_struct_2_state_32 1
i_struct_2_state_33 1
i_struct_2_state_64 1
i_struct_2_state_65 1
i_struct_2_state_128 1
i_union_2_state_1 1
i_union_2_state_32 1
i_union_2_state_33 1
i_union_2_state_64 1
i_union_2_state_65 1
i_union_2_state_128 1
i_array_4_state_1 1
i_array_4_state_32 1
i_array_4_state_33 1
i_array_4_state_64 1
i_array_4_state_65 1
i_array_4_state_128 1
i_struct_4_state_1 1
i_struct_4_state_32 1
i_struct_4_state_33 1
i_struct_4_state_64 1
i_struct_4_state_65 1
i_struct_4_state_128 1
i_union_4_state_1 1
i_union_4_state_32 1
i_union_4_state_33 1
i_union_4_state_64 1
i_union_4_state_65 1
i_union_4_state_128 1
e_chandle 1
e_string 1
e_bit 1
e_logic 1
e_chandle_t 1
e_string_t 1
e_bit_t 1
e_logic_t 1
e_array_2_state_1 1
e_array_2_state_32 1
e_array_2_state_33 1
e_array_2_state_64 1
e_array_2_state_65 1
e_array_2_state_128 1
e_struct_2_state_1 1
e_struct_2_state_32 1
e_struct_2_state_33 1
e_struct_2_state_64 1
e_struct_2_state_65 1
e_struct_2_state_128 1
e_union_2_state_1 1
e_union_2_state_32 1
e_union_2_state_33 1
e_union_2_state_64 1
e_union_2_state_65 1
e_union_2_state_128 1
e_array_4_state_1 1
e_array_4_state_32 1
e_array_4_state_33 1
e_array_4_state_64 1
e_array_4_state_65 1
e_array_4_state_128 1
e_struct_4_state_1 1
e_struct_4_state_32 1
e_struct_4_state_33 1
e_struct_4_state_64 1
e_struct_4_state_65 1
e_struct_4_state_128 1
e_union_4_state_1 1
e_union_4_state_32 1
e_union_4_state_33 1
e_union_4_state_64 1
e_union_4_state_65 1
e_union_4_state_128 1
i_chandle 2
i_string 2
i_bit 2
i_logic 2
i_chandle_t 2
i_string_t 2
i_bit_t 2
i_logic_t 2
i_array_2_state_1 2
i_array_2_state_32 2
i_array_2_state_33 2
i_array_2_state_64 2
i_array_2_state_65 2
i_array_2_state_128 2
i_struct_2_state_1 2
i_struct_2_state_32 2
i_struct_2_state_33 2
i_struct_2_state_64 2
i_struct_2_state_65 2
i_struct_2_state_128 2
i_union_2_state_1 2
i_union_2_state_32 2
i_union_2_state_33 2
i_union_2_state_64 2
i_union_2_state_65 2
i_union_2_state_128 2
i_array_4_state_1 2
i_array_4_state_32 2
i_array_4_state_33 2
i_array_4_state_64 2
i_array_4_state_65 2
i_array_4_state_128 2
i_struct_4_state_1 2
i_struct_4_state_32 2
i_struct_4_state_33 2
i_struct_4_state_64 2
i_struct_4_state_65 2
i_struct_4_state_128 2
i_union_4_state_1 2
i_union_4_state_32 2
i_union_4_state_33 2
i_union_4_state_64 2
i_union_4_state_65 2
i_union_4_state_128 2
e_chandle 2
e_string 2
e_bit 2
e_logic 2
e_chandle_t 2
e_string_t 2
e_bit_t 2
e_logic_t 2
e_array_2_state_1 2
e_array_2_state_32 2
e_array_2_state_33 2
e_array_2_state_64 2
e_array_2_state_65 2
e_array_2_state_128 2
e_struct_2_state_1 2
e_struct_2_state_32 2
e_struct_2_state_33 2
e_struct_2_state_64 2
e_struct_2_state_65 2
e_struct_2_state_128 2
e_union_2_state_1 2
e_union_2_state_32 2
e_union_2_state_33 2
e_union_2_state_64 2
e_union_2_state_65 2
e_union_2_state_128 2
e_array_4_state_1 2
e_array_4_state_32 2
e_array_4_state_33 2
e_array_4_state_64 2
e_array_4_state_65 2
e_array_4_state_128 2
e_struct_4_state_1 2
e_struct_4_state_32 2
e_struct_4_state_33 2
e_struct_4_state_64 2
e_struct_4_state_65 2
e_struct_4_state_128 2
e_union_4_state_1 2
e_union_4_state_32 2
e_union_4_state_33 2
e_union_4_state_64 2
e_union_4_state_65 2
e_union_4_state_128 2
*-* All Finished *-*

View File

@ -0,0 +1,45 @@
#!/usr/bin/perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2020 by Geza Lore. This program is free software; you can
# redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
scenarios(simulator => 1);
if ($Self->{nc}) {
# For NC, compile twice, first just to generate DPI headers
compile(
nc_flags2 => ["+ncdpiheader+$Self->{obj_dir}/dpi-exp.h",
"+ncdpiimpheader+$Self->{obj_dir}/dpi-imp.h"]
);
}
compile(
v_flags2 => ["t/t_dpi_arg_output_type.cpp"],
verilator_flags2 => ["-Wall -Wno-DECLFILENAME"],
# NC: Gdd the obj_dir to the C include path
nc_flags2 => ["+ncscargs+-I$Self->{obj_dir}"],
# ModelSim: Generate DPI header, add obj_dir to the C include path
ms_flags2 => ["-dpiheader $Self->{obj_dir}/dpi.h",
"-ccflags -I$Self->{obj_dir}"],
);
if ($Self->{vlt_all}) {
files_identical(
"$Self->{obj_dir}/Vt_dpi_arg_output_type__Dpi.h",
"t/t_dpi_arg_output_type__Dpi.out"
);
}
execute(
check_finished => 1,
expect_filename => $Self->{golden_filename},
ms_pli => 0
);
ok(1);
1;

View File

@ -0,0 +1,989 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// Copyright 2020 by Geza Lore. This program is free software; you can
// redistribute it and/or modify it under the terms of either the GNU
// Lesser General Public License Version 3 or the Perl Artistic License
// Version 2.0.
// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
`ifdef VCS
`define NO_TIME
`endif
`ifdef NC
`define NO_TIME
`define NO_INTEGER
`define NO_SHORTREAL
`endif
`ifdef MS
`endif
`ifdef VERILATOR
`define NO_SHORTREAL
`define NULL 64'd0
`else
`define NULL null
`endif
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
`ifdef VERILATOR
wire _unused = &{1'b0, clk};
`endif
// Legal output argument types for DPI functions
//======================================================================
// Type definitions
//======================================================================
// Basic types as per IEEE 1800-2017 35.5.6
typedef byte byte_t;
typedef byte unsigned byte_unsigned_t;
typedef shortint shortint_t;
typedef shortint unsigned shortint_unsigned_t;
typedef int int_t;
typedef int unsigned int_unsigned_t;
typedef longint longint_t;
typedef longint unsigned longint_unsigned_t;
`ifndef NO_TIME
typedef time time_t;
`endif
`ifndef NO_INTEGER
typedef integer integer_t;
`endif
typedef real real_t;
`ifndef NO_SHORTREAL
typedef shortreal shortreal_t;
`endif
typedef chandle chandle_t;
typedef string string_t;
typedef bit bit_t;
typedef logic logic_t;
// 2-state packed structures
typedef struct packed { bit x; } struct_2_state_1;
typedef struct packed { bit [15:0] x; bit [15:0] y; } struct_2_state_32;
typedef struct packed { bit [15:0] x; bit [16:0] y; } struct_2_state_33;
typedef struct packed { bit [31:0] x; bit [31:0] y; } struct_2_state_64;
typedef struct packed { bit [31:0] x; bit [32:0] y; } struct_2_state_65;
typedef struct packed { bit [63:0] x; bit [63:0] y; } struct_2_state_128;
// 2-state packed unions
typedef union packed { bit x; bit y; } union_2_state_1;
typedef union packed { bit [31:0] x; bit [31:0] y; } union_2_state_32;
typedef union packed { bit [32:0] x; bit [32:0] y; } union_2_state_33;
typedef union packed { bit [63:0] x; bit [63:0] y; } union_2_state_64;
typedef union packed { bit [64:0] x; bit [64:0] y; } union_2_state_65;
typedef union packed { bit [127:0] x; bit [127:0] y; } union_2_state_128;
// 4-state packed structures
typedef struct packed { logic x; } struct_4_state_1;
typedef struct packed { logic [15:0] x; bit [15:0] y; } struct_4_state_32;
typedef struct packed { logic [15:0] x; bit [16:0] y; } struct_4_state_33;
typedef struct packed { logic [31:0] x; bit [31:0] y; } struct_4_state_64;
typedef struct packed { logic [31:0] x; bit [32:0] y; } struct_4_state_65;
typedef struct packed { logic [63:0] x; bit [63:0] y; } struct_4_state_128;
// 4-state packed unions
typedef union packed { logic x; bit y; } union_4_state_1;
typedef union packed { logic [31:0] x; bit [31:0] y; } union_4_state_32;
typedef union packed { logic [32:0] x; bit [32:0] y; } union_4_state_33;
typedef union packed { logic [63:0] x; bit [63:0] y; } union_4_state_64;
typedef union packed { logic [64:0] x; bit [64:0] y; } union_4_state_65;
typedef union packed { logic [127:0] x; bit [127:0] y; } union_4_state_128;
//======================================================================
// Imports
//======================================================================
// Basic types as per IEEE 1800-2017 35.5.6
import "DPI-C" function void i_byte (output byte o);
import "DPI-C" function void i_byte_unsigned (output byte unsigned o);
import "DPI-C" function void i_shortint (output shortint o);
import "DPI-C" function void i_shortint_unsigned (output shortint unsigned o);
import "DPI-C" function void i_int (output int o);
import "DPI-C" function void i_int_unsigned (output int unsigned o);
import "DPI-C" function void i_longint (output longint o);
import "DPI-C" function void i_longint_unsigned (output longint unsigned o);
`ifndef NO_TIME
import "DPI-C" function void i_time (output time o);
`endif
`ifndef NO_INTEGER
import "DPI-C" function void i_integer (output integer o);
`endif
import "DPI-C" function void i_real (output real o);
`ifndef NO_SHORTREAL
import "DPI-C" function void i_shortreal (output shortreal o);
`endif
import "DPI-C" function void i_chandle (output chandle o);
import "DPI-C" function void i_string (output string o);
import "DPI-C" function void i_bit (output bit o);
import "DPI-C" function void i_logic (output logic o);
// Basic types via typedef
import "DPI-C" function void i_byte_t (output byte_t o);
import "DPI-C" function void i_byte_unsigned_t (output byte_unsigned_t o);
import "DPI-C" function void i_shortint_t (output shortint_t o);
import "DPI-C" function void i_shortint_unsigned_t (output shortint_unsigned_t o);
import "DPI-C" function void i_int_t (output int_t o);
import "DPI-C" function void i_int_unsigned_t (output int_unsigned_t o);
import "DPI-C" function void i_longint_t (output longint_t o);
import "DPI-C" function void i_longint_unsigned_t (output longint_unsigned_t o);
`ifndef NO_TIME
import "DPI-C" function void i_time_t (output time_t o);
`endif
`ifndef NO_INTEGER
import "DPI-C" function void i_integer_t (output integer_t o);
`endif
import "DPI-C" function void i_real_t (output real_t o);
`ifndef NO_SHORTREAL
import "DPI-C" function void i_shortreal_t (output shortreal_t o);
`endif
import "DPI-C" function void i_chandle_t (output chandle_t o);
import "DPI-C" function void i_string_t (output string_t o);
import "DPI-C" function void i_bit_t (output bit_t o);
import "DPI-C" function void i_logic_t (output logic_t o);
// 2-state packed arrays
import "DPI-C" function void i_array_2_state_1 (output bit [ 0:0] o);
import "DPI-C" function void i_array_2_state_32 (output bit [ 31:0] o);
import "DPI-C" function void i_array_2_state_33 (output bit [ 32:0] o);
import "DPI-C" function void i_array_2_state_64 (output bit [ 63:0] o);
import "DPI-C" function void i_array_2_state_65 (output bit [ 64:0] o);
import "DPI-C" function void i_array_2_state_128(output bit [127:0] o);
// 2-state packed structures
import "DPI-C" function void i_struct_2_state_1 (output struct_2_state_1 o);
import "DPI-C" function void i_struct_2_state_32 (output struct_2_state_32 o);
import "DPI-C" function void i_struct_2_state_33 (output struct_2_state_33 o);
import "DPI-C" function void i_struct_2_state_64 (output struct_2_state_64 o);
import "DPI-C" function void i_struct_2_state_65 (output struct_2_state_65 o);
import "DPI-C" function void i_struct_2_state_128 (output struct_2_state_128 o);
// 2-state packed unions
import "DPI-C" function void i_union_2_state_1 (output union_2_state_1 o);
import "DPI-C" function void i_union_2_state_32 (output union_2_state_32 o);
import "DPI-C" function void i_union_2_state_33 (output union_2_state_33 o);
import "DPI-C" function void i_union_2_state_64 (output union_2_state_64 o);
import "DPI-C" function void i_union_2_state_65 (output union_2_state_65 o);
import "DPI-C" function void i_union_2_state_128 (output union_2_state_128 o);
// 4-state packed arrays
import "DPI-C" function void i_array_4_state_1 (output logic [ 0:0] o);
import "DPI-C" function void i_array_4_state_32 (output logic [ 31:0] o);
import "DPI-C" function void i_array_4_state_33 (output logic [ 32:0] o);
import "DPI-C" function void i_array_4_state_64 (output logic [ 63:0] o);
import "DPI-C" function void i_array_4_state_65 (output logic [ 64:0] o);
import "DPI-C" function void i_array_4_state_128(output logic [127:0] o);
// 4-state packed structures
import "DPI-C" function void i_struct_4_state_1 (output struct_4_state_1 o);
import "DPI-C" function void i_struct_4_state_32 (output struct_4_state_32 o);
import "DPI-C" function void i_struct_4_state_33 (output struct_4_state_33 o);
import "DPI-C" function void i_struct_4_state_64 (output struct_4_state_64 o);
import "DPI-C" function void i_struct_4_state_65 (output struct_4_state_65 o);
import "DPI-C" function void i_struct_4_state_128 (output struct_4_state_128 o);
// 4-state packed unions
import "DPI-C" function void i_union_4_state_1 (output union_4_state_1 o);
import "DPI-C" function void i_union_4_state_32 (output union_4_state_32 o);
import "DPI-C" function void i_union_4_state_33 (output union_4_state_33 o);
import "DPI-C" function void i_union_4_state_64 (output union_4_state_64 o);
import "DPI-C" function void i_union_4_state_65 (output union_4_state_65 o);
import "DPI-C" function void i_union_4_state_128 (output union_4_state_128 o);
//======================================================================
// Exports
//======================================================================
// Basic types as per IEEE 1800-2017 35.5.6
export "DPI-C" function e_byte;
export "DPI-C" function e_byte_unsigned;
export "DPI-C" function e_shortint;
export "DPI-C" function e_shortint_unsigned;
export "DPI-C" function e_int;
export "DPI-C" function e_int_unsigned;
export "DPI-C" function e_longint;
export "DPI-C" function e_longint_unsigned;
`ifndef NO_TIME
export "DPI-C" function e_time;
`endif
`ifndef NO_INTEGER
export "DPI-C" function e_integer;
`endif
export "DPI-C" function e_real;
`ifndef NO_SHORTREAL
export "DPI-C" function e_shortreal;
`endif
export "DPI-C" function e_chandle;
export "DPI-C" function e_string;
export "DPI-C" function e_bit;
export "DPI-C" function e_logic;
// Basic types via typedef
export "DPI-C" function e_byte_t;
export "DPI-C" function e_byte_unsigned_t;
export "DPI-C" function e_shortint_t;
export "DPI-C" function e_shortint_unsigned_t;
export "DPI-C" function e_int_t;
export "DPI-C" function e_int_unsigned_t;
export "DPI-C" function e_longint_t;
export "DPI-C" function e_longint_unsigned_t;
`ifndef NO_TIME
export "DPI-C" function e_time_t;
`endif
`ifndef NO_INTEGER
export "DPI-C" function e_integer_t;
`endif
export "DPI-C" function e_real_t;
`ifndef NO_SHORTREAL
export "DPI-C" function e_shortreal_t;
`endif
export "DPI-C" function e_chandle_t;
export "DPI-C" function e_string_t;
export "DPI-C" function e_bit_t;
export "DPI-C" function e_logic_t;
// 2-state packed arrays
export "DPI-C" function e_array_2_state_1;
export "DPI-C" function e_array_2_state_32;
export "DPI-C" function e_array_2_state_33;
export "DPI-C" function e_array_2_state_64;
export "DPI-C" function e_array_2_state_65;
export "DPI-C" function e_array_2_state_128;
// 2-state packed structures
export "DPI-C" function e_struct_2_state_1;
export "DPI-C" function e_struct_2_state_32;
export "DPI-C" function e_struct_2_state_33;
export "DPI-C" function e_struct_2_state_64;
export "DPI-C" function e_struct_2_state_65;
export "DPI-C" function e_struct_2_state_128;
// 2-state packed unions
export "DPI-C" function e_union_2_state_1;
export "DPI-C" function e_union_2_state_32;
export "DPI-C" function e_union_2_state_33;
export "DPI-C" function e_union_2_state_64;
export "DPI-C" function e_union_2_state_65;
export "DPI-C" function e_union_2_state_128;
// 4-state packed arrays
export "DPI-C" function e_array_4_state_1;
export "DPI-C" function e_array_4_state_32;
export "DPI-C" function e_array_4_state_33;
export "DPI-C" function e_array_4_state_64;
export "DPI-C" function e_array_4_state_65;
export "DPI-C" function e_array_4_state_128;
// 4-state packed structures
export "DPI-C" function e_struct_4_state_1;
export "DPI-C" function e_struct_4_state_32;
export "DPI-C" function e_struct_4_state_33;
export "DPI-C" function e_struct_4_state_64;
export "DPI-C" function e_struct_4_state_65;
export "DPI-C" function e_struct_4_state_128;
// 4-state packed unions
export "DPI-C" function e_union_4_state_1;
export "DPI-C" function e_union_4_state_32;
export "DPI-C" function e_union_4_state_33;
export "DPI-C" function e_union_4_state_64;
export "DPI-C" function e_union_4_state_65;
export "DPI-C" function e_union_4_state_128;
//======================================================================
// Definitions of exported functions
//======================================================================
// Basic types as per IEEE 1800-2017 35.5.6
byte n_byte = 0;
function void e_byte(output byte o);
o = 8'd10 + n_byte;
n_byte++;
endfunction
byte n_byte_unsigned = 0;
function void e_byte_unsigned(output byte unsigned o);
o = 8'd20 + n_byte_unsigned;
n_byte_unsigned++;
endfunction
shortint n_shortint = 0;
function void e_shortint(output shortint o);
o = 16'd30 + n_shortint;
n_shortint++;
endfunction
shortint n_shortint_unsigned = 0;
function void e_shortint_unsigned(output shortint unsigned o);
o = 16'd40 + n_shortint_unsigned;
n_shortint_unsigned++;
endfunction
int n_int = 0;
function void e_int(output int o);
o = 32'd50 + n_int;
n_int++;
endfunction
int n_int_unsigned = 0;
function void e_int_unsigned(output int unsigned o);
o = 32'd60 + n_int_unsigned;
n_int_unsigned++;
endfunction
longint n_longint = 0;
function void e_longint(output longint o);
o = 64'd70 + n_longint;
n_longint++;
endfunction
longint n_longint_unsigned = 0;
function void e_longint_unsigned(output longint unsigned o);
o = 64'd80 + n_longint_unsigned;
n_longint_unsigned++;
endfunction
`ifndef NO_TIME
longint n_time = 0;
function void e_time(output time o);
o = 64'd90 + n_time;
n_time++;
endfunction
`endif
`ifndef NO_INTEGER
int n_integer = 0;
function void e_integer(output integer o);
o = 32'd100 + n_integer;
n_integer++;
endfunction
`endif
int n_real = 0;
function void e_real(output real o);
o = real'(2*n_real + 1) / 2.0;
n_real++;
endfunction
`ifndef NO_SHORTREAL
int n_shortreal = 0;
function void e_shortreal(output shortreal o);
o = shortreal'(4*n_shortreal + 1) / 4.0;
n_shortreal++;
endfunction
`endif
int n_chandle = 0;
function void e_chandle(output chandle o);
$display("e_chandle %1d", n_chandle);
o = `NULL;
n_chandle++;
endfunction
int n_string = 0;
function void e_string(output string o);
$display("e_string %1d", n_string);
o = n_string[0] ? "World" : "Hello";
n_string++;
endfunction
int n_bit = 0;
function void e_bit(output bit o);
$display("e_bit %1d", n_bit);
o = n_bit[0];
n_bit++;
endfunction
int n_logic = 0;
function void e_logic(output logic o);
$display("e_logic %1d", n_logic);
o = ~n_logic[0];
n_logic++;
endfunction
// Basic types via typedefs
byte_t n_byte_t = 0;
function void e_byte_t(output byte_t o);
o = 8'd10 + n_byte_t;
n_byte_t += 2;
endfunction
byte n_byte_unsigned_t = 0;
function void e_byte_unsigned_t(output byte_unsigned_t o);
o = 8'd20 + n_byte_unsigned_t;
n_byte_unsigned_t += 2;
endfunction
shortint_t n_shortint_t = 0;
function void e_shortint_t(output shortint_t o);
o = 16'd30 + n_shortint_t;
n_shortint_t += 2;
endfunction
shortint n_shortint_unsigned_t = 0;
function void e_shortint_unsigned_t(output shortint_unsigned_t o);
o = 16'd40 + n_shortint_unsigned_t;
n_shortint_unsigned_t += 2;
endfunction
int_t n_int_t = 0;
function void e_int_t(output int_t o);
o = 32'd50 + n_int_t;
n_int_t += 2;
endfunction
int n_int_unsigned_t = 0;
function void e_int_unsigned_t(output int_unsigned_t o);
o = 32'd60 + n_int_unsigned_t;
n_int_unsigned_t += 2;
endfunction
longint_t n_longint_t = 0;
function void e_longint_t(output longint_t o);
o = 64'd70 + n_longint_t;
n_longint_t += 2;
endfunction
longint n_longint_unsigned_t = 0;
function void e_longint_unsigned_t(output longint_unsigned_t o);
o = 64'd80 + n_longint_unsigned_t;
n_longint_unsigned_t += 2;
endfunction
`ifndef NO_TIME
longint n_time_t = 0;
function void e_time_t(output time_t o);
o = 64'd90 + n_time_t;
n_time_t += 2;
endfunction
`endif
`ifndef NO_INTEGER
int n_integer_t = 0;
function void e_integer_t(output integer o);
o = 32'd100 + n_integer_t;
n_integer_t += 2;
endfunction
`endif
int n_real_t = 0;
function void e_real_t(output real_t o);
o = real'(2*n_real_t + 1) / 2.0;
n_real_t += 2;
endfunction
`ifndef NO_SHORTREAL
int n_shortreal_t = 0;
function void e_shortreal_t(output shortreal_t o);
o = shortreal'(4*n_shortreal_t + 1) / 4.0;
n_shortreal_t += 2;
endfunction
`endif
int n_chandle_t = 0;
function void e_chandle_t(output chandle_t o);
$display("e_chandle_t %1d", n_chandle_t);
o = `NULL;
n_chandle_t++;
endfunction
int n_string_t = 0;
function void e_string_t(output string_t o);
$display("e_string_t %1d", n_string_t);
o = n_string_t[0] ? "World" : "Hello";
n_string_t++;
endfunction
int n_bit_t = 0;
function void e_bit_t(output bit_t o);
$display("e_bit_t %1d", n_bit_t);
o = n_bit_t[0];
n_bit_t++;
endfunction
int n_logic_t = 0;
function void e_logic_t(output logic_t o);
$display("e_logic_t %1d", n_logic_t);
o = ~n_logic_t[0];
n_logic_t++;
endfunction
// 2-state packed arrays
int n_array_2_state_1 = 0;
function void e_array_2_state_1(output bit [ 0:0] o);
$display("e_array_2_state_1 %1d", n_array_2_state_1);
o = n_array_2_state_1[0];
n_array_2_state_1++;
endfunction
int n_array_2_state_32 = 0;
function void e_array_2_state_32(output bit [31:0] o);
$display("e_array_2_state_32 %1d", n_array_2_state_32);
o = ~32'd0 >> n_array_2_state_32;
n_array_2_state_32++;
endfunction
int n_array_2_state_33 = 0;
function void e_array_2_state_33(output bit [32:0] o);
$display("e_array_2_state_33 %1d", n_array_2_state_33);
o = ~33'd0 >> n_array_2_state_33;
n_array_2_state_33++;
endfunction
int n_array_2_state_64 = 0;
function void e_array_2_state_64(output bit [63:0] o);
$display("e_array_2_state_64 %1d", n_array_2_state_64);
o = ~64'd0 >> n_array_2_state_64;
n_array_2_state_64++;
endfunction
int n_array_2_state_65 = 0;
function void e_array_2_state_65(output bit [64:0] o);
$display("e_array_2_state_65 %1d", n_array_2_state_65);
o = ~65'd0 >> n_array_2_state_65;
n_array_2_state_65++;
endfunction
int n_array_2_state_128 = 0;
function void e_array_2_state_128(output bit [127:0] o);
$display("e_array_2_state_128 %1d", n_array_2_state_128);
o = ~128'd0 >> n_array_2_state_128;
n_array_2_state_128++;
endfunction
// 2-state packed structures
int n_struct_2_state_1 = 0;
function void e_struct_2_state_1(output struct_2_state_1 o);
$display("e_struct_2_state_1 %1d", n_struct_2_state_1);
o = n_struct_2_state_1[0];
n_struct_2_state_1++;
endfunction
int n_struct_2_state_32 = 0;
function void e_struct_2_state_32(output struct_2_state_32 o);
$display("e_struct_2_state_32 %1d", n_struct_2_state_32);
o = ~32'd0 >> n_struct_2_state_32;
n_struct_2_state_32++;
endfunction
int n_struct_2_state_33 = 0;
function void e_struct_2_state_33(output struct_2_state_33 o);
$display("e_struct_2_state_33 %1d", n_struct_2_state_33);
o = ~33'd0 >> n_struct_2_state_33;
n_struct_2_state_33++;
endfunction
int n_struct_2_state_64 = 0;
function void e_struct_2_state_64(output struct_2_state_64 o);
$display("e_struct_2_state_64 %1d", n_struct_2_state_64);
o = ~64'd0 >> n_struct_2_state_64;
n_struct_2_state_64++;
endfunction
int n_struct_2_state_65 = 0;
function void e_struct_2_state_65(output struct_2_state_65 o);
$display("e_struct_2_state_65 %1d", n_struct_2_state_65);
o = ~65'd0 >> n_struct_2_state_65;
n_struct_2_state_65++;
endfunction
int n_struct_2_state_128 = 0;
function void e_struct_2_state_128(output struct_2_state_128 o);
$display("e_struct_2_state_128 %1d", n_struct_2_state_128);
o = ~128'd0 >> n_struct_2_state_128;
n_struct_2_state_128++;
endfunction
// 2-state packed unions
int n_union_2_state_1 = 0;
function void e_union_2_state_1(output union_2_state_1 o);
$display("e_union_2_state_1 %1d", n_union_2_state_1);
o = n_union_2_state_1[0];
n_union_2_state_1++;
endfunction
int n_union_2_state_32 = 0;
function void e_union_2_state_32(output union_2_state_32 o);
$display("e_union_2_state_32 %1d", n_union_2_state_32);
o = ~32'd0 >> n_union_2_state_32;
n_union_2_state_32++;
endfunction
int n_union_2_state_33 = 0;
function void e_union_2_state_33(output union_2_state_33 o);
$display("e_union_2_state_33 %1d", n_union_2_state_33);
o = ~33'd0 >> n_union_2_state_33;
n_union_2_state_33++;
endfunction
int n_union_2_state_64 = 0;
function void e_union_2_state_64(output union_2_state_64 o);
$display("e_union_2_state_64 %1d", n_union_2_state_64);
o = ~64'd0 >> n_union_2_state_64;
n_union_2_state_64++;
endfunction
int n_union_2_state_65 = 0;
function void e_union_2_state_65(output union_2_state_65 o);
$display("e_union_2_state_65 %1d", n_union_2_state_65);
o = ~65'd0 >> n_union_2_state_65;
n_union_2_state_65++;
endfunction
int n_union_2_state_128 = 0;
function void e_union_2_state_128(output union_2_state_128 o);
$display("e_union_2_state_128 %1d", n_union_2_state_128);
o = ~128'd0 >> n_union_2_state_128;
n_union_2_state_128++;
endfunction
// 4-state packed arrays
int n_array_4_state_1 = 0;
function void e_array_4_state_1(output logic [ 0:0] o);
$display("e_array_4_state_1 %1d", n_array_4_state_1);
o = n_array_4_state_1[0];
n_array_4_state_1++;
endfunction
int n_array_4_state_32 = 0;
function void e_array_4_state_32(output logic [31:0] o);
$display("e_array_4_state_32 %1d", n_array_4_state_32);
o = ~32'd0 >> n_array_4_state_32;
n_array_4_state_32++;
endfunction
int n_array_4_state_33 = 0;
function void e_array_4_state_33(output logic [32:0] o);
$display("e_array_4_state_33 %1d", n_array_4_state_33);
o = ~33'd0 >> n_array_4_state_33;
n_array_4_state_33++;
endfunction
int n_array_4_state_64 = 0;
function void e_array_4_state_64(output logic [63:0] o);
$display("e_array_4_state_64 %1d", n_array_4_state_64);
o = ~64'd0 >> n_array_4_state_64;
n_array_4_state_64++;
endfunction
int n_array_4_state_65 = 0;
function void e_array_4_state_65(output logic [64:0] o);
$display("e_array_4_state_65 %1d", n_array_4_state_65);
o = ~65'd0 >> n_array_4_state_65;
n_array_4_state_65++;
endfunction
int n_array_4_state_128 = 0;
function void e_array_4_state_128(output logic [127:0] o);
$display("e_array_4_state_128 %1d", n_array_4_state_128);
o = ~128'd0 >> n_array_4_state_128;
n_array_4_state_128++;
endfunction
// 4-state packed structures
int n_struct_4_state_1 = 0;
function void e_struct_4_state_1(output struct_4_state_1 o);
$display("e_struct_4_state_1 %1d", n_struct_4_state_1);
o = n_struct_4_state_1[0];
n_struct_4_state_1++;
endfunction
int n_struct_4_state_32 = 0;
function void e_struct_4_state_32(output struct_4_state_32 o);
$display("e_struct_4_state_32 %1d", n_struct_4_state_32);
o = ~32'd0 >> n_struct_4_state_32;
n_struct_4_state_32++;
endfunction
int n_struct_4_state_33 = 0;
function void e_struct_4_state_33(output struct_4_state_33 o);
$display("e_struct_4_state_33 %1d", n_struct_4_state_33);
o = ~33'd0 >> n_struct_4_state_33;
n_struct_4_state_33++;
endfunction
int n_struct_4_state_64 = 0;
function void e_struct_4_state_64(output struct_4_state_64 o);
$display("e_struct_4_state_64 %1d", n_struct_4_state_64);
o = ~64'd0 >> n_struct_4_state_64;
n_struct_4_state_64++;
endfunction
int n_struct_4_state_65 = 0;
function void e_struct_4_state_65(output struct_4_state_65 o);
$display("e_struct_4_state_65 %1d", n_struct_4_state_65);
o = ~65'd0 >> n_struct_4_state_65;
n_struct_4_state_65++;
endfunction
int n_struct_4_state_128 = 0;
function void e_struct_4_state_128(output struct_4_state_128 o);
$display("e_struct_4_state_128 %1d", n_struct_4_state_128);
o = ~128'd0 >> n_struct_4_state_128;
n_struct_4_state_128++;
endfunction
// 4-state packed unions
int n_union_4_state_1 = 0;
function void e_union_4_state_1(output union_4_state_1 o);
$display("e_union_4_state_1 %1d", n_union_4_state_1);
o = n_union_4_state_1[0];
n_union_4_state_1++;
endfunction
int n_union_4_state_32 = 0;
function void e_union_4_state_32(output union_4_state_32 o);
$display("e_union_4_state_32 %1d", n_union_4_state_32);
o = ~32'd0 >> n_union_4_state_32;
n_union_4_state_32++;
endfunction
int n_union_4_state_33 = 0;
function void e_union_4_state_33(output union_4_state_33 o);
$display("e_union_4_state_33 %1d", n_union_4_state_33);
o = ~33'd0 >> n_union_4_state_33;
n_union_4_state_33++;
endfunction
int n_union_4_state_64 = 0;
function void e_union_4_state_64(output union_4_state_64 o);
$display("e_union_4_state_64 %1d", n_union_4_state_64);
o = ~64'd0 >> n_union_4_state_64;
n_union_4_state_64++;
endfunction
int n_union_4_state_65 = 0;
function void e_union_4_state_65(output union_4_state_65 o);
$display("e_union_4_state_65 %1d", n_union_4_state_65);
o = ~65'd0 >> n_union_4_state_65;
n_union_4_state_65++;
endfunction
int n_union_4_state_128 = 0;
function void e_union_4_state_128(output union_4_state_128 o);
$display("e_union_4_state_128 %1d", n_union_4_state_128);
o = ~128'd0 >> n_union_4_state_128;
n_union_4_state_128++;
endfunction
//======================================================================
// Invoke all functions 3 times (they have side effects)
//======================================================================
import "DPI-C" context function void check_exports();
initial begin
for (int i = 0 ; i < 3; i++) begin
// Check the imports
byte x_byte;
byte unsigned x_byte_unsigned;
shortint x_shortint;
shortint unsigned x_shortint_unsigned;
int x_int;
int unsigned x_int_unsigned;
longint x_longint;
longint unsigned x_longint_unsigned;
`ifndef NO_TIME
time x_time;
`endif
`ifndef NO_INTEGER
integer x_integer;
`endif
real x_real;
`ifndef NO_SHORTREAL
shortreal x_shortreal;
`endif
chandle x_chandle;
string x_string;
bit x_bit;
logic x_logic;
byte_t x_byte_t;
byte_unsigned_t x_byte_unsigned_t;
shortint_t x_shortint_t;
shortint_unsigned_t x_shortint_unsigned_t;
int_t x_int_t;
int_unsigned_t x_int_unsigned_t;
longint_t x_longint_t;
longint_unsigned_t x_longint_unsigned_t;
`ifndef NO_TIME
time_t x_time_t;
`endif
`ifndef NO_INTEGER
integer_t x_integer_t;
`endif
real_t x_real_t;
`ifndef NO_SHORTREAL
shortreal_t x_shortreal_t;
`endif
chandle_t x_chandle_t;
string_t x_string_t;
bit_t x_bit_t;
logic_t x_logic_t;
bit [ 0:0] x_bit_1;
bit [ 31:0] x_bit_32;
bit [ 32:0] x_bit_33;
bit [ 63:0] x_bit_64;
bit [ 64:0] x_bit_65;
bit [127:0] x_bit_128;
struct_2_state_1 x_struct_2_state_1;
struct_2_state_32 x_struct_2_state_32;
struct_2_state_33 x_struct_2_state_33;
struct_2_state_64 x_struct_2_state_64;
struct_2_state_65 x_struct_2_state_65;
struct_2_state_128 x_struct_2_state_128;
union_2_state_1 x_union_2_state_1;
union_2_state_32 x_union_2_state_32;
union_2_state_33 x_union_2_state_33;
union_2_state_64 x_union_2_state_64;
union_2_state_65 x_union_2_state_65;
union_2_state_128 x_union_2_state_128;
logic [ 0:0] x_logic_1;
logic [ 31:0] x_logic_32;
logic [ 32:0] x_logic_33;
logic [ 63:0] x_logic_64;
logic [ 64:0] x_logic_65;
logic [127:0] x_logic_128;
struct_4_state_1 x_struct_4_state_1;
struct_4_state_32 x_struct_4_state_32;
struct_4_state_33 x_struct_4_state_33;
struct_4_state_64 x_struct_4_state_64;
struct_4_state_65 x_struct_4_state_65;
struct_4_state_128 x_struct_4_state_128;
union_4_state_1 x_union_4_state_1;
union_4_state_32 x_union_4_state_32;
union_4_state_33 x_union_4_state_33;
union_4_state_64 x_union_4_state_64;
union_4_state_65 x_union_4_state_65;
union_4_state_128 x_union_4_state_128;
// Basic types as per IEEE 1800-2017 35.5.6
i_byte(x_byte); if (x_byte !== 8'd10 - 8'(i)) $stop;
i_byte_unsigned(x_byte_unsigned); if (x_byte_unsigned !== 8'd20 - 8'(i)) $stop;
i_shortint(x_shortint); if (x_shortint !== 16'd30 - 16'(i)) $stop;
i_shortint_unsigned(x_shortint_unsigned); if (x_shortint_unsigned !== 16'd40 - 16'(i)) $stop;
i_int(x_int); if (x_int !== 32'd50 - 32'(i)) $stop;
i_int_unsigned(x_int_unsigned); if (x_int_unsigned !== 32'd60 - 32'(i)) $stop;
i_longint(x_longint); if (x_longint !== 64'd70 - 64'(i)) $stop;
i_longint_unsigned(x_longint_unsigned); if (x_longint_unsigned !== 64'd80 - 64'(i)) $stop;
`ifndef NO_TIME
i_time(x_time); if (x_time !== 64'd90 - 64'(i)) $stop;
`endif
`ifndef NO_INTEGER
i_integer(x_integer); if (x_integer !== 32'd100- 32'(i)) $stop;
`endif
i_real(x_real); if (x_real != -1.0*i - 0.5 ) $stop;
`ifndef NO_SHORTREAL
i_shortreal(x_shortreal); if (x_shortreal != -1.0*i - 0.25) $stop;
`endif
if (~i[0]) begin
i_chandle(x_chandle); if (x_chandle !== `NULL) $stop;
i_string(x_string); if (x_string != "World") $stop;
end else begin
i_chandle(x_chandle); if (x_chandle === `NULL) $stop;
i_string(x_string); if (x_string != "Hello") $stop;
end
i_bit(x_bit); if (x_bit !== ~i[0]) $stop;
i_logic(x_logic); if (x_logic !== i[0]) $stop;
// Basic types via typedefs
i_byte_t(x_byte_t); if (x_byte_t !== 8'd10 - 8'(2*i)) $stop;
i_byte_unsigned_t(x_byte_unsigned_t); if (x_byte_unsigned_t !== 8'd20 - 8'(2*i)) $stop;
i_shortint_t(x_shortint_t); if (x_shortint_t !== 16'd30 - 16'(2*i)) $stop;
i_shortint_unsigned_t(x_shortint_unsigned_t); if (x_shortint_unsigned_t !== 16'd40 - 16'(2*i)) $stop;
i_int_t(x_int_t); if (x_int_t !== 32'd50 - 32'(2*i)) $stop;
i_int_unsigned_t(x_int_unsigned_t); if (x_int_unsigned_t !== 32'd60 - 32'(2*i)) $stop;
i_longint_t(x_longint_t); if (x_longint_t !== 64'd70 - 64'(2*i)) $stop;
i_longint_unsigned_t(x_longint_unsigned_t); if (x_longint_unsigned_t !== 64'd80 - 64'(2*i)) $stop;
`ifndef NO_TIME
i_time_t(x_time_t); if (x_time_t !== 64'd90 - 64'(2*i)) $stop;
`endif
`ifndef NO_INTEGER
i_integer_t(x_integer_t); if (x_integer_t !== 32'd100- 32'(2*i)) $stop;
`endif
i_real_t(x_real_t); if (x_real_t != -1.0*(2*i) - 0.5 ) $stop;
`ifndef NO_SHORTREAL
i_shortreal_t(x_shortreal_t); if (x_shortreal_t != -1.0*(2*i) - 0.25) $stop;
`endif
if (~i[0]) begin
i_chandle_t(x_chandle_t); if (x_chandle_t !== `NULL) $stop;
i_string_t(x_string_t); if (x_string_t != "World") $stop;
end else begin
i_chandle_t(x_chandle_t); if (x_chandle_t === `NULL) $stop;
i_string_t(x_string_t); if (x_string_t != "Hello") $stop;
end
i_bit_t(x_bit_t); if (x_bit_t !== ~i[0]) $stop;
i_logic_t(x_logic_t); if (x_logic_t !== i[0]) $stop;
// 2-state packed arrays
i_array_2_state_1(x_bit_1); if (x_bit_1 !== ~i[0] ) $stop;
i_array_2_state_32(x_bit_32); if (x_bit_32 !== ~32'd0 << i) $stop;
i_array_2_state_33(x_bit_33); if (x_bit_33 !== ~33'd0 << i) $stop;
i_array_2_state_64(x_bit_64); if (x_bit_64 !== ~64'd0 << i) $stop;
i_array_2_state_65(x_bit_65); if (x_bit_65 !== ~65'd0 << i) $stop;
i_array_2_state_128(x_bit_128); if (x_bit_128 !== ~128'd0<< i) $stop;
// 2-state packed structures
i_struct_2_state_1(x_struct_2_state_1); if (x_struct_2_state_1 !== ~i[0] ) $stop;
i_struct_2_state_32(x_struct_2_state_32); if (x_struct_2_state_32 !== ~32'd0 << i) $stop;
i_struct_2_state_33(x_struct_2_state_33); if (x_struct_2_state_33 !== ~33'd0 << i) $stop;
i_struct_2_state_64(x_struct_2_state_64); if (x_struct_2_state_64 !== ~64'd0 << i) $stop;
i_struct_2_state_65(x_struct_2_state_65); if (x_struct_2_state_65 !== ~65'd0 << i) $stop;
i_struct_2_state_128(x_struct_2_state_128); if (x_struct_2_state_128 !== ~128'd0<< i) $stop;
// 2-state packed unions
i_union_2_state_1(x_union_2_state_1); if (x_union_2_state_1 !== ~i[0] ) $stop;
i_union_2_state_32(x_union_2_state_32); if (x_union_2_state_32 !== ~32'd0 << i) $stop;
i_union_2_state_33(x_union_2_state_33); if (x_union_2_state_33 !== ~33'd0 << i) $stop;
i_union_2_state_64(x_union_2_state_64); if (x_union_2_state_64 !== ~64'd0 << i) $stop;
i_union_2_state_65(x_union_2_state_65); if (x_union_2_state_65 !== ~65'd0 << i) $stop;
i_union_2_state_128(x_union_2_state_128); if (x_union_2_state_128 !== ~128'd0<< i) $stop;
// 4-state packed arrays
i_array_4_state_1(x_logic_1); if (x_logic_1 !== ~i[0] ) $stop;
i_array_4_state_32(x_logic_32); if (x_logic_32 !== ~32'd0 << i) $stop;
i_array_4_state_33(x_logic_33); if (x_logic_33 !== ~33'd0 << i) $stop;
i_array_4_state_64(x_logic_64); if (x_logic_64 !== ~64'd0 << i) $stop;
i_array_4_state_65(x_logic_65); if (x_logic_65 !== ~65'd0 << i) $stop;
i_array_4_state_128(x_logic_128); if (x_logic_128 !== ~128'd0<< i) $stop;
// 4-state packed structures
i_struct_4_state_1(x_struct_4_state_1); if (x_struct_4_state_1 !== ~i[0] ) $stop;
i_struct_4_state_32(x_struct_4_state_32); if (x_struct_4_state_32 !== ~32'd0 << i) $stop;
i_struct_4_state_33(x_struct_4_state_33); if (x_struct_4_state_33 !== ~33'd0 << i) $stop;
i_struct_4_state_64(x_struct_4_state_64); if (x_struct_4_state_64 !== ~64'd0 << i) $stop;
i_struct_4_state_65(x_struct_4_state_65); if (x_struct_4_state_65 !== ~65'd0 << i) $stop;
i_struct_4_state_128(x_struct_4_state_128); if (x_struct_4_state_128 !== ~128'd0<< i) $stop;
// 4-state packed unions
i_union_4_state_1(x_union_4_state_1); if (x_union_4_state_1 !== ~i[0] ) $stop;
i_union_4_state_32(x_union_4_state_32); if (x_union_4_state_32 !== ~32'd0 << i) $stop;
i_union_4_state_33(x_union_4_state_33); if (x_union_4_state_33 !== ~33'd0 << i) $stop;
i_union_4_state_64(x_union_4_state_64); if (x_union_4_state_64 !== ~64'd0 << i) $stop;
i_union_4_state_65(x_union_4_state_65); if (x_union_4_state_65 !== ~65'd0 << i) $stop;
i_union_4_state_128(x_union_4_state_128); if (x_union_4_state_128 !== ~128'd0<< i) $stop;
// Check the exports
check_exports();
end
$write("*-* All Finished *-*\n");
$finish;
end
endmodule

View File

@ -0,0 +1,287 @@
// Verilated -*- C++ -*-
// DESCRIPTION: Verilator output: Prototypes for DPI import and export functions.
//
// Verilator includes this file in all generated .cpp files that use DPI functions.
// Manually include this file where DPI .c import functions are declared to ensure
// the C functions match the expectations of the DPI imports.
#include "svdpi.h"
#ifdef __cplusplus
extern "C" {
#endif
// DPI EXPORTS
// DPI export at t/t_dpi_arg_output_type.v:521:18
extern void e_array_2_state_1(svBitVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:556:18
extern void e_array_2_state_128(svBitVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:528:18
extern void e_array_2_state_32(svBitVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:535:18
extern void e_array_2_state_33(svBitVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:542:18
extern void e_array_2_state_64(svBitVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:549:18
extern void e_array_2_state_65(svBitVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:650:18
extern void e_array_4_state_1(svLogicVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:685:18
extern void e_array_4_state_128(svLogicVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:657:18
extern void e_array_4_state_32(svLogicVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:664:18
extern void e_array_4_state_33(svLogicVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:671:18
extern void e_array_4_state_64(svLogicVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:678:18
extern void e_array_4_state_65(svLogicVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:399:18
extern void e_bit(svBit* o);
// DPI export at t/t_dpi_arg_output_type.v:506:18
extern void e_bit_t(svBit* o);
// DPI export at t/t_dpi_arg_output_type.v:307:18
extern void e_byte(char* o);
// DPI export at t/t_dpi_arg_output_type.v:414:18
extern void e_byte_t(char* o);
// DPI export at t/t_dpi_arg_output_type.v:313:18
extern void e_byte_unsigned(unsigned char* o);
// DPI export at t/t_dpi_arg_output_type.v:420:18
extern void e_byte_unsigned_t(unsigned char* o);
// DPI export at t/t_dpi_arg_output_type.v:385:18
extern void e_chandle(void** o);
// DPI export at t/t_dpi_arg_output_type.v:492:18
extern void e_chandle_t(void** o);
// DPI export at t/t_dpi_arg_output_type.v:331:18
extern void e_int(int* o);
// DPI export at t/t_dpi_arg_output_type.v:438:18
extern void e_int_t(int* o);
// DPI export at t/t_dpi_arg_output_type.v:337:18
extern void e_int_unsigned(unsigned int* o);
// DPI export at t/t_dpi_arg_output_type.v:444:18
extern void e_int_unsigned_t(unsigned int* o);
// DPI export at t/t_dpi_arg_output_type.v:364:18
extern void e_integer(svLogicVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:471:18
extern void e_integer_t(svLogicVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:406:18
extern void e_logic(svLogic* o);
// DPI export at t/t_dpi_arg_output_type.v:513:18
extern void e_logic_t(svLogic* o);
// DPI export at t/t_dpi_arg_output_type.v:343:18
extern void e_longint(long long* o);
// DPI export at t/t_dpi_arg_output_type.v:450:18
extern void e_longint_t(long long* o);
// DPI export at t/t_dpi_arg_output_type.v:349:18
extern void e_longint_unsigned(unsigned long long* o);
// DPI export at t/t_dpi_arg_output_type.v:456:18
extern void e_longint_unsigned_t(unsigned long long* o);
// DPI export at t/t_dpi_arg_output_type.v:371:18
extern void e_real(double* o);
// DPI export at t/t_dpi_arg_output_type.v:478:18
extern void e_real_t(double* o);
// DPI export at t/t_dpi_arg_output_type.v:319:18
extern void e_shortint(short* o);
// DPI export at t/t_dpi_arg_output_type.v:426:18
extern void e_shortint_t(short* o);
// DPI export at t/t_dpi_arg_output_type.v:325:18
extern void e_shortint_unsigned(unsigned short* o);
// DPI export at t/t_dpi_arg_output_type.v:432:18
extern void e_shortint_unsigned_t(unsigned short* o);
// DPI export at t/t_dpi_arg_output_type.v:392:18
extern void e_string(const char** o);
// DPI export at t/t_dpi_arg_output_type.v:499:18
extern void e_string_t(const char** o);
// DPI export at t/t_dpi_arg_output_type.v:564:18
extern void e_struct_2_state_1(svBitVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:599:18
extern void e_struct_2_state_128(svBitVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:571:18
extern void e_struct_2_state_32(svBitVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:578:18
extern void e_struct_2_state_33(svBitVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:585:18
extern void e_struct_2_state_64(svBitVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:592:18
extern void e_struct_2_state_65(svBitVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:693:18
extern void e_struct_4_state_1(svLogicVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:728:18
extern void e_struct_4_state_128(svLogicVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:700:18
extern void e_struct_4_state_32(svLogicVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:707:18
extern void e_struct_4_state_33(svLogicVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:714:18
extern void e_struct_4_state_64(svLogicVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:721:18
extern void e_struct_4_state_65(svLogicVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:356:18
extern void e_time(svLogicVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:463:18
extern void e_time_t(svLogicVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:607:18
extern void e_union_2_state_1(svBitVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:642:18
extern void e_union_2_state_128(svBitVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:614:18
extern void e_union_2_state_32(svBitVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:621:18
extern void e_union_2_state_33(svBitVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:628:18
extern void e_union_2_state_64(svBitVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:635:18
extern void e_union_2_state_65(svBitVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:736:18
extern void e_union_4_state_1(svLogicVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:771:18
extern void e_union_4_state_128(svLogicVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:743:18
extern void e_union_4_state_32(svLogicVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:750:18
extern void e_union_4_state_33(svLogicVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:757:18
extern void e_union_4_state_64(svLogicVecVal* o);
// DPI export at t/t_dpi_arg_output_type.v:764:18
extern void e_union_4_state_65(svLogicVecVal* o);
// DPI IMPORTS
// DPI import at t/t_dpi_arg_output_type.v:781:41
extern void check_exports();
// DPI import at t/t_dpi_arg_output_type.v:154:33
extern void i_array_2_state_1(svBitVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:159:33
extern void i_array_2_state_128(svBitVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:155:33
extern void i_array_2_state_32(svBitVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:156:33
extern void i_array_2_state_33(svBitVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:157:33
extern void i_array_2_state_64(svBitVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:158:33
extern void i_array_2_state_65(svBitVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:178:33
extern void i_array_4_state_1(svLogicVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:183:33
extern void i_array_4_state_128(svLogicVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:179:33
extern void i_array_4_state_32(svLogicVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:180:33
extern void i_array_4_state_33(svLogicVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:181:33
extern void i_array_4_state_64(svLogicVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:182:33
extern void i_array_4_state_65(svLogicVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:126:33
extern void i_bit(svBit* o);
// DPI import at t/t_dpi_arg_output_type.v:150:33
extern void i_bit_t(svBit* o);
// DPI import at t/t_dpi_arg_output_type.v:106:33
extern void i_byte(char* o);
// DPI import at t/t_dpi_arg_output_type.v:130:33
extern void i_byte_t(char* o);
// DPI import at t/t_dpi_arg_output_type.v:107:33
extern void i_byte_unsigned(unsigned char* o);
// DPI import at t/t_dpi_arg_output_type.v:131:33
extern void i_byte_unsigned_t(unsigned char* o);
// DPI import at t/t_dpi_arg_output_type.v:124:33
extern void i_chandle(void** o);
// DPI import at t/t_dpi_arg_output_type.v:148:33
extern void i_chandle_t(void** o);
// DPI import at t/t_dpi_arg_output_type.v:110:33
extern void i_int(int* o);
// DPI import at t/t_dpi_arg_output_type.v:134:33
extern void i_int_t(int* o);
// DPI import at t/t_dpi_arg_output_type.v:111:33
extern void i_int_unsigned(unsigned int* o);
// DPI import at t/t_dpi_arg_output_type.v:135:33
extern void i_int_unsigned_t(unsigned int* o);
// DPI import at t/t_dpi_arg_output_type.v:118:33
extern void i_integer(svLogicVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:142:33
extern void i_integer_t(svLogicVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:127:33
extern void i_logic(svLogic* o);
// DPI import at t/t_dpi_arg_output_type.v:151:33
extern void i_logic_t(svLogic* o);
// DPI import at t/t_dpi_arg_output_type.v:112:33
extern void i_longint(long long* o);
// DPI import at t/t_dpi_arg_output_type.v:136:33
extern void i_longint_t(long long* o);
// DPI import at t/t_dpi_arg_output_type.v:113:33
extern void i_longint_unsigned(unsigned long long* o);
// DPI import at t/t_dpi_arg_output_type.v:137:33
extern void i_longint_unsigned_t(unsigned long long* o);
// DPI import at t/t_dpi_arg_output_type.v:120:33
extern void i_real(double* o);
// DPI import at t/t_dpi_arg_output_type.v:144:33
extern void i_real_t(double* o);
// DPI import at t/t_dpi_arg_output_type.v:108:33
extern void i_shortint(short* o);
// DPI import at t/t_dpi_arg_output_type.v:132:33
extern void i_shortint_t(short* o);
// DPI import at t/t_dpi_arg_output_type.v:109:33
extern void i_shortint_unsigned(unsigned short* o);
// DPI import at t/t_dpi_arg_output_type.v:133:33
extern void i_shortint_unsigned_t(unsigned short* o);
// DPI import at t/t_dpi_arg_output_type.v:125:33
extern void i_string(const char** o);
// DPI import at t/t_dpi_arg_output_type.v:149:33
extern void i_string_t(const char** o);
// DPI import at t/t_dpi_arg_output_type.v:162:33
extern void i_struct_2_state_1(svBitVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:167:33
extern void i_struct_2_state_128(svBitVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:163:33
extern void i_struct_2_state_32(svBitVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:164:33
extern void i_struct_2_state_33(svBitVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:165:33
extern void i_struct_2_state_64(svBitVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:166:33
extern void i_struct_2_state_65(svBitVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:186:33
extern void i_struct_4_state_1(svLogicVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:191:33
extern void i_struct_4_state_128(svLogicVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:187:33
extern void i_struct_4_state_32(svLogicVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:188:33
extern void i_struct_4_state_33(svLogicVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:189:33
extern void i_struct_4_state_64(svLogicVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:190:33
extern void i_struct_4_state_65(svLogicVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:115:33
extern void i_time(svLogicVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:139:33
extern void i_time_t(svLogicVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:170:33
extern void i_union_2_state_1(svBitVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:175:33
extern void i_union_2_state_128(svBitVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:171:33
extern void i_union_2_state_32(svBitVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:172:33
extern void i_union_2_state_33(svBitVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:173:33
extern void i_union_2_state_64(svBitVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:174:33
extern void i_union_2_state_65(svBitVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:194:33
extern void i_union_4_state_1(svLogicVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:199:33
extern void i_union_4_state_128(svLogicVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:195:33
extern void i_union_4_state_32(svLogicVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:196:33
extern void i_union_4_state_33(svLogicVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:197:33
extern void i_union_4_state_64(svLogicVecVal* o);
// DPI import at t/t_dpi_arg_output_type.v:198:33
extern void i_union_4_state_65(svLogicVecVal* o);
#ifdef __cplusplus
}
#endif

View File

@ -1,4 +0,0 @@
%Error: t/t_dpi_exp_bad.v:12:24: DPI functions cannot return > 32 bits or four-state; use a two-state type or task instead: 'dpix_f_bit48__Vfuncrtn'
12 | function bit [47:0] dpix_f_bit48(bit [47:0] i); dpix_f_bit48 = ~i; endfunction
| ^~~~~~~~~~~~
%Error: Exiting due to

View File

@ -1,14 +0,0 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// Copyright 2009 by Wilson Snyder. This program is free software; you can
// redistribute it and/or modify it under the terms of either the GNU
// Lesser General Public License Version 3 or the Perl Artistic License
// Version 2.0.
// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
module t;
export "DPI-C" function dpix_f_bit48;
function bit [47:0] dpix_f_bit48(bit [47:0] i); dpix_f_bit48 = ~i; endfunction
endmodule

View File

@ -1,19 +0,0 @@
#!/usr/bin/perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2003 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
scenarios(linter => 1);
lint(
fails => $Self->{vlt_all},
expect_filename => $Self->{golden_filename},
);
ok(1);
1;

View File

@ -1,18 +0,0 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// Copyright 2009 by Wilson Snyder. This program is free software; you can
// redistribute it and/or modify it under the terms of either the GNU
// Lesser General Public License Version 3 or the Perl Artistic License
// Version 2.0.
// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
module t ();
// Can't handle time (yet?)
import "DPI-C" dpii_fa_bit = function logic [2:0] oth_f_int1(input time i);
initial begin
$stop;
end
endmodule

View File

@ -0,0 +1,352 @@
// -*- mode: C++; c-file-style: "cc-mode" -*-
//*************************************************************************
//
// Copyright 2020 by Geza Lore. This program is free software; you can
// redistribute it and/or modify it under the terms of either the GNU
// Lesser General Public License Version 3 or the Perl Artistic License
// Version 2.0.
// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
//
//*************************************************************************
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include "svdpi.h"
#if defined(VERILATOR) // Verilator
# include "Vt_dpi_result_type__Dpi.h"
typedef long long sv_longint_t;
typedef unsigned long long sv_longint_unsigned_t;
# define NO_SHORTREAL
#elif defined(VCS) // VCS
# include "../vc_hdrs.h"
typedef long long sv_longint_t;
typedef unsigned long long sv_longint_unsigned_t;
# define NO_REAL_EXPORT
#elif defined(NCSC) // NC
# include "dpi-exp.h"
# include "dpi-imp.h"
typedef long long sv_longint_t;
typedef unsigned long long sv_longint_unsigned_t;
# define NO_STRUCT_OR_UNION
# define NO_SHORTREAL
#elif defined(MS) // ModelSim
# include "dpi.h"
typedef int64_t sv_longint_t;
typedef uint64_t sv_longint_unsigned_t;
# define NO_STRUCT_OR_UNION
# define NO_ARRAY
#else
# error "Unknown simulator for DPI test"
#endif
//======================================================================
// Implementations of imported functions
//======================================================================
// Basic types as per IEEE 1800-2017 35.5.5
void i_void() {
static int n = 0;
printf("i_void %d\n", n);
n++;
}
char i_byte() {
static int n = 0;
return 10 - n++;
}
unsigned char i_byte_unsigned() {
static int n = 0;
return 20 - n++;
}
short i_shortint() {
static int n = 0;
return 30 - n++;
}
unsigned short i_shortint_unsigned() {
static int n = 0;
return 40 - n++;
}
int i_int() {
static int n = 0;
return 50 - n++;
}
unsigned i_int_unsigned() {
static int n = 0;
return 60 - n++;
}
sv_longint_t i_longint() {
static int n = 0;
return 70 - n++;
}
sv_longint_unsigned_t i_longint_unsigned() {
static int n = 0;
return 80 - n++;
}
double i_real() {
static int n = 0;
return (-2.0 * n++ - 1.0) / 2.0;
}
#ifndef NO_SHORTREAL
float i_shortreal() {
static int n = 0;
return (-4.0f * n++ - 1.0f) / 4.0f;
}
#endif
void* i_chandle() {
static int n = 0;
printf("i_chandle %d\n", n);
return n++ % 2 ? reinterpret_cast<void*>(&i_chandle) : NULL;
}
const char* i_string() {
static int n = 0;
printf("i_string %d\n", n);
return n++ % 2 ? "Hello" : "World";
}
svBit i_bit() {
static int n = 0;
printf("i_bit %d\n", n);
return !(n++ % 2);
}
svLogic i_logic() {
static int n = 0;
printf("i_logic %d\n", n);
return n++ % 2;
}
// Basic types via typedefs
char i_byte_t() {
static int n = 0;
const char r = 10 - n;
n += 2;
return r;
}
unsigned char i_byte_unsigned_t() {
static int n = 0;
const unsigned char r = 20 - n;
n += 2;
return r;
}
short i_shortint_t() {
static int n = 0;
const short r = 30 - n;
n += 2;
return r;
}
unsigned short i_shortint_unsigned_t() {
static int n = 0;
const unsigned short r = 40 - n;
n += 2;
return r;
}
int i_int_t() {
static int n = 0;
const int r = 50 - n;
n += 2;
return r;
}
unsigned i_int_unsigned_t() {
static int n = 0;
const unsigned r = 60 - n;
n += 2;
return r;
}
sv_longint_t i_longint_t() {
static int n = 0;
const sv_longint_t r = 70 - n;
n += 2;
return r;
}
sv_longint_unsigned_t i_longint_unsigned_t() {
static int n = 0;
const sv_longint_unsigned_t r = 80 - n;
n += 2;
return r;
}
double i_real_t() {
static int n = 0;
const double r = (-2.0 * n - 1.0) / 2.0;
n += 2;
return r;
}
#ifndef NO_SHORTREAL
float i_shortreal_t() {
static int n = 0;
const float r = (-4.0f * n - 1.0f) / 4.0f;
n += 2;
return r;
}
#endif
void* i_chandle_t() {
static int n = 0;
printf("i_chandle_t %d\n", n);
return n++ % 2 ? reinterpret_cast<void*>(&i_chandle) : NULL;
}
const char* i_string_t() {
static int n = 0;
printf("i_string_t %d\n", n);
return n++ % 2 ? "Hello" : "World";
}
svBit i_bit_t() {
static int n = 0;
printf("i_bit_t %d\n", n);
return !(n++ % 2);
}
svLogic i_logic_t() {
static int n = 0;
printf("i_logic_t %d\n", n);
return n++ % 2;
}
#ifndef NO_ARRAY
// 2-state packed arrays of width <= 32
svBitVecVal i_array_2_state_1() {
static int n = 0;
printf("i_array_2_state_1 %d\n", n);
return !(n++ % 2);
}
svBitVecVal i_array_2_state_32() {
static int n = 0;
printf("i_array_2_state_32 %d\n", n);
return 0xffffffffU << n++;
}
#endif
#ifndef NO_STRUCT_OR_UNION
// 2-state packed structures of width <= 32
svBitVecVal i_struct_2_state_1() {
static int n = 0;
printf("i_struct_2_state_1 %d\n", n);
return !(n++ % 2);
}
svBitVecVal i_struct_2_state_32() {
static int n = 0;
printf("i_struct_2_state_32 %d\n", n);
return 0xffffffffU << n++;
}
// 2-state packed unions of width <= 32
svBitVecVal i_union_2_state_1() {
static int n = 0;
printf("i_union_2_state_1 %d\n", n);
return !(n++ % 2);
}
svBitVecVal i_union_2_state_32() {
static int n = 0;
printf("i_union_2_state_32 %d\n", n);
return 0xffffffffU << n++;
}
#endif
//======================================================================
// Check exported functions
//======================================================================
#define stop() \
do { \
printf(__FILE__ ":%d Bad value\n", __LINE__); \
abort(); \
} while (0)
void check_exports() {
static int n = 0;
e_void();
// Basic types as per IEEE 1800-2017 35.5.5
if (e_byte() != 10 + n) stop();
if (e_byte_unsigned() != 20 + n) stop();
if (e_shortint() != 30 + n) stop();
if (e_shortint_unsigned() != 40 + n) stop();
if (e_int() != 50 + n) stop();
if (e_int_unsigned() != 60 + n) stop();
if (e_longint() != 70 + n) stop();
if (e_longint_unsigned() != 80 + n) stop();
#ifndef NO_REAL_EXPORT
if (e_real() != 1.0 * n + 0.5) stop();
#endif
#ifndef NO_SHORTREAL
if (e_shortreal() != 1.0f * n + 0.25f) stop();
#endif
if (e_chandle() != NULL) stop();
if (n % 2 == 0) {
if (strcmp(e_string(), "Hello") != 0) stop();
} else {
if (strcmp(e_string(), "World") != 0) stop();
}
if (e_bit() != n % 2) stop();
if (e_logic() != !(n % 2)) stop();
// Basic types via tyepdef
if (e_byte_t() != 10 + 2 * n) stop();
if (e_byte_unsigned_t() != 20 + 2 * n) stop();
if (e_shortint_t() != 30 + 2 * n) stop();
if (e_shortint_unsigned_t() != 40 + 2 * n) stop();
if (e_int_t() != 50 + 2 * n) stop();
if (e_int_unsigned_t() != 60 + 2 * n) stop();
if (e_longint_t() != 70 + 2 * n) stop();
if (e_longint_unsigned_t() != 80 + 2 * n) stop();
#ifndef NO_REAL_EXPORT
if (e_real_t() != 1.0 * (2 * n) + 0.5) stop();
#endif
#ifndef NO_SHORTREAL
if (e_shortreal_t() != 1.0f * (2 * n) + 0.25f) stop();
#endif
if (e_chandle_t() != NULL) stop();
if (n % 2 == 0) {
if (strcmp(e_string_t(), "Hello") != 0) stop();
} else {
if (strcmp(e_string_t(), "World") != 0) stop();
}
if (e_bit_t() != n % 2) stop();
if (e_logic_t() != !(n % 2)) stop();
#ifndef NO_ARRAY
// 2-state packed arrays of width <= 32
if (e_array_2_state_1() != n % 2) stop();
if (e_array_2_state_32() != 0xffffffff >> n) stop();
#endif
#ifndef NO_STRUCT_OR_UNION
// 2-state packed structures of width <= 32
if (e_struct_2_state_1() != n % 2) stop();
if (e_struct_2_state_32() != 0xffffffff >> n) stop();
// 2-state packed unions of width <= 32
if (e_union_2_state_1() != n % 2) stop();
if (e_union_2_state_32() != 0xffffffff >> n) stop();
#endif
n++;
}

View File

@ -0,0 +1,91 @@
i_void 0
i_chandle 0
i_string 0
i_bit 0
i_logic 0
i_chandle_t 0
i_string_t 0
i_bit_t 0
i_logic_t 0
i_array_2_state_1 0
i_array_2_state_32 0
i_struct_2_state_1 0
i_struct_2_state_32 0
i_union_2_state_1 0
i_union_2_state_32 0
e_void 0
e_chandle 0
e_string 0
e_bit 0
e_logic 0
e_chandle_t 0
e_string_t 0
e_bit_t 0
e_logic_t 0
e_array_2_state_1 0
e_array_2_state_32 0
e_struct_2_state_1 0
e_struct_2_state_32 0
e_union_2_state_1 0
e_union_2_state_32 0
i_void 1
i_chandle 1
i_string 1
i_bit 1
i_logic 1
i_chandle_t 1
i_string_t 1
i_bit_t 1
i_logic_t 1
i_array_2_state_1 1
i_array_2_state_32 1
i_struct_2_state_1 1
i_struct_2_state_32 1
i_union_2_state_1 1
i_union_2_state_32 1
e_void 1
e_chandle 1
e_string 1
e_bit 1
e_logic 1
e_chandle_t 1
e_string_t 1
e_bit_t 1
e_logic_t 1
e_array_2_state_1 1
e_array_2_state_32 1
e_struct_2_state_1 1
e_struct_2_state_32 1
e_union_2_state_1 1
e_union_2_state_32 1
i_void 2
i_chandle 2
i_string 2
i_bit 2
i_logic 2
i_chandle_t 2
i_string_t 2
i_bit_t 2
i_logic_t 2
i_array_2_state_1 2
i_array_2_state_32 2
i_struct_2_state_1 2
i_struct_2_state_32 2
i_union_2_state_1 2
i_union_2_state_32 2
e_void 2
e_chandle 2
e_string 2
e_bit 2
e_logic 2
e_chandle_t 2
e_string_t 2
e_bit_t 2
e_logic_t 2
e_array_2_state_1 2
e_array_2_state_32 2
e_struct_2_state_1 2
e_struct_2_state_32 2
e_union_2_state_1 2
e_union_2_state_32 2
*-* All Finished *-*

View File

@ -0,0 +1,45 @@
#!/usr/bin/perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2020 by Geza Lore. This program is free software; you can
# redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
scenarios(simulator => 1);
if ($Self->{nc}) {
# For NC, compile twice, first just to generate DPI headers
compile(
nc_flags2 => ["+ncdpiheader+$Self->{obj_dir}/dpi-exp.h",
"+ncdpiimpheader+$Self->{obj_dir}/dpi-imp.h"]
);
}
compile(
v_flags2 => ["t/t_dpi_result_type.cpp"],
verilator_flags2 => ["-Wall -Wno-DECLFILENAME"],
# NC: Gdd the obj_dir to the C include path
nc_flags2 => ["+ncscargs+-I$Self->{obj_dir}"],
# ModelSim: Generate DPI header, add obj_dir to the C include path
ms_flags2 => ["-dpiheader $Self->{obj_dir}/dpi.h",
"-ccflags -I$Self->{obj_dir}"],
);
if ($Self->{vlt_all}) {
files_identical(
"$Self->{obj_dir}/Vt_dpi_result_type__Dpi.h",
"t/t_dpi_result_type__Dpi.out"
);
}
execute(
check_finished => 1,
expect_filename => $Self->{golden_filename},
ms_pli => 0
);
ok(1);
1;

View File

@ -0,0 +1,520 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// Copyright 2020 by Geza Lore. This program is free software; you can
// redistribute it and/or modify it under the terms of either the GNU
// Lesser General Public License Version 3 or the Perl Artistic License
// Version 2.0.
// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
`ifdef VCS
`define NO_REAL_EXPORT
`endif
`ifdef NC
`define NO_STRUCT_OR_UNION
`define NO_SHORTREAL
`endif
`ifdef MS
`define NO_STRUCT_OR_UNION
`define NO_ARRAY
`endif
`ifdef VERILATOR
`define NO_SHORTREAL
`define NULL 64'd0
`else
`define NULL null
`endif
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
`ifdef VERILATOR
wire _unused = &{1'b0, clk};
`endif
// Legal result types for DPI functions
//======================================================================
// Type definitions
//======================================================================
// Basic types as per IEEE 1800-2017 35.5.5
typedef byte byte_t;
typedef byte unsigned byte_unsigned_t;
typedef shortint shortint_t;
typedef shortint unsigned shortint_unsigned_t;
typedef int int_t;
typedef int unsigned int_unsigned_t;
typedef longint longint_t;
typedef longint unsigned longint_unsigned_t;
typedef real real_t;
`ifndef NO_SHORTREAL
typedef shortreal shortreal_t;
`endif
typedef chandle chandle_t;
typedef string string_t;
typedef bit bit_t;
typedef logic logic_t;
// 2-state packed structures of width <= 32
typedef struct packed { bit x; } struct_2_state_1;
typedef struct packed { bit [15:0] x; bit [15:0] y; } struct_2_state_32;
// 2-state packed unions of width <= 32
typedef union packed { bit x; bit y; } union_2_state_1;
typedef union packed { bit [31:0] x; bit [31:0] y; } union_2_state_32;
//======================================================================
// Imports
//======================================================================
// Basic types as per IEEE 1800-2017 35.5.5
import "DPI-C" function void i_void ();
import "DPI-C" function byte i_byte ();
import "DPI-C" function byte unsigned i_byte_unsigned ();
import "DPI-C" function shortint i_shortint ();
import "DPI-C" function shortint unsigned i_shortint_unsigned ();
import "DPI-C" function int i_int ();
import "DPI-C" function int unsigned i_int_unsigned ();
import "DPI-C" function longint i_longint ();
import "DPI-C" function longint unsigned i_longint_unsigned ();
import "DPI-C" function real i_real ();
`ifndef NO_SHORTREAL
import "DPI-C" function shortreal i_shortreal ();
`endif
import "DPI-C" function chandle i_chandle ();
import "DPI-C" function string i_string ();
import "DPI-C" function bit i_bit ();
import "DPI-C" function logic i_logic ();
// Basic types via typedef
import "DPI-C" function byte_t i_byte_t ();
import "DPI-C" function byte_unsigned_t i_byte_unsigned_t ();
import "DPI-C" function shortint_t i_shortint_t ();
import "DPI-C" function shortint_unsigned_t i_shortint_unsigned_t ();
import "DPI-C" function int_t i_int_t ();
import "DPI-C" function int_unsigned_t i_int_unsigned_t ();
import "DPI-C" function longint_t i_longint_t ();
import "DPI-C" function longint_unsigned_t i_longint_unsigned_t ();
import "DPI-C" function real_t i_real_t ();
`ifndef NO_SHORTREAL
import "DPI-C" function shortreal_t i_shortreal_t ();
`endif
import "DPI-C" function chandle_t i_chandle_t ();
import "DPI-C" function string_t i_string_t ();
import "DPI-C" function bit_t i_bit_t ();
import "DPI-C" function logic_t i_logic_t ();
`ifndef NO_ARRAY
// 2-state packed arrays of width <= 32
import "DPI-C" function bit [ 0:0] i_array_2_state_1 ();
import "DPI-C" function bit [31:0] i_array_2_state_32 ();
`endif
`ifndef NO_STRUCT_OR_UNION
// 2-state packed structures of width <= 32
import "DPI-C" function struct_2_state_1 i_struct_2_state_1 ();
import "DPI-C" function struct_2_state_32 i_struct_2_state_32();
// 2-state packed unions of width <= 32
import "DPI-C" function union_2_state_1 i_union_2_state_1 ();
import "DPI-C" function union_2_state_32 i_union_2_state_32();
`endif
//======================================================================
// Exports
//======================================================================
// Basic types as per IEEE 1800-2017 35.5.5
export "DPI-C" function e_void;
export "DPI-C" function e_byte;
export "DPI-C" function e_byte_unsigned;
export "DPI-C" function e_shortint;
export "DPI-C" function e_shortint_unsigned;
export "DPI-C" function e_int;
export "DPI-C" function e_int_unsigned;
export "DPI-C" function e_longint;
export "DPI-C" function e_longint_unsigned;
`ifndef NO_REAL_EXPORT
export "DPI-C" function e_real;
`endif
`ifndef NO_SHORTREAL
export "DPI-C" function e_shortreal;
`endif
export "DPI-C" function e_chandle;
export "DPI-C" function e_string;
export "DPI-C" function e_bit;
export "DPI-C" function e_logic;
// Basic types via typedef
export "DPI-C" function e_byte_t;
export "DPI-C" function e_byte_unsigned_t;
export "DPI-C" function e_shortint_t;
export "DPI-C" function e_shortint_unsigned_t;
export "DPI-C" function e_int_t;
export "DPI-C" function e_int_unsigned_t;
export "DPI-C" function e_longint_t;
export "DPI-C" function e_longint_unsigned_t;
`ifndef NO_REAL_EXPORT
export "DPI-C" function e_real_t;
`endif
`ifndef NO_SHORTREAL
export "DPI-C" function e_shortreal_t;
`endif
export "DPI-C" function e_chandle_t;
export "DPI-C" function e_string_t;
export "DPI-C" function e_bit_t;
export "DPI-C" function e_logic_t;
`ifndef NO_ARRAY
// 2-state packed arrays of width <= 32
export "DPI-C" function e_array_2_state_1;
export "DPI-C" function e_array_2_state_32;
`endif
`ifndef NO_STRUCT_OR_UNION
// 2-state packed structures of width <= 32
export "DPI-C" function e_struct_2_state_1;
export "DPI-C" function e_struct_2_state_32;
// 2-state packed unions of width <= 32
export "DPI-C" function e_union_2_state_1;
export "DPI-C" function e_union_2_state_32;
`endif
//======================================================================
// Definitions of exported functions
//======================================================================
// Static variables (Note: Verilator strangely assumes everything inside
// a function is automatic, which is exactly the opposite of the standard
// see IEEE 1800-2017 13.3.1 and 13.4.2
// Basic types as per IEEE 1800-2017 35.5.5
int n_void = 0;
function void e_void();
$display("e_void %1d", n_void);
n_void++;
endfunction
byte n_byte = 0;
function byte e_byte();
e_byte = 8'd10 + n_byte;
n_byte++;
endfunction
byte n_byte_unsigned = 0;
function byte unsigned e_byte_unsigned();
e_byte_unsigned = 8'd20 + n_byte_unsigned;
n_byte_unsigned++;
endfunction
shortint n_shortint = 0;
function shortint e_shortint();
e_shortint = 16'd30 + n_shortint;
n_shortint++;
endfunction
shortint n_shortint_unsigned = 0;
function shortint unsigned e_shortint_unsigned();
e_shortint_unsigned = 16'd40 + n_shortint_unsigned;
n_shortint_unsigned++;
endfunction
int n_int = 0;
function int e_int();
e_int = 32'd50 + n_int;
n_int++;
endfunction
int n_int_unsigned = 0;
function int unsigned e_int_unsigned();
e_int_unsigned = 32'd60 + n_int_unsigned;
n_int_unsigned++;
endfunction
longint n_longint = 0;
function longint e_longint();
e_longint = 64'd70 + n_longint;
n_longint++;
endfunction
longint n_longint_unsigned = 0;
function longint unsigned e_longint_unsigned();
e_longint_unsigned = 64'd80 + n_longint_unsigned;
n_longint_unsigned++;
endfunction
`ifndef NO_REAL_EXPORT
int n_real = 0;
function real e_real();
e_real = real'(2*n_real + 1) / 2.0;
n_real++;
endfunction
`endif
`ifndef NO_SHORTREAL
int n_shortreal = 0;
function shortreal e_shortreal();
e_shortreal = shortreal'(4*n_shortreal + 1)/ 4.0;
n_shortreal++;
endfunction
`endif
int n_chandle = 0;
function chandle e_chandle();
$display("e_chandle %1d", n_chandle);
e_chandle = `NULL;
n_chandle++;
endfunction
int n_string = 0;
function string e_string();
$display("e_string %1d", n_string);
e_string = n_string[0] ? "World" : "Hello";
n_string++;
endfunction
int n_bit = 0;
function bit e_bit();
$display("e_bit %1d", n_bit);
e_bit = n_bit[0];
n_bit++;
endfunction
int n_logic = 0;
function logic e_logic();
$display("e_logic %1d", n_logic);
e_logic = ~n_logic[0];
n_logic++;
endfunction
// Basic types via typedefs
byte_t n_byte_t = 0;
function byte_t e_byte_t();
e_byte_t = 8'd10 + n_byte_t;
n_byte_t += 2;
endfunction
byte n_byte_unsigned_t = 0;
function byte_unsigned_t e_byte_unsigned_t();
e_byte_unsigned_t = 8'd20 + n_byte_unsigned_t;
n_byte_unsigned_t += 2;
endfunction
shortint_t n_shortint_t = 0;
function shortint_t e_shortint_t();
e_shortint_t = 16'd30 + n_shortint_t;
n_shortint_t += 2;
endfunction
shortint n_shortint_unsigned_t = 0;
function shortint_unsigned_t e_shortint_unsigned_t();
e_shortint_unsigned_t = 16'd40 + n_shortint_unsigned_t;
n_shortint_unsigned_t += 2;
endfunction
int_t n_int_t = 0;
function int_t e_int_t();
e_int_t = 32'd50 + n_int_t;
n_int_t += 2;
endfunction
int n_int_unsigned_t = 0;
function int_unsigned_t e_int_unsigned_t();
e_int_unsigned_t = 32'd60 + n_int_unsigned_t;
n_int_unsigned_t += 2;
endfunction
longint_t n_longint_t = 0;
function longint_t e_longint_t();
e_longint_t = 64'd70 + n_longint_t;
n_longint_t += 2;
endfunction
longint n_longint_unsigned_t = 0;
function longint_unsigned_t e_longint_unsigned_t();
e_longint_unsigned_t = 64'd80 + n_longint_unsigned_t;
n_longint_unsigned_t += 2;
endfunction
`ifndef NO_REAL_EXPORT
int n_real_t = 0;
function real_t e_real_t();
e_real_t = real'(2*n_real_t + 1) / 2.0;
n_real_t += 2;
endfunction
`endif
`ifndef NO_SHORTREAL
int n_shortreal_t = 0;
function shortreal_t e_shortreal_t();
e_shortreal_t = shortreal'(4*n_shortreal_t + 1)/ 4.0;
n_shortreal_t += 2;
endfunction
`endif
int n_chandle_t = 0;
function chandle_t e_chandle_t();
$display("e_chandle_t %1d", n_chandle_t);
e_chandle_t = `NULL;
n_chandle_t++;
endfunction
int n_string_t = 0;
function string_t e_string_t();
$display("e_string_t %1d", n_string_t);
e_string_t = n_string_t[0] ? "World" : "Hello";
n_string_t++;
endfunction
int n_bit_t = 0;
function bit_t e_bit_t();
$display("e_bit_t %1d", n_bit_t);
e_bit_t = n_bit_t[0];
n_bit_t++;
endfunction
int n_logic_t = 0;
function logic_t e_logic_t();
$display("e_logic_t %1d", n_logic_t);
e_logic_t = ~n_logic_t[0];
n_logic_t++;
endfunction
`ifndef NO_ARRAY
// 2-state packed arrays of width <= 32
int n_array_2_state_1 = 0;
function bit [ 0:0] e_array_2_state_1();
$display("e_array_2_state_1 %1d", n_array_2_state_1);
e_array_2_state_1 = n_array_2_state_1[0];
n_array_2_state_1++;
endfunction
int n_array_2_state_32 = 0;
function bit [31:0] e_array_2_state_32();
$display("e_array_2_state_32 %1d", n_array_2_state_32);
e_array_2_state_32 = ~32'd0 >> n_array_2_state_32;
n_array_2_state_32++;
endfunction
`endif
`ifndef NO_STRUCT_OR_UNION
// 2-state packed structures of width <= 32
int n_struct_2_state_1 = 0;
function struct_2_state_1 e_struct_2_state_1();
$display("e_struct_2_state_1 %1d", n_struct_2_state_1);
e_struct_2_state_1 = n_struct_2_state_1[0];
n_struct_2_state_1++;
endfunction
int n_struct_2_state_32 = 0;
function struct_2_state_32 e_struct_2_state_32();
$display("e_struct_2_state_32 %1d", n_struct_2_state_32);
e_struct_2_state_32 = ~32'd0 >> n_struct_2_state_32;
n_struct_2_state_32++;
endfunction
// 2-state packed unions of width <= 32
int n_union_2_state_1 = 0;
function union_2_state_1 e_union_2_state_1();
$display("e_union_2_state_1 %1d", n_union_2_state_1);
e_union_2_state_1 = n_union_2_state_1[0];
n_union_2_state_1++;
endfunction
int n_union_2_state_32 = 0;
function union_2_state_32 e_union_2_state_32();
$display("e_union_2_state_32 %1d", n_union_2_state_32);
e_union_2_state_32 = ~32'd0 >> n_union_2_state_32;
n_union_2_state_32++;
endfunction
`endif
//======================================================================
// Invoke all functions 3 times (they have side effects)
//======================================================================
import "DPI-C" context function void check_exports();
initial begin
for (int i = 0 ; i < 3; i++) begin
// Check the imports
// Basic types as per IEEE 1800-2017 35.5.5
i_void();
if (i_byte() !== 8'd10 - 8'(i)) $stop;
if (i_byte_unsigned() !== 8'd20 - 8'(i)) $stop;
if (i_shortint() !== 16'd30 - 16'(i)) $stop;
if (i_shortint_unsigned() !== 16'd40 - 16'(i)) $stop;
if (i_int() !== 32'd50 - 32'(i)) $stop;
if (i_int_unsigned() !== 32'd60 - 32'(i)) $stop;
if (i_longint() !== 64'd70 - 64'(i)) $stop;
if (i_longint_unsigned() !== 64'd80 - 64'(i)) $stop;
if (i_real() != -1.0*i - 0.5 ) $stop;
`ifndef NO_SHORTREAL
if (i_shortreal() != -1.0*i - 0.25) $stop;
`endif
if (~i[0]) begin
if (i_chandle() !== `NULL) $stop;
if (i_string() != "World") $stop;
end else begin
if (i_chandle() === `NULL) $stop;
if (i_string() != "Hello") $stop;
end
if (i_bit() !== ~i[0]) $stop;
if (i_logic() !== i[0]) $stop;
// Basic types via typedefs
if (i_byte_t() !== 8'd10 - 8'(2*i)) $stop;
if (i_byte_unsigned_t() !== 8'd20 - 8'(2*i)) $stop;
if (i_shortint_t() !== 16'd30 - 16'(2*i)) $stop;
if (i_shortint_unsigned_t() !== 16'd40 - 16'(2*i)) $stop;
if (i_int_t() !== 32'd50 - 32'(2*i)) $stop;
if (i_int_unsigned_t() !== 32'd60 - 32'(2*i)) $stop;
if (i_longint_t() !== 64'd70 - 64'(2*i)) $stop;
if (i_longint_unsigned_t() !== 64'd80 - 64'(2*i)) $stop;
if (i_real_t() != -1.0*(2*i) - 0.5 ) $stop;
`ifndef NO_SHORTREAL
if (i_shortreal_t() != -1.0*(2*i) - 0.25) $stop;
`endif
if (~i[0]) begin
if (i_chandle_t() !== `NULL) $stop;
if (i_string_t() != "World") $stop;
end else begin
if (i_chandle_t() === `NULL) $stop;
if (i_string_t() != "Hello") $stop;
end
if (i_bit_t() !== ~i[0]) $stop;
if (i_logic_t() !== i[0]) $stop;
`ifndef NO_ARRAY
// 2-state packed arrays of width <= 32
if (i_array_2_state_1() !== ~i[0] ) $stop;
if (i_array_2_state_32() !== ~32'd0 << i) $stop;
`endif
`ifndef NO_STRUCT_OR_UNION
// 2-state packed structures of width <= 32
if (i_struct_2_state_1() !== ~i[0] ) $stop;
if (i_struct_2_state_32() !== ~32'd0 << i) $stop;
// 2-state packed unions of width <= 32
if (i_union_2_state_1() !== ~i[0] ) $stop;
if (i_union_2_state_32() !== ~32'd0 << i) $stop;
`endif
// Check the exports
check_exports();
end
$write("*-* All Finished *-*\n");
$finish;
end
endmodule

View File

@ -0,0 +1,155 @@
// Verilated -*- C++ -*-
// DESCRIPTION: Verilator output: Prototypes for DPI import and export functions.
//
// Verilator includes this file in all generated .cpp files that use DPI functions.
// Manually include this file where DPI .c import functions are declared to ensure
// the C functions match the expectations of the DPI imports.
#include "svdpi.h"
#ifdef __cplusplus
extern "C" {
#endif
// DPI EXPORTS
// DPI export at t/t_dpi_result_type.v:393:24
extern svBitVecVal e_array_2_state_1();
// DPI export at t/t_dpi_result_type.v:400:24
extern svBitVecVal e_array_2_state_32();
// DPI export at t/t_dpi_result_type.v:284:17
extern svBit e_bit();
// DPI export at t/t_dpi_result_type.v:377:19
extern svBit e_bit_t();
// DPI export at t/t_dpi_result_type.v:206:18
extern char e_byte();
// DPI export at t/t_dpi_result_type.v:299:20
extern char e_byte_t();
// DPI export at t/t_dpi_result_type.v:212:27
extern unsigned char e_byte_unsigned();
// DPI export at t/t_dpi_result_type.v:305:29
extern unsigned char e_byte_unsigned_t();
// DPI export at t/t_dpi_result_type.v:270:21
extern void* e_chandle();
// DPI export at t/t_dpi_result_type.v:363:23
extern void* e_chandle_t();
// DPI export at t/t_dpi_result_type.v:230:17
extern int e_int();
// DPI export at t/t_dpi_result_type.v:323:19
extern int e_int_t();
// DPI export at t/t_dpi_result_type.v:236:26
extern unsigned int e_int_unsigned();
// DPI export at t/t_dpi_result_type.v:329:28
extern unsigned int e_int_unsigned_t();
// DPI export at t/t_dpi_result_type.v:291:19
extern svLogic e_logic();
// DPI export at t/t_dpi_result_type.v:384:21
extern svLogic e_logic_t();
// DPI export at t/t_dpi_result_type.v:242:21
extern long long e_longint();
// DPI export at t/t_dpi_result_type.v:335:23
extern long long e_longint_t();
// DPI export at t/t_dpi_result_type.v:248:30
extern unsigned long long e_longint_unsigned();
// DPI export at t/t_dpi_result_type.v:341:32
extern unsigned long long e_longint_unsigned_t();
// DPI export at t/t_dpi_result_type.v:255:18
extern double e_real();
// DPI export at t/t_dpi_result_type.v:348:20
extern double e_real_t();
// DPI export at t/t_dpi_result_type.v:218:22
extern short e_shortint();
// DPI export at t/t_dpi_result_type.v:311:24
extern short e_shortint_t();
// DPI export at t/t_dpi_result_type.v:224:31
extern unsigned short e_shortint_unsigned();
// DPI export at t/t_dpi_result_type.v:317:33
extern unsigned short e_shortint_unsigned_t();
// DPI export at t/t_dpi_result_type.v:277:20
extern const char* e_string();
// DPI export at t/t_dpi_result_type.v:370:22
extern const char* e_string_t();
// DPI export at t/t_dpi_result_type.v:410:30
extern svBitVecVal e_struct_2_state_1();
// DPI export at t/t_dpi_result_type.v:417:32
extern svBitVecVal e_struct_2_state_32();
// DPI export at t/t_dpi_result_type.v:425:29
extern svBitVecVal e_union_2_state_1();
// DPI export at t/t_dpi_result_type.v:432:30
extern svBitVecVal e_union_2_state_32();
// DPI export at t/t_dpi_result_type.v:200:18
extern void e_void();
// DPI IMPORTS
// DPI import at t/t_dpi_result_type.v:443:41
extern void check_exports();
// DPI import at t/t_dpi_result_type.v:115:39
extern svBitVecVal i_array_2_state_1();
// DPI import at t/t_dpi_result_type.v:116:39
extern svBitVecVal i_array_2_state_32();
// DPI import at t/t_dpi_result_type.v:92:46
extern svBit i_bit();
// DPI import at t/t_dpi_result_type.v:110:48
extern svBit i_bit_t();
// DPI import at t/t_dpi_result_type.v:78:46
extern char i_byte();
// DPI import at t/t_dpi_result_type.v:96:48
extern char i_byte_t();
// DPI import at t/t_dpi_result_type.v:79:46
extern unsigned char i_byte_unsigned();
// DPI import at t/t_dpi_result_type.v:97:48
extern unsigned char i_byte_unsigned_t();
// DPI import at t/t_dpi_result_type.v:90:46
extern void* i_chandle();
// DPI import at t/t_dpi_result_type.v:108:48
extern void* i_chandle_t();
// DPI import at t/t_dpi_result_type.v:82:46
extern int i_int();
// DPI import at t/t_dpi_result_type.v:100:48
extern int i_int_t();
// DPI import at t/t_dpi_result_type.v:83:46
extern unsigned int i_int_unsigned();
// DPI import at t/t_dpi_result_type.v:101:48
extern unsigned int i_int_unsigned_t();
// DPI import at t/t_dpi_result_type.v:93:46
extern svLogic i_logic();
// DPI import at t/t_dpi_result_type.v:111:48
extern svLogic i_logic_t();
// DPI import at t/t_dpi_result_type.v:84:46
extern long long i_longint();
// DPI import at t/t_dpi_result_type.v:102:48
extern long long i_longint_t();
// DPI import at t/t_dpi_result_type.v:85:46
extern unsigned long long i_longint_unsigned();
// DPI import at t/t_dpi_result_type.v:103:48
extern unsigned long long i_longint_unsigned_t();
// DPI import at t/t_dpi_result_type.v:86:46
extern double i_real();
// DPI import at t/t_dpi_result_type.v:104:48
extern double i_real_t();
// DPI import at t/t_dpi_result_type.v:80:46
extern short i_shortint();
// DPI import at t/t_dpi_result_type.v:98:48
extern short i_shortint_t();
// DPI import at t/t_dpi_result_type.v:81:46
extern unsigned short i_shortint_unsigned();
// DPI import at t/t_dpi_result_type.v:99:48
extern unsigned short i_shortint_unsigned_t();
// DPI import at t/t_dpi_result_type.v:91:46
extern const char* i_string();
// DPI import at t/t_dpi_result_type.v:109:48
extern const char* i_string_t();
// DPI import at t/t_dpi_result_type.v:121:47
extern svBitVecVal i_struct_2_state_1();
// DPI import at t/t_dpi_result_type.v:122:47
extern svBitVecVal i_struct_2_state_32();
// DPI import at t/t_dpi_result_type.v:125:46
extern svBitVecVal i_union_2_state_1();
// DPI import at t/t_dpi_result_type.v:126:46
extern svBitVecVal i_union_2_state_32();
// DPI import at t/t_dpi_result_type.v:77:46
extern void i_void();
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,399 @@
%Error: t/t_dpi_result_type_bad.v:79:40: DPI function may not return a > 32 bits wide type other than basic types.
... Suggest make it an output argument instead?
79 | import "DPI-C" function bit [ 32:0] i_array_2_state_33();
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:80:40: DPI function may not return a > 32 bits wide type other than basic types.
... Suggest make it an output argument instead?
80 | import "DPI-C" function bit [ 63:0] i_array_2_state_64();
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:81:40: DPI function may not return a > 32 bits wide type other than basic types.
... Suggest make it an output argument instead?
81 | import "DPI-C" function bit [ 64:0] i_array_2_state_65();
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:82:40: DPI function may not return a > 32 bits wide type other than basic types.
... Suggest make it an output argument instead?
82 | import "DPI-C" function bit [127:0] i_array_2_state_128();
| ^~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:85:48: DPI function may not return a > 32 bits wide type other than basic types.
... Suggest make it an output argument instead?
85 | import "DPI-C" function array_2_state_33_t i_array_2_state_33_t();
| ^~~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:86:48: DPI function may not return a > 32 bits wide type other than basic types.
... Suggest make it an output argument instead?
86 | import "DPI-C" function array_2_state_64_t i_array_2_state_64_t();
| ^~~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:87:48: DPI function may not return a > 32 bits wide type other than basic types.
... Suggest make it an output argument instead?
87 | import "DPI-C" function array_2_state_65_t i_array_2_state_65_t();
| ^~~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:88:48: DPI function may not return a > 32 bits wide type other than basic types.
... Suggest make it an output argument instead?
88 | import "DPI-C" function array_2_state_128_t i_array_2_state_128_t();
| ^~~~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:91:47: DPI function may not return a > 32 bits wide type other than basic types.
... Suggest make it an output argument instead?
91 | import "DPI-C" function struct_2_state_33 i_struct_2_state_33();
| ^~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:92:47: DPI function may not return a > 32 bits wide type other than basic types.
... Suggest make it an output argument instead?
92 | import "DPI-C" function struct_2_state_64 i_struct_2_state_64();
| ^~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:93:47: DPI function may not return a > 32 bits wide type other than basic types.
... Suggest make it an output argument instead?
93 | import "DPI-C" function struct_2_state_65 i_struct_2_state_65();
| ^~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:94:47: DPI function may not return a > 32 bits wide type other than basic types.
... Suggest make it an output argument instead?
94 | import "DPI-C" function struct_2_state_128 i_struct_2_state_128();
| ^~~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:97:46: DPI function may not return a > 32 bits wide type other than basic types.
... Suggest make it an output argument instead?
97 | import "DPI-C" function union_2_state_33 i_union_2_state_33();
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:98:46: DPI function may not return a > 32 bits wide type other than basic types.
... Suggest make it an output argument instead?
98 | import "DPI-C" function union_2_state_64 i_union_2_state_64();
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:99:46: DPI function may not return a > 32 bits wide type other than basic types.
... Suggest make it an output argument instead?
99 | import "DPI-C" function union_2_state_65 i_union_2_state_65();
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:100:46: DPI function may not return a > 32 bits wide type other than basic types.
... Suggest make it an output argument instead?
100 | import "DPI-C" function union_2_state_128 i_union_2_state_128();
| ^~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:103:36: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
103 | import "DPI-C" function integer i_integer();
| ^~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:106:42: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
106 | import "DPI-C" function logic [ 0:0] i_array_4_state_1();
| ^~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:107:42: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
107 | import "DPI-C" function logic [ 1:0] i_array_4_state_2();
| ^~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:108:42: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
108 | import "DPI-C" function logic [ 7:0] i_array_4_state_8();
| ^~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:109:42: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
109 | import "DPI-C" function logic [ 8:0] i_array_4_state_9();
| ^~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:110:42: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
110 | import "DPI-C" function logic [ 15:0] i_array_4_state_16();
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:111:42: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
111 | import "DPI-C" function logic [ 16:0] i_array_4_state_17();
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:112:42: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
112 | import "DPI-C" function logic [ 31:0] i_array_4_state_32();
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:113:42: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
113 | import "DPI-C" function logic [ 32:0] i_array_4_state_33();
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:114:42: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
114 | import "DPI-C" function logic [ 63:0] i_array_4_state_64();
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:115:42: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
115 | import "DPI-C" function logic [ 64:0] i_array_4_state_65();
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:116:42: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
116 | import "DPI-C" function logic [127:0] i_array_4_state_128();
| ^~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:119:48: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
119 | import "DPI-C" function array_4_state_1_t i_array_4_state_1_t();
| ^~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:120:48: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
120 | import "DPI-C" function array_4_state_2_t i_array_4_state_2_t();
| ^~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:121:48: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
121 | import "DPI-C" function array_4_state_8_t i_array_4_state_8_t();
| ^~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:122:48: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
122 | import "DPI-C" function array_4_state_9_t i_array_4_state_9_t();
| ^~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:123:48: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
123 | import "DPI-C" function array_4_state_16_t i_array_4_state_16_t();
| ^~~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:124:48: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
124 | import "DPI-C" function array_4_state_17_t i_array_4_state_17_t();
| ^~~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:125:48: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
125 | import "DPI-C" function array_4_state_32_t i_array_4_state_32_t();
| ^~~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:126:48: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
126 | import "DPI-C" function array_4_state_33_t i_array_4_state_33_t();
| ^~~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:127:48: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
127 | import "DPI-C" function array_4_state_64_t i_array_4_state_64_t();
| ^~~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:128:48: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
128 | import "DPI-C" function array_4_state_65_t i_array_4_state_65_t();
| ^~~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:129:48: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
129 | import "DPI-C" function array_4_state_128_t i_array_4_state_128_t();
| ^~~~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:132:47: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
132 | import "DPI-C" function struct_4_state_1 i_struct_4_state_1();
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:133:47: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
133 | import "DPI-C" function struct_4_state_2 i_struct_4_state_2();
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:134:47: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
134 | import "DPI-C" function struct_4_state_8 i_struct_4_state_8();
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:135:47: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
135 | import "DPI-C" function struct_4_state_9 i_struct_4_state_9();
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:136:47: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
136 | import "DPI-C" function struct_4_state_16 i_struct_4_state_16();
| ^~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:137:47: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
137 | import "DPI-C" function struct_4_state_17 i_struct_4_state_17();
| ^~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:138:47: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
138 | import "DPI-C" function struct_4_state_32 i_struct_4_state_32();
| ^~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:139:47: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
139 | import "DPI-C" function struct_4_state_33 i_struct_4_state_33();
| ^~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:140:47: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
140 | import "DPI-C" function struct_4_state_64 i_struct_4_state_64();
| ^~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:141:47: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
141 | import "DPI-C" function struct_4_state_65 i_struct_4_state_65();
| ^~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:142:47: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
142 | import "DPI-C" function struct_4_state_128 i_struct_4_state_128();
| ^~~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:145:46: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
145 | import "DPI-C" function union_4_state_1 i_union_4_state_1();
| ^~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:146:46: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
146 | import "DPI-C" function union_4_state_2 i_union_4_state_2();
| ^~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:147:46: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
147 | import "DPI-C" function union_4_state_8 i_union_4_state_8();
| ^~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:148:46: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
148 | import "DPI-C" function union_4_state_9 i_union_4_state_9();
| ^~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:149:46: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
149 | import "DPI-C" function union_4_state_16 i_union_4_state_16();
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:150:46: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
150 | import "DPI-C" function union_4_state_17 i_union_4_state_17();
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:151:46: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
151 | import "DPI-C" function union_4_state_32 i_union_4_state_32();
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:152:46: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
152 | import "DPI-C" function union_4_state_33 i_union_4_state_33();
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:153:46: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
153 | import "DPI-C" function union_4_state_64 i_union_4_state_64();
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:154:46: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
154 | import "DPI-C" function union_4_state_65 i_union_4_state_65();
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:155:46: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
155 | import "DPI-C" function union_4_state_128 i_union_4_state_128();
| ^~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:245:25: DPI function may not return a > 32 bits wide type other than basic types.
... Suggest make it an output argument instead?
245 | function bit [ 32:0] e_array_2_state_33(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:246:25: DPI function may not return a > 32 bits wide type other than basic types.
... Suggest make it an output argument instead?
246 | function bit [ 63:0] e_array_2_state_64(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:247:25: DPI function may not return a > 32 bits wide type other than basic types.
... Suggest make it an output argument instead?
247 | function bit [ 64:0] e_array_2_state_65(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:248:25: DPI function may not return a > 32 bits wide type other than basic types.
... Suggest make it an output argument instead?
248 | function bit [127:0] e_array_2_state_128(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:251:33: DPI function may not return a > 32 bits wide type other than basic types.
... Suggest make it an output argument instead?
251 | function array_2_state_33_t e_array_2_state_33_t(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:252:33: DPI function may not return a > 32 bits wide type other than basic types.
... Suggest make it an output argument instead?
252 | function array_2_state_64_t e_array_2_state_64_t(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:253:33: DPI function may not return a > 32 bits wide type other than basic types.
... Suggest make it an output argument instead?
253 | function array_2_state_65_t e_array_2_state_65_t(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:254:33: DPI function may not return a > 32 bits wide type other than basic types.
... Suggest make it an output argument instead?
254 | function array_2_state_128_t e_array_2_state_128_t(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:257:32: DPI function may not return a > 32 bits wide type other than basic types.
... Suggest make it an output argument instead?
257 | function struct_2_state_33 e_struct_2_state_33(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:258:32: DPI function may not return a > 32 bits wide type other than basic types.
... Suggest make it an output argument instead?
258 | function struct_2_state_64 e_struct_2_state_64(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:259:32: DPI function may not return a > 32 bits wide type other than basic types.
... Suggest make it an output argument instead?
259 | function struct_2_state_65 e_struct_2_state_65(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:260:32: DPI function may not return a > 32 bits wide type other than basic types.
... Suggest make it an output argument instead?
260 | function struct_2_state_128 e_struct_2_state_128(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:263:31: DPI function may not return a > 32 bits wide type other than basic types.
... Suggest make it an output argument instead?
263 | function union_2_state_33 e_union_2_state_33(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:264:31: DPI function may not return a > 32 bits wide type other than basic types.
... Suggest make it an output argument instead?
264 | function union_2_state_64 e_union_2_state_64(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:265:31: DPI function may not return a > 32 bits wide type other than basic types.
... Suggest make it an output argument instead?
265 | function union_2_state_65 e_union_2_state_65(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:266:31: DPI function may not return a > 32 bits wide type other than basic types.
... Suggest make it an output argument instead?
266 | function union_2_state_128 e_union_2_state_128(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:269:21: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
269 | function integer e_integer(); return 0; endfunction
| ^~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:272:27: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
272 | function logic [ 0:0] e_array_4_state_1(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:273:27: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
273 | function logic [ 1:0] e_array_4_state_2(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:274:27: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
274 | function logic [ 7:0] e_array_4_state_8(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:275:27: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
275 | function logic [ 8:0] e_array_4_state_9(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:276:27: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
276 | function logic [ 15:0] e_array_4_state_16(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:277:27: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
277 | function logic [ 16:0] e_array_4_state_17(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:278:27: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
278 | function logic [ 31:0] e_array_4_state_32(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:279:27: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
279 | function logic [ 32:0] e_array_4_state_33(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:280:27: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
280 | function logic [ 63:0] e_array_4_state_64(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:281:27: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
281 | function logic [ 64:0] e_array_4_state_65(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:282:27: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
282 | function logic [127:0] e_array_4_state_128(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:285:33: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
285 | function array_4_state_1_t e_array_4_state_1_t(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:286:33: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
286 | function array_4_state_2_t e_array_4_state_2_t(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:287:33: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
287 | function array_4_state_8_t e_array_4_state_8_t(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:288:33: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
288 | function array_4_state_9_t e_array_4_state_9_t(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:289:33: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
289 | function array_4_state_16_t e_array_4_state_16_t(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:290:33: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
290 | function array_4_state_17_t e_array_4_state_17_t(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:291:33: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
291 | function array_4_state_32_t e_array_4_state_32_t(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:292:33: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
292 | function array_4_state_33_t e_array_4_state_33_t(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:293:33: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
293 | function array_4_state_64_t e_array_4_state_64_t(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:294:33: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
294 | function array_4_state_65_t e_array_4_state_65_t(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:295:33: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
295 | function array_4_state_128_t e_array_4_state_128_t(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:298:32: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
298 | function struct_4_state_1 e_struct_4_state_1(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:299:32: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
299 | function struct_4_state_2 e_struct_4_state_2(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:300:32: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
300 | function struct_4_state_8 e_struct_4_state_8(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:301:32: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
301 | function struct_4_state_9 e_struct_4_state_9(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:302:32: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
302 | function struct_4_state_16 e_struct_4_state_16(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:303:32: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
303 | function struct_4_state_17 e_struct_4_state_17(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:304:32: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
304 | function struct_4_state_32 e_struct_4_state_32(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:305:32: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
305 | function struct_4_state_33 e_struct_4_state_33(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:306:32: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
306 | function struct_4_state_64 e_struct_4_state_64(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:307:32: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
307 | function struct_4_state_65 e_struct_4_state_65(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:308:32: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
308 | function struct_4_state_128 e_struct_4_state_128(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:311:31: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
311 | function union_4_state_1 e_union_4_state_1(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:312:31: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
312 | function union_4_state_2 e_union_4_state_2(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:313:31: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
313 | function union_4_state_8 e_union_4_state_8(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:314:31: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
314 | function union_4_state_9 e_union_4_state_9(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:315:31: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
315 | function union_4_state_16 e_union_4_state_16(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:316:31: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
316 | function union_4_state_17 e_union_4_state_17(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:317:31: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
317 | function union_4_state_32 e_union_4_state_32(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:318:31: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
318 | function union_4_state_33 e_union_4_state_33(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:319:31: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
319 | function union_4_state_64 e_union_4_state_64(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:320:31: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
320 | function union_4_state_65 e_union_4_state_65(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~
%Error: t/t_dpi_result_type_bad.v:321:31: DPI function may not return a 4-state type other than a single 'logic' (IEEE 1800-2017 35.5.5)
321 | function union_4_state_128 e_union_4_state_128(); return 0; endfunction
| ^~~~~~~~~~~~~~~~~~~
%Error: Exiting due to

View File

@ -2,8 +2,8 @@
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2003 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Copyright 2020 by Geza Lore. This program is free software; you can
# redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
@ -13,6 +13,7 @@ scenarios(linter => 1);
lint(
fails => 1,
expect_filename => $Self->{golden_filename},
verilator_flags2 => ["-Wall --error-limit 0"],
);
ok(1);

View File

@ -0,0 +1,322 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// Copyright 2020 by Geza Lore. This program is free software; you can
// redistribute it and/or modify it under the terms of either the GNU
// Lesser General Public License Version 3 or the Perl Artistic License
// Version 2.0.
// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
module t_dpi_result_type_bad;
// Illegal result types for DPI functions
//======================================================================
// Type definitions
//======================================================================
// 2-state packed arrays of width > 32
typedef bit [ 32:0] array_2_state_33_t;
typedef bit [ 63:0] array_2_state_64_t;
typedef bit [ 64:0] array_2_state_65_t;
typedef bit [127:0] array_2_state_128_t;
// 2-state packed structures of width > 32
typedef struct packed { bit [15:0] x; bit [16:0] y; } struct_2_state_33;
typedef struct packed { bit [31:0] x; bit [31:0] y; } struct_2_state_64;
typedef struct packed { bit [31:0] x; bit [32:0] y; } struct_2_state_65;
typedef struct packed { bit [63:0] x; bit [63:0] y; } struct_2_state_128;
// 2-state packed unions of width > 32
typedef union packed { bit [ 32:0] x; bit y; } union_2_state_33;
typedef union packed { bit [ 63:0] x; bit y; } union_2_state_64;
typedef union packed { bit [ 64:0] x; bit y; } union_2_state_65;
typedef union packed { bit [127:0] x; bit y; } union_2_state_128;
// 4-state packed arrays of any size
typedef logic [ 0:0] array_4_state_1_t;
typedef logic [ 1:0] array_4_state_2_t;
typedef logic [ 7:0] array_4_state_8_t;
typedef logic [ 8:0] array_4_state_9_t;
typedef logic [ 15:0] array_4_state_16_t;
typedef logic [ 16:0] array_4_state_17_t;
typedef logic [ 31:0] array_4_state_32_t;
typedef logic [ 32:0] array_4_state_33_t;
typedef logic [ 63:0] array_4_state_64_t;
typedef logic [ 64:0] array_4_state_65_t;
typedef logic [127:0] array_4_state_128_t;
// 4-state packed structures of any size
typedef struct packed { logic [ 0:0] x; } struct_4_state_1;
typedef struct packed { logic [ 0:0] x; bit [ 0:0] y; } struct_4_state_2;
typedef struct packed { logic [ 3:0] x; bit [ 3:0] y; } struct_4_state_8;
typedef struct packed { logic [ 3:0] x; bit [ 4:0] y; } struct_4_state_9;
typedef struct packed { logic [ 7:0] x; bit [ 7:0] y; } struct_4_state_16;
typedef struct packed { logic [ 7:0] x; bit [ 8:0] y; } struct_4_state_17;
typedef struct packed { logic [15:0] x; bit [15:0] y; } struct_4_state_32;
typedef struct packed { logic [15:0] x; bit [16:0] y; } struct_4_state_33;
typedef struct packed { logic [31:0] x; bit [31:0] y; } struct_4_state_64;
typedef struct packed { logic [31:0] x; bit [32:0] y; } struct_4_state_65;
typedef struct packed { logic [63:0] x; bit [63:0] y; } struct_4_state_128;
// 4-state packed unions of any size
typedef union packed { logic [ 0:0] x; bit y; } union_4_state_1;
typedef union packed { logic [ 1:0] x; bit y; } union_4_state_2;
typedef union packed { logic [ 7:0] x; bit y; } union_4_state_8;
typedef union packed { logic [ 8:0] x; bit y; } union_4_state_9;
typedef union packed { logic [ 15:0] x; bit y; } union_4_state_16;
typedef union packed { logic [ 16:0] x; bit y; } union_4_state_17;
typedef union packed { logic [ 31:0] x; bit y; } union_4_state_32;
typedef union packed { logic [ 32:0] x; bit y; } union_4_state_33;
typedef union packed { logic [ 63:0] x; bit y; } union_4_state_64;
typedef union packed { logic [ 64:0] x; bit y; } union_4_state_65;
typedef union packed { logic [127:0] x; bit y; } union_4_state_128;
//======================================================================
// Imports
//======================================================================
// 2-state packed arrays of width > 32
import "DPI-C" function bit [ 32:0] i_array_2_state_33();
import "DPI-C" function bit [ 63:0] i_array_2_state_64();
import "DPI-C" function bit [ 64:0] i_array_2_state_65();
import "DPI-C" function bit [127:0] i_array_2_state_128();
// 2-state packed arrays of width > 32 via typedef
import "DPI-C" function array_2_state_33_t i_array_2_state_33_t();
import "DPI-C" function array_2_state_64_t i_array_2_state_64_t();
import "DPI-C" function array_2_state_65_t i_array_2_state_65_t();
import "DPI-C" function array_2_state_128_t i_array_2_state_128_t();
// 2-state packed structures of width > 32
import "DPI-C" function struct_2_state_33 i_struct_2_state_33();
import "DPI-C" function struct_2_state_64 i_struct_2_state_64();
import "DPI-C" function struct_2_state_65 i_struct_2_state_65();
import "DPI-C" function struct_2_state_128 i_struct_2_state_128();
// 2-state packed unions of width > 32
import "DPI-C" function union_2_state_33 i_union_2_state_33();
import "DPI-C" function union_2_state_64 i_union_2_state_64();
import "DPI-C" function union_2_state_65 i_union_2_state_65();
import "DPI-C" function union_2_state_128 i_union_2_state_128();
// 4-state basic types
import "DPI-C" function integer i_integer();
// 4-state packed arrays of any size
import "DPI-C" function logic [ 0:0] i_array_4_state_1();
import "DPI-C" function logic [ 1:0] i_array_4_state_2();
import "DPI-C" function logic [ 7:0] i_array_4_state_8();
import "DPI-C" function logic [ 8:0] i_array_4_state_9();
import "DPI-C" function logic [ 15:0] i_array_4_state_16();
import "DPI-C" function logic [ 16:0] i_array_4_state_17();
import "DPI-C" function logic [ 31:0] i_array_4_state_32();
import "DPI-C" function logic [ 32:0] i_array_4_state_33();
import "DPI-C" function logic [ 63:0] i_array_4_state_64();
import "DPI-C" function logic [ 64:0] i_array_4_state_65();
import "DPI-C" function logic [127:0] i_array_4_state_128();
// 4-state packed arrays of any size via typedef
import "DPI-C" function array_4_state_1_t i_array_4_state_1_t();
import "DPI-C" function array_4_state_2_t i_array_4_state_2_t();
import "DPI-C" function array_4_state_8_t i_array_4_state_8_t();
import "DPI-C" function array_4_state_9_t i_array_4_state_9_t();
import "DPI-C" function array_4_state_16_t i_array_4_state_16_t();
import "DPI-C" function array_4_state_17_t i_array_4_state_17_t();
import "DPI-C" function array_4_state_32_t i_array_4_state_32_t();
import "DPI-C" function array_4_state_33_t i_array_4_state_33_t();
import "DPI-C" function array_4_state_64_t i_array_4_state_64_t();
import "DPI-C" function array_4_state_65_t i_array_4_state_65_t();
import "DPI-C" function array_4_state_128_t i_array_4_state_128_t();
// 4-state packed structures of any size
import "DPI-C" function struct_4_state_1 i_struct_4_state_1();
import "DPI-C" function struct_4_state_2 i_struct_4_state_2();
import "DPI-C" function struct_4_state_8 i_struct_4_state_8();
import "DPI-C" function struct_4_state_9 i_struct_4_state_9();
import "DPI-C" function struct_4_state_16 i_struct_4_state_16();
import "DPI-C" function struct_4_state_17 i_struct_4_state_17();
import "DPI-C" function struct_4_state_32 i_struct_4_state_32();
import "DPI-C" function struct_4_state_33 i_struct_4_state_33();
import "DPI-C" function struct_4_state_64 i_struct_4_state_64();
import "DPI-C" function struct_4_state_65 i_struct_4_state_65();
import "DPI-C" function struct_4_state_128 i_struct_4_state_128();
// 4-state packed unions of any size
import "DPI-C" function union_4_state_1 i_union_4_state_1();
import "DPI-C" function union_4_state_2 i_union_4_state_2();
import "DPI-C" function union_4_state_8 i_union_4_state_8();
import "DPI-C" function union_4_state_9 i_union_4_state_9();
import "DPI-C" function union_4_state_16 i_union_4_state_16();
import "DPI-C" function union_4_state_17 i_union_4_state_17();
import "DPI-C" function union_4_state_32 i_union_4_state_32();
import "DPI-C" function union_4_state_33 i_union_4_state_33();
import "DPI-C" function union_4_state_64 i_union_4_state_64();
import "DPI-C" function union_4_state_65 i_union_4_state_65();
import "DPI-C" function union_4_state_128 i_union_4_state_128();
//======================================================================
// Exports
//======================================================================
// 2-state packed arrays of width > 32
export "DPI-C" function e_array_2_state_33;
export "DPI-C" function e_array_2_state_64;
export "DPI-C" function e_array_2_state_65;
export "DPI-C" function e_array_2_state_128;
// 2-state packed arrays of width > 32 via typedef
export "DPI-C" function e_array_2_state_33_t;
export "DPI-C" function e_array_2_state_64_t;
export "DPI-C" function e_array_2_state_65_t;
export "DPI-C" function e_array_2_state_128_t;
// 2-state packed structures of width > 32
export "DPI-C" function e_struct_2_state_33;
export "DPI-C" function e_struct_2_state_64;
export "DPI-C" function e_struct_2_state_65;
export "DPI-C" function e_struct_2_state_128;
// 2-state packed unions of width > 32
export "DPI-C" function e_union_2_state_33;
export "DPI-C" function e_union_2_state_64;
export "DPI-C" function e_union_2_state_65;
export "DPI-C" function e_union_2_state_128;
// 4-state basic types
export "DPI-C" function e_integer;
// 4-state packed arrays of any size
export "DPI-C" function e_array_4_state_1;
export "DPI-C" function e_array_4_state_2;
export "DPI-C" function e_array_4_state_8;
export "DPI-C" function e_array_4_state_9;
export "DPI-C" function e_array_4_state_16;
export "DPI-C" function e_array_4_state_17;
export "DPI-C" function e_array_4_state_32;
export "DPI-C" function e_array_4_state_33;
export "DPI-C" function e_array_4_state_64;
export "DPI-C" function e_array_4_state_65;
export "DPI-C" function e_array_4_state_128;
// 4-state packed arrays of any size via typedef
export "DPI-C" function e_array_4_state_1_t;
export "DPI-C" function e_array_4_state_2_t;
export "DPI-C" function e_array_4_state_8_t;
export "DPI-C" function e_array_4_state_9_t;
export "DPI-C" function e_array_4_state_16_t;
export "DPI-C" function e_array_4_state_17_t;
export "DPI-C" function e_array_4_state_32_t;
export "DPI-C" function e_array_4_state_33_t;
export "DPI-C" function e_array_4_state_64_t;
export "DPI-C" function e_array_4_state_65_t;
export "DPI-C" function e_array_4_state_128_t;
// 4-state packed structures of any size
export "DPI-C" function e_struct_4_state_1;
export "DPI-C" function e_struct_4_state_2;
export "DPI-C" function e_struct_4_state_8;
export "DPI-C" function e_struct_4_state_9;
export "DPI-C" function e_struct_4_state_16;
export "DPI-C" function e_struct_4_state_17;
export "DPI-C" function e_struct_4_state_32;
export "DPI-C" function e_struct_4_state_33;
export "DPI-C" function e_struct_4_state_64;
export "DPI-C" function e_struct_4_state_65;
export "DPI-C" function e_struct_4_state_128;
// 4-state packed unions of any size
export "DPI-C" function e_union_4_state_1;
export "DPI-C" function e_union_4_state_2;
export "DPI-C" function e_union_4_state_8;
export "DPI-C" function e_union_4_state_9;
export "DPI-C" function e_union_4_state_16;
export "DPI-C" function e_union_4_state_17;
export "DPI-C" function e_union_4_state_32;
export "DPI-C" function e_union_4_state_33;
export "DPI-C" function e_union_4_state_64;
export "DPI-C" function e_union_4_state_65;
export "DPI-C" function e_union_4_state_128;
//======================================================================
// Definitions of exported functions
//======================================================================
// 2-state packed arrays of width > 32
function bit [ 32:0] e_array_2_state_33(); return 0; endfunction
function bit [ 63:0] e_array_2_state_64(); return 0; endfunction
function bit [ 64:0] e_array_2_state_65(); return 0; endfunction
function bit [127:0] e_array_2_state_128(); return 0; endfunction
// 2-state packed arrays of width > 32 via typedef
function array_2_state_33_t e_array_2_state_33_t(); return 0; endfunction
function array_2_state_64_t e_array_2_state_64_t(); return 0; endfunction
function array_2_state_65_t e_array_2_state_65_t(); return 0; endfunction
function array_2_state_128_t e_array_2_state_128_t(); return 0; endfunction
// 2-state packed structures of width > 32
function struct_2_state_33 e_struct_2_state_33(); return 0; endfunction
function struct_2_state_64 e_struct_2_state_64(); return 0; endfunction
function struct_2_state_65 e_struct_2_state_65(); return 0; endfunction
function struct_2_state_128 e_struct_2_state_128(); return 0; endfunction
// 2-state packed unions of width > 32
function union_2_state_33 e_union_2_state_33(); return 0; endfunction
function union_2_state_64 e_union_2_state_64(); return 0; endfunction
function union_2_state_65 e_union_2_state_65(); return 0; endfunction
function union_2_state_128 e_union_2_state_128(); return 0; endfunction
// 4-state basic types
function integer e_integer(); return 0; endfunction
// 4-state packed arrays of any size
function logic [ 0:0] e_array_4_state_1(); return 0; endfunction
function logic [ 1:0] e_array_4_state_2(); return 0; endfunction
function logic [ 7:0] e_array_4_state_8(); return 0; endfunction
function logic [ 8:0] e_array_4_state_9(); return 0; endfunction
function logic [ 15:0] e_array_4_state_16(); return 0; endfunction
function logic [ 16:0] e_array_4_state_17(); return 0; endfunction
function logic [ 31:0] e_array_4_state_32(); return 0; endfunction
function logic [ 32:0] e_array_4_state_33(); return 0; endfunction
function logic [ 63:0] e_array_4_state_64(); return 0; endfunction
function logic [ 64:0] e_array_4_state_65(); return 0; endfunction
function logic [127:0] e_array_4_state_128(); return 0; endfunction
// 4-state packed arrays of any size via typedef
function array_4_state_1_t e_array_4_state_1_t(); return 0; endfunction
function array_4_state_2_t e_array_4_state_2_t(); return 0; endfunction
function array_4_state_8_t e_array_4_state_8_t(); return 0; endfunction
function array_4_state_9_t e_array_4_state_9_t(); return 0; endfunction
function array_4_state_16_t e_array_4_state_16_t(); return 0; endfunction
function array_4_state_17_t e_array_4_state_17_t(); return 0; endfunction
function array_4_state_32_t e_array_4_state_32_t(); return 0; endfunction
function array_4_state_33_t e_array_4_state_33_t(); return 0; endfunction
function array_4_state_64_t e_array_4_state_64_t(); return 0; endfunction
function array_4_state_65_t e_array_4_state_65_t(); return 0; endfunction
function array_4_state_128_t e_array_4_state_128_t(); return 0; endfunction
// 4-state packed structures of any size
function struct_4_state_1 e_struct_4_state_1(); return 0; endfunction
function struct_4_state_2 e_struct_4_state_2(); return 0; endfunction
function struct_4_state_8 e_struct_4_state_8(); return 0; endfunction
function struct_4_state_9 e_struct_4_state_9(); return 0; endfunction
function struct_4_state_16 e_struct_4_state_16(); return 0; endfunction
function struct_4_state_17 e_struct_4_state_17(); return 0; endfunction
function struct_4_state_32 e_struct_4_state_32(); return 0; endfunction
function struct_4_state_33 e_struct_4_state_33(); return 0; endfunction
function struct_4_state_64 e_struct_4_state_64(); return 0; endfunction
function struct_4_state_65 e_struct_4_state_65(); return 0; endfunction
function struct_4_state_128 e_struct_4_state_128(); return 0; endfunction
// 4-state packed unions of any size
function union_4_state_1 e_union_4_state_1(); return 0; endfunction
function union_4_state_2 e_union_4_state_2(); return 0; endfunction
function union_4_state_8 e_union_4_state_8(); return 0; endfunction
function union_4_state_9 e_union_4_state_9(); return 0; endfunction
function union_4_state_16 e_union_4_state_16(); return 0; endfunction
function union_4_state_17 e_union_4_state_17(); return 0; endfunction
function union_4_state_32 e_union_4_state_32(); return 0; endfunction
function union_4_state_33 e_union_4_state_33(); return 0; endfunction
function union_4_state_64 e_union_4_state_64(); return 0; endfunction
function union_4_state_65 e_union_4_state_65(); return 0; endfunction
function union_4_state_128 e_union_4_state_128(); return 0; endfunction
endmodule

View File

@ -5,9 +5,6 @@
t/foo_not_needed
t/foo_not_needed.v
t/foo_not_needed.sv
obj_dir//foo_not_needed
obj_dir//foo_not_needed.v
obj_dir//foo_not_needed.sv
../include/foo_not_needed
../include/foo_not_needed.v
../include/foo_not_needed.sv

View File

@ -5,9 +5,6 @@
t/this_file_is_not_found.vh
t/this_file_is_not_found.vh.v
t/this_file_is_not_found.vh.sv
obj_dir//this_file_is_not_found.vh
obj_dir//this_file_is_not_found.vh.v
obj_dir//this_file_is_not_found.vh.sv
../include/this_file_is_not_found.vh
../include/this_file_is_not_found.vh.v
../include/this_file_is_not_found.vh.sv