Created
February 26, 2024 15:19
-
-
Save keesj/fe9004f205b92f2a2419cc0eb5ad2a7e to your computer and use it in GitHub Desktop.
verilog / iverilog return value from vpi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# include <vpi_user.h> | |
static int rnginit_compiletf(char*user_data __attribute__((unused))) | |
{ | |
return 0; | |
} | |
static int rnginit_calltf(char*user_data __attribute__((unused))) | |
{ | |
vpiHandle callh; | |
s_vpi_value val; | |
callh = vpi_handle(vpiSysTfCall, 0); | |
vpi_printf("Hello, World!\n"); | |
val.format = vpiIntVal; | |
val.value.integer = 0xffffffff; | |
vpi_put_value(callh, &val, 0, vpiNoDelay); | |
return 0; | |
} | |
void rnginit_register(void) | |
{ | |
s_vpi_systf_data tf_data; | |
tf_data.type = vpiSysFunc; | |
tf_data.sysfunctype = vpiSysFuncInt; | |
tf_data.tfname = "$rnginit"; | |
tf_data.calltf = rnginit_calltf; | |
tf_data.compiletf = rnginit_compiletf; | |
tf_data.sizetf = 0; | |
tf_data.user_data = 0; | |
vpi_register_systf(&tf_data); | |
} | |
void (*vlog_startup_routines[])(void) = { | |
rnginit_register, | |
0 | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment