diff --git a/Changes b/Changes index 9e2e16d38..1dd472ad8 100644 --- a/Changes +++ b/Changes @@ -7,6 +7,8 @@ indicates the contributor was also the author of the fix; Thanks! **** Fix error on enum references to other packages, bug339. [Alex Solomatnikov] +**** Fix DPI undeclared svBitVecVal compile error, bug346. [Chandan Egbert] + **** Fix CDCRSTLOGIC report showing endpoint flops without resets. **** Fix compiler warnings on SPARC, bug288. [Ahmed El-Mahmoudy] diff --git a/src/V3EmitC.cpp b/src/V3EmitC.cpp index a7eb1eec0..3c325dd1c 100644 --- a/src/V3EmitC.cpp +++ b/src/V3EmitC.cpp @@ -1792,14 +1792,17 @@ void EmitCImp::emitImp(AstNodeModule* modp) { puts("//############################################################\n"); puts("#sp implementation\n"); } + if (v3Global.dpi()) { + // do this before including our main .h file so that any references to + // types defined in svdpi.h are available + puts("#include \""+ topClassName() +"__Dpi.h\"\n"); + puts("\n"); + } ofp()->printf("#include \"%-20s // For This\n", (modClassName(modp)+".h\"").c_str()); // Us puts("#include \""+ symClassName() +".h\"\n"); - if (v3Global.dpi()) { - puts("#include \""+ topClassName() +"__Dpi.h\"\n"); - } if (optSystemPerl() && (splitFilenum() || !m_fast)) { puts("\n"); diff --git a/src/V3EmitCSyms.cpp b/src/V3EmitCSyms.cpp index fe966a993..997c0f8f9 100644 --- a/src/V3EmitCSyms.cpp +++ b/src/V3EmitCSyms.cpp @@ -519,6 +519,8 @@ void EmitCSyms::emitDpiHdr() { puts("// Manually include this file where DPI .c import functions are declared to insure\n"); puts("// the C functions match the expectations of the DPI imports.\n"); puts("\n"); + puts("#include \"svdpi.h\"\n"); + puts("\n"); puts("#ifdef __cplusplus\n"); puts("extern \"C\" {\n"); puts("#endif\n");