コード例 #1
0
ファイル: t_dpi_context_c.cpp プロジェクト: jeras/verilator
int dpic_line() {
    svScope scope = svGetScope();
    if (!scope) {
	printf("%%Warning: svGetScope failed\n");
	return 0;
    }

#ifdef VERILATOR
    static int didDump = 0;
    if (didDump++ == 0) {
	Verilated::scopesDump();
    }
#endif

    const char* scopenamep = svGetNameFromScope(scope);
    if (!scopenamep) {
	printf("%%Warning: svGetNameFromScope failed\n");
	return 0;
    }
    if (scope != svGetScopeFromName(scopenamep)) {
	printf("%%Warning: svGetScopeFromName repeat failed\n");
	return 0;
    }

    const char* filenamep = "";
    int lineno = 0;
    if (svGetCallerInfo(&filenamep, &lineno)) {
	printf("Call from %s:%d:%s\n", filenamep, lineno, scopenamep);
    } else {
	printf("%%Warning: svGetCallerInfo failed\n");
	return 0;
    }
    return lineno;
}
コード例 #2
0
ファイル: t_embed1_c.cpp プロジェクト: torc-isi/torc
Vt_embed1_child* __get_modelp() {
    svScope scope = svGetScope();
    if (!scope) {
	vl_fatal(__FILE__,__LINE__,__FILE__,"svGetScope failed");
	return NULL;
    }

    void* __modelp = svGetUserData(scope, &T_Embed_Child_Unique);
    if (!__modelp) {
	// Create the model
	const char* scopenamep = svGetNameFromScope(scope);
	if (!scopenamep) vl_fatal(__FILE__,__LINE__,__FILE__,"svGetNameFromScope failed");
	__modelp = new Vt_embed1_child(scopenamep);
	if (svPutUserData(scope, &T_Embed_Child_Unique, __modelp)) {
	    vl_fatal(__FILE__,__LINE__,__FILE__,"svPutUserData failed");
	}
    }
    return (Vt_embed1_child*)(__modelp); 
}
コード例 #3
0
ファイル: t_dpi_context_c.cpp プロジェクト: jeras/verilator
unsigned dpic_getcontext() {
    svScope scope = svGetScope();
    printf("%%Info: svGetScope returned scope (%p) with name %s\n", scope, svGetNameFromScope(scope));
    return (unsigned) (uintptr_t) scope;
}