clang-format. No functional change.

This commit is contained in:
Wilson Snyder 2020-10-27 20:03:17 -04:00
parent 05ff96bea3
commit d44426b3f3
39 changed files with 256 additions and 258 deletions

View File

@ -1967,8 +1967,8 @@ private:
if (m_vup->prelim()) { if (m_vup->prelim()) {
nodep->dtypeFrom(vdtypep); nodep->dtypeFrom(vdtypep);
if (nodep->defaultp()) { if (nodep->defaultp()) {
iterateCheck(nodep, "default", nodep->defaultp(), CONTEXT, FINAL, vdtypep->subDTypep(), iterateCheck(nodep, "default", nodep->defaultp(), CONTEXT, FINAL,
EXTEND_EXP); vdtypep->subDTypep(), EXTEND_EXP);
} }
} }
} }
@ -3098,7 +3098,8 @@ private:
AstNode* valuep = patternMemberValueIterate(patp); AstNode* valuep = patternMemberValueIterate(patp);
if (VN_IS(arrayDtp, UnpackArrayDType)) { if (VN_IS(arrayDtp, UnpackArrayDType)) {
if (!newp) { if (!newp) {
AstInitArray* newap = new AstInitArray(nodep->fileline(), arrayDtp, nullptr); AstInitArray* newap
= new AstInitArray(nodep->fileline(), arrayDtp, nullptr);
newp = newap; newp = newap;
} }
VN_CAST(newp, InitArray)->addIndexValuep(ent - range.lo(), valuep); VN_CAST(newp, InitArray)->addIndexValuep(ent - range.lo(), valuep);

View File

@ -59,9 +59,7 @@ int main(int argc, char** argv, char** env) {
// Verilated::debug(1); // Verilated::debug(1);
#endif #endif
for (int seed = 123; seed < 133; ++seed) { for (int seed = 123; seed < 133; ++seed) oneTest(seed);
oneTest(seed);
}
return 0; return 0;
} }

View File

@ -69,9 +69,7 @@ void check_bvals(const svLogicVecVal* v, unsigned n) {
void set_bvals(svLogicVecVal* v, unsigned n); void set_bvals(svLogicVecVal* v, unsigned n);
void set_bvals(svLogicVecVal* v, unsigned n) { void set_bvals(svLogicVecVal* v, unsigned n) {
for (unsigned i = 0; i < n; i++) { for (unsigned i = 0; i < n; i++) v[i].bval = 0;
v[i].bval = 0;
}
} }
// Basic types as per IEEE 1800-2017 35.5.6 // Basic types as per IEEE 1800-2017 35.5.6

View File

@ -570,9 +570,7 @@ void i_union_4_state_128(CONSTARG svLogicVecVal* i) {
void set_bvals(svLogicVecVal* v, unsigned n); void set_bvals(svLogicVecVal* v, unsigned n);
void set_bvals(svLogicVecVal* v, unsigned n) { void set_bvals(svLogicVecVal* v, unsigned n) {
for (unsigned i = 0; i < n; i++) { for (unsigned i = 0; i < n; i++) v[i].bval = 0;
v[i].bval = 0;
}
} }
void check_exports() { void check_exports() {

View File

@ -53,9 +53,7 @@ typedef uint64_t sv_longint_unsigned_t;
void set_bvals(svLogicVecVal* v, unsigned n); void set_bvals(svLogicVecVal* v, unsigned n);
void set_bvals(svLogicVecVal* v, unsigned n) { void set_bvals(svLogicVecVal* v, unsigned n) {
for (unsigned i = 0; i < n; i++) { for (unsigned i = 0; i < n; i++) v[i].bval = 0;
v[i].bval = 0;
}
} }
// Basic types as per IEEE 1800-2017 35.5.6 // Basic types as per IEEE 1800-2017 35.5.6

View File

@ -35,10 +35,10 @@
#ifdef NEED_EXTERNS #ifdef NEED_EXTERNS
extern "C" { extern "C" {
extern int dpic_line(); extern int dpic_line();
extern int dpic_save(int value); extern int dpic_save(int value);
extern int dpic_restore(); extern int dpic_restore();
extern unsigned dpic_getcontext(); extern unsigned dpic_getcontext();
} }
#endif #endif
@ -94,7 +94,8 @@ int dpic_save(int value) {
int i; int i;
} vp; } vp;
vp.i = value; if (vp.i) { } vp.i = value;
if (vp.i) {}
if (svPutUserData(scope, &Dpic_Unique, vp.ptr)) { if (svPutUserData(scope, &Dpic_Unique, vp.ptr)) {
printf("%%Warning: svPutUserData failed\n"); printf("%%Warning: svPutUserData failed\n");
return 0; return 0;

View File

@ -27,7 +27,7 @@
#ifdef NEED_EXTERNS #ifdef NEED_EXTERNS
extern "C" { extern "C" {
extern void dpii_display_call(const char* c); extern void dpii_display_call(const char* c);
} }
#endif #endif

View File

@ -38,29 +38,29 @@
#ifdef NEED_EXTERNS #ifdef NEED_EXTERNS
extern "C" { extern "C" {
extern int dpix_run_tests(); extern int dpix_run_tests();
extern int dpix_t_int(int i, int* o); extern int dpix_t_int(int i, int* o);
extern int dpix_t_renamed(int i, int* o); extern int dpix_t_renamed(int i, int* o);
extern int dpix_int123(); extern int dpix_int123();
extern unsigned char dpix_f_bit(unsigned char i); extern unsigned char dpix_f_bit(unsigned char i);
extern svBitVecVal dpix_f_bit15(const svBitVecVal* i); extern svBitVecVal dpix_f_bit15(const svBitVecVal* i);
extern svBitVecVal dpix_f_bit48(const svBitVecVal* i); extern svBitVecVal dpix_f_bit48(const svBitVecVal* i);
extern int dpix_f_int(int i); extern int dpix_f_int(int i);
extern char dpix_f_byte(char i); extern char dpix_f_byte(char i);
extern short int dpix_f_shortint(short int i); extern short int dpix_f_shortint(short int i);
extern long long dpix_f_longint(long long i); extern long long dpix_f_longint(long long i);
extern void* dpix_f_chandle(void* i); extern void* dpix_f_chandle(void* i);
extern int dpix_sub_inst(int i); extern int dpix_sub_inst(int i);
extern void dpix_t_reg(svLogic i, svLogic* o); extern void dpix_t_reg(svLogic i, svLogic* o);
extern void dpix_t_reg15(const svLogicVecVal* i, svLogicVecVal* o); extern void dpix_t_reg15(const svLogicVecVal* i, svLogicVecVal* o);
extern void dpix_t_reg95(const svLogicVecVal* i, svLogicVecVal* o); extern void dpix_t_reg95(const svLogicVecVal* i, svLogicVecVal* o);
extern void dpix_t_integer(const svLogicVecVal* i, svLogicVecVal* o); extern void dpix_t_integer(const svLogicVecVal* i, svLogicVecVal* o);
extern void dpix_t_time(const svLogicVecVal* i, svLogicVecVal* o); extern void dpix_t_time(const svLogicVecVal* i, svLogicVecVal* o);
} }
#endif #endif
@ -115,10 +115,9 @@ int dpix_run_tests() {
#ifndef CADENCE // Unimplemented; how hard is it? #ifndef CADENCE // Unimplemented; how hard is it?
printf("svDpiVersion: %s\n", svDpiVersion()); printf("svDpiVersion: %s\n", svDpiVersion());
CHECK_RESULT(bool, CHECK_RESULT(
strcmp(svDpiVersion(), "1800-2005")==0 bool,
|| strcmp(svDpiVersion(), "P1800-2005")==0 strcmp(svDpiVersion(), "1800-2005") == 0 || strcmp(svDpiVersion(), "P1800-2005") == 0, 1);
, 1);
#endif #endif
CHECK_RESULT(int, dpix_int123(), 0x123); CHECK_RESULT(int, dpix_int123(), 0x123);
@ -173,7 +172,7 @@ int dpix_run_tests() {
CHECK_RESULT(int, o_vec96[2], ~i_vec96[2]); CHECK_RESULT(int, o_vec96[2], ~i_vec96[2]);
} }
extern void dpix_t_reg(svLogic i, svLogic* o); extern void dpix_t_reg(svLogic i, svLogic * o);
{ {
svLogic i = 0; svLogic i = 0;
svLogic o; svLogic o;

View File

@ -23,7 +23,7 @@
#ifdef NEED_EXTERNS #ifdef NEED_EXTERNS
extern "C" { extern "C" {
extern void dpix_task(); extern void dpix_task();
} }
#endif #endif

View File

@ -27,7 +27,7 @@
#ifdef NEED_EXTERNS #ifdef NEED_EXTERNS
extern "C" { extern "C" {
extern void dpi_genvarTest(); extern void dpi_genvarTest();
} }
#endif #endif

View File

@ -32,99 +32,101 @@ typedef struct {
#ifdef NEED_EXTERNS #ifdef NEED_EXTERNS
extern "C" { extern "C" {
// If get ncsim: *F,NOFDPI: Function {foo} not found in default libdpi. // If get ncsim: *F,NOFDPI: Function {foo} not found in default libdpi.
// Then probably forgot to list a function here. // Then probably forgot to list a function here.
extern unsigned char dpii_f_bit (unsigned char i); extern unsigned char dpii_f_bit(unsigned char i);
extern svBitVecVal dpii_f_bit8 (const svBitVecVal* i); extern svBitVecVal dpii_f_bit8(const svBitVecVal* i);
extern svBitVecVal dpii_f_bit9 (const svBitVecVal* i); extern svBitVecVal dpii_f_bit9(const svBitVecVal* i);
extern svBitVecVal dpii_f_bit16 (const svBitVecVal* i); extern svBitVecVal dpii_f_bit16(const svBitVecVal* i);
extern svBitVecVal dpii_f_bit17 (const svBitVecVal* i); extern svBitVecVal dpii_f_bit17(const svBitVecVal* i);
extern svBitVecVal dpii_f_bit32 (const svBitVecVal* i); extern svBitVecVal dpii_f_bit32(const svBitVecVal* i);
extern long long dpii_f_bit33 (const svBitVecVal* i); extern long long dpii_f_bit33(const svBitVecVal* i);
extern long long dpii_f_bit64 (const svBitVecVal* i); extern long long dpii_f_bit64(const svBitVecVal* i);
extern long long dpii_f_bit95 (const svBitVecVal* i, svBitVecVal* o); extern long long dpii_f_bit95(const svBitVecVal* i, svBitVecVal* o);
extern int dpii_f_int (int i); extern int dpii_f_int(int i);
extern char dpii_f_byte (char i); extern char dpii_f_byte(char i);
extern short int dpii_f_shortint(short int i); extern short int dpii_f_shortint(short int i);
extern long long dpii_f_longint (long long i); extern long long dpii_f_longint(long long i);
extern void* dpii_f_chandle (void* i); extern void* dpii_f_chandle(void* i);
extern const char* dpii_f_string (const char* i); extern const char* dpii_f_string(const char* i);
extern double dpii_f_real (double i); extern double dpii_f_real(double i);
extern float dpii_f_shortreal(float i); extern float dpii_f_shortreal(float i);
extern void dpii_v_bit (unsigned char i, unsigned char* o); extern void dpii_v_bit(unsigned char i, unsigned char* o);
extern void dpii_v_int (int i, int *o); extern void dpii_v_int(int i, int* o);
extern void dpii_v_uint (unsigned int i, unsigned int *o); extern void dpii_v_uint(unsigned int i, unsigned int* o);
extern void dpii_v_byte (char i, char *o); extern void dpii_v_byte(char i, char* o);
extern void dpii_v_shortint (short int i, short int *o); extern void dpii_v_shortint(short int i, short int* o);
extern void dpii_v_ushort (unsigned short i, unsigned short *o); extern void dpii_v_ushort(unsigned short i, unsigned short* o);
extern void dpii_v_longint (long long i, long long *o); extern void dpii_v_longint(long long i, long long* o);
extern void dpii_v_ulong (unsigned long long i, unsigned long long *o); extern void dpii_v_ulong(unsigned long long i, unsigned long long* o);
extern void dpii_v_struct (const svBitVecVal* i, svBitVecVal* o); extern void dpii_v_struct(const svBitVecVal* i, svBitVecVal* o);
extern void dpii_v_substruct (const svBitVecVal* i, int* o); extern void dpii_v_substruct(const svBitVecVal* i, int* o);
extern void dpii_v_chandle (void* i, void* *o); extern void dpii_v_chandle(void* i, void** o);
extern void dpii_v_string (const char* i, const char** o); extern void dpii_v_string(const char* i, const char** o);
extern void dpii_v_real (double i, double* o); extern void dpii_v_real(double i, double* o);
extern void dpii_v_shortreal(float i, float* o); extern void dpii_v_shortreal(float i, float* o);
extern void dpii_v_struct (const svBitVecVal* i, svBitVecVal* o); extern void dpii_v_struct(const svBitVecVal* i, svBitVecVal* o);
extern void dpii_v_substruct (const svBitVecVal* i, int* o); extern void dpii_v_substruct(const svBitVecVal* i, int* o);
extern void dpii_v_bit64(const svBitVecVal* i, svBitVecVal* o); extern void dpii_v_bit64(const svBitVecVal* i, svBitVecVal* o);
extern void dpii_v_bit95(const svBitVecVal* i, svBitVecVal* o); extern void dpii_v_bit95(const svBitVecVal* i, svBitVecVal* o);
extern void dpii_v_bit96(const svBitVecVal* i, svBitVecVal* o); extern void dpii_v_bit96(const svBitVecVal* i, svBitVecVal* o);
extern void dpii_v_reg(unsigned char i, unsigned char* o); extern void dpii_v_reg(unsigned char i, unsigned char* o);
extern void dpii_v_reg15(const svLogicVecVal* i, svLogicVecVal* o); extern void dpii_v_reg15(const svLogicVecVal* i, svLogicVecVal* o);
extern void dpii_v_reg95(const svLogicVecVal* i, svLogicVecVal* o); extern void dpii_v_reg95(const svLogicVecVal* i, svLogicVecVal* o);
extern void dpii_v_integer(const svLogicVecVal* i, svLogicVecVal* o); extern void dpii_v_integer(const svLogicVecVal* i, svLogicVecVal* o);
extern void dpii_v_time(const svLogicVecVal* i, svLogicVecVal* o); extern void dpii_v_time(const svLogicVecVal* i, svLogicVecVal* o);
extern int dpii_f_strlen(const char* i); extern int dpii_f_strlen(const char* i);
extern void dpii_f_void(); extern void dpii_f_void();
extern int dpii_t_void(); extern int dpii_t_void();
extern int dpii_t_void_context(); extern int dpii_t_void_context();
extern int dpii_t_int(int i, int *o); extern int dpii_t_int(int i, int* o);
extern int dpii_fa_bit(int i); extern int dpii_fa_bit(int i);
} }
#endif #endif
//====================================================================== //======================================================================
unsigned char dpii_f_bit (unsigned char i) { return 0x1 & ~i; } unsigned char dpii_f_bit(unsigned char i) { return 0x1 & ~i; }
svBitVecVal dpii_f_bit8 (const svBitVecVal *i) { return 0xffUL & ~*i; } svBitVecVal dpii_f_bit8(const svBitVecVal* i) { return 0xffUL & ~*i; }
svBitVecVal dpii_f_bit9 (const svBitVecVal *i) { return 0x1ffUL & ~*i; } svBitVecVal dpii_f_bit9(const svBitVecVal* i) { return 0x1ffUL & ~*i; }
svBitVecVal dpii_f_bit16(const svBitVecVal *i) { return 0xffffUL & ~*i; } svBitVecVal dpii_f_bit16(const svBitVecVal* i) { return 0xffffUL & ~*i; }
svBitVecVal dpii_f_bit17(const svBitVecVal *i) { return 0x1ffffUL & ~*i; } svBitVecVal dpii_f_bit17(const svBitVecVal* i) { return 0x1ffffUL & ~*i; }
svBitVecVal dpii_f_bit32(const svBitVecVal *i) { return ~*i; } svBitVecVal dpii_f_bit32(const svBitVecVal* i) { return ~*i; }
long long dpii_f_bit33(const svBitVecVal *i) { return ((1ULL<<33)-1) & ~((long long)(i[1])<<32ULL | i[0]); } long long dpii_f_bit33(const svBitVecVal* i) {
long long dpii_f_bit64(const svBitVecVal *i) { return ~((long long)(i[1])<<32ULL | i[0]); } return ((1ULL << 33) - 1) & ~((long long)(i[1]) << 32ULL | i[0]);
}
long long dpii_f_bit64(const svBitVecVal* i) { return ~((long long)(i[1]) << 32ULL | i[0]); }
int dpii_f_int (int i) { return ~i; } int dpii_f_int(int i) { return ~i; }
char dpii_f_byte (char i) { return ~i; } char dpii_f_byte(char i) { return ~i; }
short int dpii_f_shortint(short int i) { return ~i; } short int dpii_f_shortint(short int i) { return ~i; }
long long dpii_f_longint (long long i) { return ~i; } long long dpii_f_longint(long long i) { return ~i; }
void* dpii_f_chandle (void* i) { return i; } void* dpii_f_chandle(void* i) { return i; }
const char* dpii_f_string (const char* i) { return i; } const char* dpii_f_string(const char* i) { return i; }
double dpii_f_real (double i) { return i+1.5; } double dpii_f_real(double i) { return i + 1.5; }
float dpii_f_shortreal(float i) { return i+1.5f; } float dpii_f_shortreal(float i) { return i + 1.5f; }
void dpii_v_bit(unsigned char i, unsigned char *o) { *o = 1 & ~i; } void dpii_v_bit(unsigned char i, unsigned char* o) { *o = 1 & ~i; }
void dpii_v_int(int i, int *o) { *o = ~i; } void dpii_v_int(int i, int* o) { *o = ~i; }
void dpii_v_uint(unsigned int i, unsigned int *o) { *o = ~i; } void dpii_v_uint(unsigned int i, unsigned int* o) { *o = ~i; }
void dpii_v_byte(char i, char *o) { *o = ~i; } void dpii_v_byte(char i, char* o) { *o = ~i; }
void dpii_v_shortint(short int i, short int *o) { *o = ~i; } void dpii_v_shortint(short int i, short int* o) { *o = ~i; }
void dpii_v_ushort(unsigned short i, unsigned short *o) { *o = ~i; } void dpii_v_ushort(unsigned short i, unsigned short* o) { *o = ~i; }
void dpii_v_longint(long long i, long long *o) { *o = ~i; } void dpii_v_longint(long long i, long long* o) { *o = ~i; }
void dpii_v_ulong(unsigned long long i, unsigned long long *o) { *o = ~i; } void dpii_v_ulong(unsigned long long i, unsigned long long* o) { *o = ~i; }
void dpii_v_chandle(void* i, void* *o) { *o = i; } void dpii_v_chandle(void* i, void** o) { *o = i; }
void dpii_v_string(const char* i, const char** o) { *o = strdup(i); } // Leaks void dpii_v_string(const char* i, const char** o) { *o = strdup(i); } // Leaks
void dpii_v_real(double i, double* o) { *o = i + 1.5; } void dpii_v_real(double i, double* o) { *o = i + 1.5; }
void dpii_v_shortreal(float i, float* o) { *o = i + 1.5f; } void dpii_v_shortreal(float i, float* o) { *o = i + 1.5f; }
void dpii_v_reg(unsigned char i, unsigned char* o) { *o = (~i)&1; } void dpii_v_reg(unsigned char i, unsigned char* o) { *o = (~i) & 1; }
void dpii_v_reg15(const svLogicVecVal* i, svLogicVecVal* o) { void dpii_v_reg15(const svLogicVecVal* i, svLogicVecVal* o) {
o[0].aval = (~i[0].aval) & 0x7fffUL; o[0].aval = (~i[0].aval) & 0x7fffUL;
o[0].bval = 0; o[0].bval = 0;

View File

@ -28,11 +28,11 @@
#ifdef NEED_EXTERNS #ifdef NEED_EXTERNS
extern "C" { extern "C" {
// If get ncsim: *F,NOFDPI: Function {foo} not found in default libdpi. // If get ncsim: *F,NOFDPI: Function {foo} not found in default libdpi.
// Then probably forgot to list a function here. // Then probably forgot to list a function here.
extern int dpii_failure(); extern int dpii_failure();
extern void dpii_check(); extern void dpii_check();
} }
#endif #endif

View File

@ -30,28 +30,37 @@
#ifdef NEED_EXTERNS #ifdef NEED_EXTERNS
extern "C" { extern "C" {
// If get ncsim: *F,NOFDPI: Function {foo} not found in default libdpi. // If get ncsim: *F,NOFDPI: Function {foo} not found in default libdpi.
// Then probably forgot to list a function here. // Then probably forgot to list a function here.
extern void dpii_unused(const svOpenArrayHandle u); extern void dpii_unused(const svOpenArrayHandle u);
extern void dpii_open_p0_u1(int c, int p, int u, const svOpenArrayHandle i, const svOpenArrayHandle o); extern void dpii_open_p0_u1(int c, int p, int u, const svOpenArrayHandle i,
extern void dpii_open_p1_u0(int c, int p, int u, const svOpenArrayHandle i, const svOpenArrayHandle o); const svOpenArrayHandle o);
extern void dpii_open_p1_u1(int c, int p, int u, const svOpenArrayHandle i, const svOpenArrayHandle o); extern void dpii_open_p1_u0(int c, int p, int u, const svOpenArrayHandle i,
extern void dpii_open_p1_u2(int c, int p, int u, const svOpenArrayHandle i, const svOpenArrayHandle o); const svOpenArrayHandle o);
extern void dpii_open_p1_u3(int c, int p, int u, const svOpenArrayHandle i, const svOpenArrayHandle o); extern void dpii_open_p1_u1(int c, int p, int u, const svOpenArrayHandle i,
extern void dpii_open_pw_u0(int c, int p, int u, const svOpenArrayHandle i, const svOpenArrayHandle o); const svOpenArrayHandle o);
extern void dpii_open_pw_u1(int c, int p, int u, const svOpenArrayHandle i, const svOpenArrayHandle o); extern void dpii_open_p1_u2(int c, int p, int u, const svOpenArrayHandle i,
extern void dpii_open_pw_u2(int c, int p, int u, const svOpenArrayHandle i, const svOpenArrayHandle o); const svOpenArrayHandle o);
extern void dpii_open_pw_u3(int c, int p, int u, const svOpenArrayHandle i, const svOpenArrayHandle o); extern void dpii_open_p1_u3(int c, int p, int u, const svOpenArrayHandle i,
const svOpenArrayHandle o);
extern void dpii_open_pw_u0(int c, int p, int u, const svOpenArrayHandle i,
const svOpenArrayHandle o);
extern void dpii_open_pw_u1(int c, int p, int u, const svOpenArrayHandle i,
const svOpenArrayHandle o);
extern void dpii_open_pw_u2(int c, int p, int u, const svOpenArrayHandle i,
const svOpenArrayHandle o);
extern void dpii_open_pw_u3(int c, int p, int u, const svOpenArrayHandle i,
const svOpenArrayHandle o);
extern void dpii_open_bit(const svOpenArrayHandle i, const svOpenArrayHandle o); extern void dpii_open_bit(const svOpenArrayHandle i, const svOpenArrayHandle o);
extern void dpii_open_byte(const svOpenArrayHandle i, const svOpenArrayHandle o); extern void dpii_open_byte(const svOpenArrayHandle i, const svOpenArrayHandle o);
extern void dpii_open_int(const svOpenArrayHandle i, const svOpenArrayHandle o); extern void dpii_open_int(const svOpenArrayHandle i, const svOpenArrayHandle o);
extern void dpii_open_integer(const svOpenArrayHandle i, const svOpenArrayHandle o); extern void dpii_open_integer(const svOpenArrayHandle i, const svOpenArrayHandle o);
extern void dpii_open_logic(const svOpenArrayHandle i, const svOpenArrayHandle o); extern void dpii_open_logic(const svOpenArrayHandle i, const svOpenArrayHandle o);
extern int dpii_failure(); extern int dpii_failure();
} }
#endif #endif
@ -109,7 +118,7 @@ void dpii_unused(const svOpenArrayHandle u) {}
void _dpii_all(int c, int p, int u, const svOpenArrayHandle i, const svOpenArrayHandle o) { void _dpii_all(int c, int p, int u, const svOpenArrayHandle i, const svOpenArrayHandle o) {
#ifdef TEST_VERBOSE #ifdef TEST_VERBOSE
printf("-:%s:%d: For case c=%d p=%d u=%d data=%p\n", printf("-:%s:%d: For case c=%d p=%d u=%d data=%p\n", //
__FILE__, __LINE__, c, p, u, svGetArrayPtr(i)); __FILE__, __LINE__, c, p, u, svGetArrayPtr(i));
#endif #endif
(void)svGetArrayPtr(i); (void)svGetArrayPtr(i);
@ -238,23 +247,23 @@ void dpii_open_bit(const svOpenArrayHandle i, const svOpenArrayHandle o) {}
void dpii_open_byte(const svOpenArrayHandle i, const svOpenArrayHandle o) { void dpii_open_byte(const svOpenArrayHandle i, const svOpenArrayHandle o) {
intptr_t arrPtr = (intptr_t)svGetArrayPtr(i); intptr_t arrPtr = (intptr_t)svGetArrayPtr(i);
CHECK_RESULT_HEX_NE(arrPtr, 0); // All the arrays should actually exist CHECK_RESULT_HEX_NE(arrPtr, 0); // All the arrays should actually exist
#ifndef NC #ifndef NC
// NC always returns zero and warns // NC always returns zero and warns
int sizeInputOfArray = svSizeOfArray(i); int sizeInputOfArray = svSizeOfArray(i);
CHECK_RESULT_HEX_NE(sizeInputOfArray, 0); // None of the test cases have zero size CHECK_RESULT_HEX_NE(sizeInputOfArray, 0); // None of the test cases have zero size
CHECK_RESULT_HEX_NE(svDimensions(i), 0); // All the test cases are unpacked arrays CHECK_RESULT_HEX_NE(svDimensions(i), 0); // All the test cases are unpacked arrays
#endif #endif
} }
void dpii_open_int(const svOpenArrayHandle i, const svOpenArrayHandle o) { void dpii_open_int(const svOpenArrayHandle i, const svOpenArrayHandle o) {
intptr_t arrPtr = (intptr_t)svGetArrayPtr(i); intptr_t arrPtr = (intptr_t)svGetArrayPtr(i);
CHECK_RESULT_HEX_NE(arrPtr, 0); // All the arrays should actually exist CHECK_RESULT_HEX_NE(arrPtr, 0); // All the arrays should actually exist
#ifndef NC #ifndef NC
// NC always returns zero and warns // NC always returns zero and warns
int sizeInputOfArray = svSizeOfArray(i); int sizeInputOfArray = svSizeOfArray(i);
CHECK_RESULT_HEX_NE(sizeInputOfArray, 0); // None of the test cases have zero size CHECK_RESULT_HEX_NE(sizeInputOfArray, 0); // None of the test cases have zero size
CHECK_RESULT_HEX_NE(svDimensions(i), 0); // All the test cases are unpacked arrays CHECK_RESULT_HEX_NE(svDimensions(i), 0); // All the test cases are unpacked arrays
#endif #endif
} }

View File

@ -28,11 +28,11 @@
#ifdef NEED_EXTERNS #ifdef NEED_EXTERNS
extern "C" { extern "C" {
// If get ncsim: *F,NOFDPI: Function {foo} not found in default libdpi. // If get ncsim: *F,NOFDPI: Function {foo} not found in default libdpi.
// Then probably forgot to list a function here. // Then probably forgot to list a function here.
extern int dpii_failure(); extern int dpii_failure();
extern void dpii_open_i(const svOpenArrayHandle i, const svOpenArrayHandle o); extern void dpii_open_i(const svOpenArrayHandle i, const svOpenArrayHandle o);
} }
#endif #endif

View File

@ -33,11 +33,11 @@
#ifdef NEED_EXTERNS #ifdef NEED_EXTERNS
extern "C" { extern "C" {
extern int dpii_clear(); extern int dpii_clear();
extern int dpii_count(int idx); extern int dpii_count(int idx);
extern unsigned char dpii_inc0(int idx); extern unsigned char dpii_inc0(int idx);
extern unsigned char dpii_inc1(int idx); extern unsigned char dpii_inc1(int idx);
extern unsigned char dpii_incx(int idx, unsigned char value); extern unsigned char dpii_incx(int idx, unsigned char value);
} }
#endif #endif
@ -50,9 +50,7 @@ int dpii_clear() {
for (int i = 0; i < COUNTERS; ++i) global_count[i] = 0; for (int i = 0; i < COUNTERS; ++i) global_count[i] = 0;
return 0; return 0;
} }
int dpii_count(int idx) { int dpii_count(int idx) { return (idx >= 0 && idx < COUNTERS) ? global_count[idx] : -1; }
return (idx >= 0 && idx < COUNTERS) ? global_count[idx] : -1;
}
unsigned char dpii_incx(int idx, unsigned char value) { unsigned char dpii_incx(int idx, unsigned char value) {
if (idx >= 0 && idx < COUNTERS) global_count[idx]++; if (idx >= 0 && idx < COUNTERS) global_count[idx]++;
return value; return value;

View File

@ -28,14 +28,13 @@
#ifdef NEED_EXTERNS #ifdef NEED_EXTERNS
extern "C" { extern "C" {
extern int dpii_string(const char* s); extern int dpii_string(const char* s);
} }
#endif #endif
//====================================================================== //======================================================================
int dpii_string(const char* s) { int dpii_string(const char* s) {
printf("dpii_string: %s\n",s); printf("dpii_string: %s\n", s);
return strlen(s); return strlen(s);
} }

View File

@ -27,9 +27,8 @@
#ifdef NEED_EXTERNS #ifdef NEED_EXTERNS
extern "C" { extern "C" {
extern void dpii_sys_task(int i); extern void dpii_sys_task(int i);
extern int dpii_sys_func(int i); extern int dpii_sys_func(int i);
} }
#endif #endif

View File

@ -33,8 +33,8 @@
#ifdef NEED_EXTERNS #ifdef NEED_EXTERNS
extern "C" { extern "C" {
extern void dpii_sys_task(); extern void dpii_sys_task();
extern int dpii_failure(); extern int dpii_failure();
} }
#endif #endif
@ -57,7 +57,8 @@ void dpii_sys_task() {
st.failure = 1; st.failure = 1;
std::cerr << "t_dpi_threads_c.cpp dpii_sys_task() saw threads collide.\n"; std::cerr << "t_dpi_threads_c.cpp dpii_sys_task() saw threads collide.\n";
} else { } else {
std::cerr << "t_dpi_threads_c.cpp dpii_sys_task() no collision. @" << &st.task_is_running << "\n"; std::cerr << "t_dpi_threads_c.cpp dpii_sys_task() no collision. @" << &st.task_is_running
<< "\n";
} }
// Spend some time in the DPI call, so that if we can have a collision // Spend some time in the DPI call, so that if we can have a collision

View File

@ -23,13 +23,11 @@
#ifdef NEED_EXTERNS #ifdef NEED_EXTERNS
extern "C" { extern "C" {
extern void dpii_call(double in, double* outp); extern void dpii_call(double in, double* outp);
} }
#endif #endif
void dpii_call(double in, double* outp) { void dpii_call(double in, double* outp) { *outp = in + 0.1; }
*outp = in + 0.1;
}
//====================================================================== //======================================================================
unsigned int main_time = 0; unsigned int main_time = 0;

View File

@ -30,10 +30,10 @@
#ifdef NEED_EXTERNS #ifdef NEED_EXTERNS
extern "C" { extern "C" {
extern void t_embed_child_initial(); extern void t_embed_child_initial();
extern void t_embed_child_final(); extern void t_embed_child_final();
extern void t_embed_child_eval(); extern void t_embed_child_eval();
extern void t_embed_child_io_eval(); // TODO real function params here extern void t_embed_child_io_eval(); // TODO real function params here
} }
#endif #endif
@ -91,9 +91,8 @@ void t_embed_child_io_eval(unsigned char clk,
unsigned char* did_init_out) { unsigned char* did_init_out) {
VL_DEBUG_IF(VL_PRINTF(" t_embed1_child_io_eval\n");); VL_DEBUG_IF(VL_PRINTF(" t_embed1_child_io_eval\n"););
Vt_embed1_child* __modelp = __get_modelp(); Vt_embed1_child* __modelp = __get_modelp();
VL_DEBUG_IF(VL_PRINTF("[%0ld] in clk=%x b=%x V=%x R=%x\n", VL_DEBUG_IF(VL_PRINTF("[%0ld] in clk=%x b=%x V=%x R=%x\n", //
(long int) (VL_TIME_Q()), clk, bit_in, vec_in[0], (long int)(VL_TIME_Q()), clk, bit_in, vec_in[0], is_ref););
is_ref););
__modelp->clk = clk; __modelp->clk = clk;
__modelp->bit_in = bit_in; __modelp->bit_in = bit_in;
__modelp->vec_in = vec_in[0]; __modelp->vec_in = vec_in[0];
@ -114,7 +113,6 @@ void t_embed_child_io_eval(unsigned char clk,
wide_out[2] = __modelp->wide_out[2]; wide_out[2] = __modelp->wide_out[2];
wide_out[3] = __modelp->wide_out[3]; wide_out[3] = __modelp->wide_out[3];
*did_init_out = __modelp->did_init_out; *did_init_out = __modelp->did_init_out;
VL_DEBUG_IF(VL_PRINTF("[%0ld] out b=%x V=%x DI=%x\n", VL_DEBUG_IF(VL_PRINTF("[%0ld] out b=%x V=%x DI=%x\n", //
(long int)(VL_TIME_Q()), *bit_out, *vec_out, (long int)(VL_TIME_Q()), *bit_out, *vec_out, *did_init_out););
*did_init_out););
} }

View File

@ -21,7 +21,7 @@ int main(int argc, char* argv[]) {
if (Vt_enum_public_p3::ZERO == Vt_enum_public_p3::ONE) {} if (Vt_enum_public_p3::ZERO == Vt_enum_public_p3::ONE) {}
if (Vt_enum_public_p62::ZERO == Vt_enum_public_p62::ALLONE) {} if (Vt_enum_public_p62::ZERO == Vt_enum_public_p62::ALLONE) {}
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { //
topp->eval(); topp->eval();
} }
} }

View File

@ -9,9 +9,6 @@
// //
//************************************************************************* //*************************************************************************
extern "C" int dpi_export_func(int); extern "C" int dpi_export_func(int);
extern "C" int dpi_import_func(int v) { extern "C" int dpi_import_func(int v) { return dpi_export_func(v) - 1; }
return dpi_export_func(v) - 1;
}

View File

@ -65,7 +65,7 @@ int main(int argc, char* argv[]) {
vluint64_t firstUsage = get_memory_usage(); vluint64_t firstUsage = get_memory_usage();
// Warmup phase // Warmup phase
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { //
make_and_destroy(); make_and_destroy();
} }
firstUsage = get_memory_usage(); firstUsage = get_memory_usage();
@ -73,14 +73,15 @@ int main(int argc, char* argv[]) {
int loops = 10; int loops = 10;
for (int left = loops; left > 0;) { for (int left = loops; left > 0;) {
for (int j = 0; j < 1; ++j, --left) { for (int j = 0; j < 1; ++j, --left) { //
make_and_destroy(); make_and_destroy();
} }
} }
vluint64_t leaked = get_memory_usage() - firstUsage; vluint64_t leaked = get_memory_usage() - firstUsage;
if (leaked > 64*1024) { // Have to allow some slop for this code. if (leaked > 64*1024) { // Have to allow some slop for this code.
printf("Leaked %" VL_PRI64 "d bytes, or ~ %" VL_PRI64 "d bytes/construt\n", leaked, leaked/loops); printf("Leaked %" VL_PRI64 "d bytes, or ~ %" VL_PRI64 "d bytes/construt\n", //
leaked, leaked / loops);
vl_fatal(__FILE__, __LINE__, "top", "Leaked memory\n"); vl_fatal(__FILE__, __LINE__, "top", "Leaked memory\n");
} }

View File

@ -8,8 +8,7 @@
QData MaskVal(int lbit, int hbit) { QData MaskVal(int lbit, int hbit) {
QData val; QData val;
for (val = 0; lbit <= hbit; lbit++) for (val = 0; lbit <= hbit; lbit++) val |= (1ULL << lbit);
val |= (1ULL << lbit);
return val; return val;
} }
@ -35,12 +34,12 @@ int main(int argc, char* argv[]) {
| MaskVal(sim->LowMaskSel_Bot, sim->HighMaskSel_Bot)); | MaskVal(sim->LowMaskSel_Bot, sim->HighMaskSel_Bot));
if (sim->LogicImm != expected) { if (sim->LogicImm != expected) {
printf("%%Error: %d.%d,%d.%d -> %016" VL_PRI64 "x/%016" VL_PRI64 "x -> %016" VL_PRI64 "x (expected %016" VL_PRI64 "x)\n", printf("%%Error: %d.%d,%d.%d -> %016" VL_PRI64 "x/%016" VL_PRI64
sim->LowMaskSel_Top, sim->HighMaskSel_Top, "x -> %016" VL_PRI64 "x (expected %016" VL_PRI64 "x)\n",
sim->LowMaskSel_Bot, sim->HighMaskSel_Bot, sim->LowMaskSel_Top, sim->HighMaskSel_Top, sim->LowMaskSel_Bot,
sim->LowLogicImm, sim->HighLogicImm, sim->HighMaskSel_Bot, sim->LowLogicImm, sim->HighLogicImm, sim->LogicImm,
sim->LogicImm, expected); expected);
errs=1; errs = 1;
} }
} }
} }

View File

@ -61,9 +61,7 @@ int main()
ASSIGN(i3, 13); ASSIGN(i3, 13);
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
ASSIGN(i34[i], i); ASSIGN(i34[i], i);
for (int j = 0; j < 5; j++) { for (int j = 0; j < 5; j++) ASSIGN(i345[i][j], i * 8 + j);
ASSIGN(i345[i][j], i * 8 + j);
}
} }
#ifdef SYSTEMC_VERSION #ifdef SYSTEMC_VERSION
@ -75,9 +73,7 @@ int main()
check("o3", READ(o3), 13); check("o3", READ(o3), 13);
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
check("o34", READ(o34[i]), i); check("o34", READ(o34[i]), i);
for (int j = 0; j < 5; j++) { for (int j = 0; j < 5; j++) check("o345", READ(o345[i][j]), i * 8 + j);
check("o345", READ(o345[i][j]), i * 8 + j);
}
} }
if (pass) { if (pass) {

View File

@ -52,7 +52,8 @@ int main(int argc, char* argv[]) {
StepSim(sim, slot, bit, 0, 0); StepSim(sim, slot, bit, 0, 0);
printf("\nTesting\n"); printf("\nTesting\n");
for (i = 0; i < 100; i++) for (i = 0; i < 100; i++) //
StepSim(sim, random() % 3, random() % 2, random() % 2, random() % 3); StepSim(sim, random() % 3, random() % 2, random() % 2, random() % 3);
printf("*-* All Finished *-*\n"); printf("*-* All Finished *-*\n");
} }

View File

@ -51,8 +51,9 @@ int main() {
vcore->i_clk_wr = 0; vcore->i_clk_wr = 0;
vcore->i_clk_rd = 0; vcore->i_clk_rd = 0;
for (int i = 0; i < 256; ++i) for (int i = 0; i < 256; ++i) { //
cycle(); cycle();
}
vcd->close(); vcd->close();
printf("*-* All Finished *-*\n"); printf("*-* All Finished *-*\n");

View File

@ -23,7 +23,7 @@ int main(int argc, char* argv[]) {
} }
if (static_cast<int>(Vt_param_public_p::INPACK) != 0) {} if (static_cast<int>(Vt_param_public_p::INPACK) != 0) {}
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { //
topp->eval(); topp->eval();
} }
} }

View File

@ -10,14 +10,12 @@ VM_PREFIX* tb = nullptr;
int sc_main(int argc, char* argv[]) { int sc_main(int argc, char* argv[]) {
tb = new VM_PREFIX("tb"); tb = new VM_PREFIX("tb");
std::vector < sc_object* > ch = tb->get_child_objects(); std::vector<sc_object*> ch = tb->get_child_objects();
bool found = false; bool found = false;
/* We expect to find clk in here. */ /* We expect to find clk in here. */
for (int i = 0; i < ch.size(); ++i) { for (int i = 0; i < ch.size(); ++i) {
if (!strcmp(ch[i]->basename(), "clk")) { if (!strcmp(ch[i]->basename(), "clk")) found = true;
found = true;
}
} }
if (found) { if (found) {

View File

@ -34,9 +34,9 @@ void check(int d, int en, int exp0, int exp1, int expx, int expz) {
int main() { int main() {
Verilated::debug(0); Verilated::debug(0);
tb = new Vt_tri_inz("tb"); tb = new Vt_tri_inz("tb");
check(0, 1, 1,0,0,0); check(0, 1, 1, 0, 0, 0);
check(1, 1, 0,1,0,0); check(1, 1, 0, 1, 0, 0);
check(0, 0, 0,0,0,1); check(0, 0, 0, 0, 0, 1);
if (pass) { if (pass) {
VL_PRINTF("*-* All Finished *-*\n"); VL_PRINTF("*-* All Finished *-*\n");

View File

@ -17,11 +17,9 @@
//====================================================================== //======================================================================
extern "C" { extern "C" {
extern void dpii_test(); extern void dpii_test();
} }
//====================================================================== //======================================================================
void dpii_test() { void dpii_test() { vpi_control(vpiFinish); }
vpi_control(vpiFinish);
}

View File

@ -224,8 +224,7 @@ static s_vpi_systf_data vpi_systf_data[] = {{vpiSysFunc, vpiIntFunc, (PLI_BYTE8*
void vpi_compat_bootstrap(void) { void vpi_compat_bootstrap(void) {
p_vpi_systf_data systf_data_p; p_vpi_systf_data systf_data_p;
systf_data_p = &(vpi_systf_data[0]); systf_data_p = &(vpi_systf_data[0]);
while (systf_data_p->type != 0) while (systf_data_p->type != 0) vpi_register_systf(systf_data_p++);
vpi_register_systf(systf_data_p++);
} }
// icarus entry // icarus entry

View File

@ -211,8 +211,7 @@ static s_vpi_systf_data vpi_systf_data[] = {{vpiSysFunc, vpiIntFunc, (PLI_BYTE8*
void vpi_compat_bootstrap(void) { void vpi_compat_bootstrap(void) {
p_vpi_systf_data systf_data_p; p_vpi_systf_data systf_data_p;
systf_data_p = &(vpi_systf_data[0]); systf_data_p = &(vpi_systf_data[0]);
while (systf_data_p->type != 0) while (systf_data_p->type != 0) vpi_register_systf(systf_data_p++);
vpi_register_systf(systf_data_p++);
} }
// icarus entry // icarus entry

View File

@ -117,8 +117,7 @@ static s_vpi_systf_data vpi_systf_data[] = {{vpiSysFunc, vpiIntFunc, (PLI_BYTE8*
void vpi_compat_bootstrap(void) { void vpi_compat_bootstrap(void) {
p_vpi_systf_data systf_data_p; p_vpi_systf_data systf_data_p;
systf_data_p = &(vpi_systf_data[0]); systf_data_p = &(vpi_systf_data[0]);
while (systf_data_p->type != 0) while (systf_data_p->type != 0) vpi_register_systf(systf_data_p++);
vpi_register_systf(systf_data_p++);
} }
// icarus entry // icarus entry

View File

@ -80,7 +80,6 @@ unsigned int main_time = 0;
#define CHECK_RESULT_CSTR_STRIP(got, exp) CHECK_RESULT_CSTR(got + strspn(got, " "), exp) #define CHECK_RESULT_CSTR_STRIP(got, exp) CHECK_RESULT_CSTR(got + strspn(got, " "), exp)
int check_param_int(std::string name, PLI_INT32 format, int exp_value, bool verbose) { int check_param_int(std::string name, PLI_INT32 format, int exp_value, bool verbose) {
int vpi_type; int vpi_type;
TestVpiHandle param_h; TestVpiHandle param_h;
@ -95,7 +94,9 @@ int check_param_int(std::string name, PLI_INT32 format, int exp_value, bool verb
CHECK_RESULT_NZ(param_h); CHECK_RESULT_NZ(param_h);
vpi_type = vpi_get(vpiType, param_h); vpi_type = vpi_get(vpiType, param_h);
CHECK_RESULT(vpi_type, vpiParameter); CHECK_RESULT(vpi_type, vpiParameter);
if (verbose) {vpi_printf((PLI_BYTE8*)" vpiType: %s (%d)\n", vpi_get_str(vpiType, param_h), vpi_type); } if (verbose) {
vpi_printf((PLI_BYTE8*)" vpiType: %s (%d)\n", vpi_get_str(vpiType, param_h), vpi_type);
}
// attributes // attributes
p = vpi_get_str(vpiName, param_h); p = vpi_get_str(vpiName, param_h);
@ -106,20 +107,28 @@ int check_param_int(std::string name, PLI_INT32 format, int exp_value, bool verb
CHECK_RESULT_CSTR(p, "vpiParameter"); CHECK_RESULT_CSTR(p, "vpiParameter");
vpi_type = vpi_get(vpiLocalParam, param_h); vpi_type = vpi_get(vpiLocalParam, param_h);
CHECK_RESULT_NZ(vpi_chk_error(&e)); CHECK_RESULT_NZ(vpi_chk_error(&e));
if (verbose && vpi_chk_error(&e)) {vpi_printf((PLI_BYTE8*)" vpi_chk_error: %s\n", e.message); } if (verbose && vpi_chk_error(&e)) {
vpi_printf((PLI_BYTE8*)" vpi_chk_error: %s\n", e.message);
}
// values // values
if (verbose) {vpi_printf((PLI_BYTE8*)" Try writing value to %s ...\n", name.c_str()); } if (verbose) { vpi_printf((PLI_BYTE8*)" Try writing value to %s ...\n", name.c_str()); }
value.value.integer = exp_value; value.value.integer = exp_value;
vpi_put_value(param_h, &value, NULL, vpiNoDelay); vpi_put_value(param_h, &value, NULL, vpiNoDelay);
CHECK_RESULT_NZ(vpi_chk_error(&e)); CHECK_RESULT_NZ(vpi_chk_error(&e));
if (verbose && vpi_chk_error(&e)) {vpi_printf((PLI_BYTE8*)" vpi_chk_error: %s\n", e.message); } if (verbose && vpi_chk_error(&e)) {
vpi_printf((PLI_BYTE8*)" vpi_chk_error: %s\n", e.message);
}
if (verbose) {vpi_printf((PLI_BYTE8*)" Try reading value of %s ...\n", name.c_str()); } if (verbose) { vpi_printf((PLI_BYTE8*)" Try reading value of %s ...\n", name.c_str()); }
vpi_get_value(param_h, &value); vpi_get_value(param_h, &value);
CHECK_RESULT_NZ(!vpi_chk_error(&e)); CHECK_RESULT_NZ(!vpi_chk_error(&e));
if (verbose && vpi_chk_error(&e)) {vpi_printf((PLI_BYTE8*)" vpi_chk_error: %s\n", e.message); } if (verbose && vpi_chk_error(&e)) {
if (verbose) {vpi_printf((PLI_BYTE8*)" value of %s: %d\n", name.c_str(), value.value.integer); } vpi_printf((PLI_BYTE8*)" vpi_chk_error: %s\n", e.message);
}
if (verbose) {
vpi_printf((PLI_BYTE8*)" value of %s: %d\n", name.c_str(), value.value.integer);
}
CHECK_RESULT(value.value.integer, exp_value); CHECK_RESULT(value.value.integer, exp_value);
return 0; return 0;
@ -139,7 +148,9 @@ int check_param_str(std::string name, PLI_INT32 format, std::string exp_value, b
CHECK_RESULT_NZ(param_h); CHECK_RESULT_NZ(param_h);
vpi_type = vpi_get(vpiType, param_h); vpi_type = vpi_get(vpiType, param_h);
CHECK_RESULT(vpi_type, vpiParameter); CHECK_RESULT(vpi_type, vpiParameter);
if (verbose) {vpi_printf((PLI_BYTE8*)" vpiType: %s (%d)\n", vpi_get_str(vpiType, param_h), vpi_type); } if (verbose) {
vpi_printf((PLI_BYTE8*)" vpiType: %s (%d)\n", vpi_get_str(vpiType, param_h), vpi_type);
}
// attributes // attributes
p = vpi_get_str(vpiName, param_h); p = vpi_get_str(vpiName, param_h);
@ -150,20 +161,28 @@ int check_param_str(std::string name, PLI_INT32 format, std::string exp_value, b
CHECK_RESULT_CSTR(p, "vpiParameter"); CHECK_RESULT_CSTR(p, "vpiParameter");
vpi_type = vpi_get(vpiLocalParam, param_h); vpi_type = vpi_get(vpiLocalParam, param_h);
CHECK_RESULT_NZ(vpi_chk_error(&e)); CHECK_RESULT_NZ(vpi_chk_error(&e));
if (verbose && vpi_chk_error(&e)) {vpi_printf((PLI_BYTE8*)" vpi_chk_error: %s\n", e.message); } if (verbose && vpi_chk_error(&e)) {
vpi_printf((PLI_BYTE8*)" vpi_chk_error: %s\n", e.message);
}
// values // values
if (verbose) {vpi_printf((PLI_BYTE8*)" Try writing value to %s ...\n", name.c_str()); } if (verbose) { vpi_printf((PLI_BYTE8*)" Try writing value to %s ...\n", name.c_str()); }
value.value.str = (PLI_BYTE8*) exp_value.c_str(); value.value.str = (PLI_BYTE8*)exp_value.c_str();
vpi_put_value(param_h, &value, NULL, vpiNoDelay); vpi_put_value(param_h, &value, NULL, vpiNoDelay);
CHECK_RESULT_NZ(vpi_chk_error(&e)); CHECK_RESULT_NZ(vpi_chk_error(&e));
if (verbose && vpi_chk_error(&e)) {vpi_printf((PLI_BYTE8*)" vpi_chk_error: %s\n", e.message); } if (verbose && vpi_chk_error(&e)) {
vpi_printf((PLI_BYTE8*)" vpi_chk_error: %s\n", e.message);
}
if (verbose) {vpi_printf((PLI_BYTE8*)" Try reading value of %s ...\n", name.c_str()); } if (verbose) { vpi_printf((PLI_BYTE8*)" Try reading value of %s ...\n", name.c_str()); }
vpi_get_value(param_h, &value); vpi_get_value(param_h, &value);
CHECK_RESULT_NZ(!vpi_chk_error(&e)); CHECK_RESULT_NZ(!vpi_chk_error(&e));
if (verbose && vpi_chk_error(&e)) {vpi_printf((PLI_BYTE8*)" vpi_chk_error: %s\n", e.message); } if (verbose && vpi_chk_error(&e)) {
if (verbose) {vpi_printf((PLI_BYTE8*)" value of %s: %s\n", name.c_str(), value.value.str); } vpi_printf((PLI_BYTE8*)" vpi_chk_error: %s\n", e.message);
}
if (verbose) {
vpi_printf((PLI_BYTE8*)" value of %s: %s\n", name.c_str(), value.value.str);
}
CHECK_RESULT_CSTR(value.value.str, exp_value.c_str()); CHECK_RESULT_CSTR(value.value.str, exp_value.c_str());
return 0; return 0;
@ -213,8 +232,7 @@ static s_vpi_systf_data vpi_systf_data[] = {{vpiSysFunc, vpiIntFunc, (PLI_BYTE8*
void vpi_compat_bootstrap(void) { void vpi_compat_bootstrap(void) {
p_vpi_systf_data systf_data_p; p_vpi_systf_data systf_data_p;
systf_data_p = &(vpi_systf_data[0]); systf_data_p = &(vpi_systf_data[0]);
while (systf_data_p->type != 0) while (systf_data_p->type != 0) vpi_register_systf(systf_data_p++);
vpi_register_systf(systf_data_p++);
} }
// icarus entry // icarus entry

View File

@ -17,11 +17,9 @@
//====================================================================== //======================================================================
extern "C" { extern "C" {
extern void dpii_test(); extern void dpii_test();
} }
//====================================================================== //======================================================================
void dpii_test() { void dpii_test() { vpi_control(vpiStop); }
vpi_control(vpiStop);
}

View File

@ -234,7 +234,7 @@ int main(int argc, char** argv, char** env) {
topp->eval(); topp->eval();
VerilatedVpi::callValueCbs(); VerilatedVpi::callValueCbs();
VerilatedVpi::callTimedCbs(); VerilatedVpi::callTimedCbs();
CHECK_RESULT(VerilatedVpi::cbNextDeadline(), main_time+1); CHECK_RESULT(VerilatedVpi::cbNextDeadline(), main_time + 1);
topp->clk = !topp->clk; topp->clk = !topp->clk;
// mon_do(); // mon_do();
#if VM_TRACE #if VM_TRACE

View File

@ -201,9 +201,7 @@ int main(int argc, char** argv, char** env) {
if (tfp) tfp->dump(main_time); if (tfp) tfp->dump(main_time);
#endif #endif
} }
if (!callback_count) { if (!callback_count) vl_fatal(FILENM, __LINE__, "main", "%Error: never got callbacks");
vl_fatal(FILENM, __LINE__, "main", "%Error: never got callbacks");
}
if (!Verilated::gotFinish()) { if (!Verilated::gotFinish()) {
vl_fatal(FILENM, __LINE__, "main", "%Error: Timeout; never got a $finish"); vl_fatal(FILENM, __LINE__, "main", "%Error: Timeout; never got a $finish");
} }

View File

@ -617,8 +617,7 @@ static s_vpi_systf_data vpi_systf_data[] = {{vpiSysFunc, vpiIntFunc, (PLI_BYTE8*
void vpi_compat_bootstrap(void) { void vpi_compat_bootstrap(void) {
p_vpi_systf_data systf_data_p; p_vpi_systf_data systf_data_p;
systf_data_p = &(vpi_systf_data[0]); systf_data_p = &(vpi_systf_data[0]);
while (systf_data_p->type != 0) while (systf_data_p->type != 0) vpi_register_systf(systf_data_p++);
vpi_register_systf(systf_data_p++);
} }
// icarus entry // icarus entry