| 1 |
5 |
redbear |
static int global_init_calltf(char*user_data)
|
| 2 |
|
|
{
|
| 3 |
|
|
|
| 4 |
|
|
vpiHandle TX_DATA = vpi_handle_by_name("module_tb.TOP_TX_DATA",NULL);
|
| 5 |
|
|
vpiHandle TX_WRITE = vpi_handle_by_name("module_tb.TOP_TX_WRITE",NULL);
|
| 6 |
|
|
vpiHandle TX_TICK = vpi_handle_by_name("module_tb.TOP_TX_TICK",NULL);
|
| 7 |
|
|
vpiHandle TX_TIME = vpi_handle_by_name("module_tb.TOP_TX_TIME",NULL);
|
| 8 |
|
|
|
| 9 |
|
|
vpiHandle CREDITERRORRX = vpi_handle_by_name("module_tb.CREDIT_ERROR_RX",NULL);
|
| 10 |
|
|
vpiHandle TOPSENDFCTNOW = vpi_handle_by_name("module_tb.TOP_SEND_FCT_NOW",NULL);
|
| 11 |
|
|
|
| 12 |
|
|
vpiHandle LINKSTART = vpi_handle_by_name("module_tb.LINK_START",NULL);
|
| 13 |
|
|
vpiHandle LINKDISABLE = vpi_handle_by_name("module_tb.LINK_DISABLE",NULL);
|
| 14 |
|
|
vpiHandle AUTOSTART = vpi_handle_by_name("module_tb.AUTO_START",NULL);
|
| 15 |
|
|
vpiHandle RESETn = vpi_handle_by_name("module_tb.RESETN",NULL);
|
| 16 |
|
|
|
| 17 |
|
|
vpiHandle DOUT = vpi_handle_by_name("module_tb.TOP_DOUT", NULL);
|
| 18 |
|
|
vpiHandle SOUT = vpi_handle_by_name("module_tb.TOP_SOUT", NULL);
|
| 19 |
|
|
|
| 20 |
|
|
dout_value.format = vpiIntVal;
|
| 21 |
|
|
sout_value.format = vpiIntVal;
|
| 22 |
|
|
|
| 23 |
|
|
counter = 0;
|
| 24 |
|
|
position = 0;
|
| 25 |
|
|
counter_null = 0;
|
| 26 |
|
|
state_test_rx=0;
|
| 27 |
|
|
|
| 28 |
|
|
lib_handle = dlopen("./final_spw.so", RTLD_LAZY);
|
| 29 |
|
|
|
| 30 |
|
|
if(!lib_handle)
|
| 31 |
|
|
{
|
| 32 |
|
|
fprintf(stderr, "%s\n", dlerror());
|
| 33 |
|
|
}
|
| 34 |
|
|
|
| 35 |
|
|
create = (Control_SC* (*)())dlsym(lib_handle, "create_object");
|
| 36 |
|
|
destroy = (void (*)(Control_SC*))dlsym(lib_handle, "destroy_object");
|
| 37 |
|
|
|
| 38 |
|
|
SC_TOP = (Control_SC*)create();
|
| 39 |
|
|
SC_TOP->init();
|
| 40 |
|
|
|
| 41 |
|
|
//SC_TOP->reset_set_low();
|
| 42 |
|
|
|
| 43 |
|
|
sout_value.value.integer = SC_TOP->get_value_sout();
|
| 44 |
|
|
dout_value.value.integer = SC_TOP->get_value_dout();
|
| 45 |
|
|
|
| 46 |
|
|
vpi_put_value(DOUT, &dout_value, NULL, vpiNoDelay);
|
| 47 |
|
|
vpi_put_value(SOUT, &sout_value, NULL, vpiNoDelay);
|
| 48 |
|
|
|
| 49 |
|
|
dout_value.value.integer = 0;
|
| 50 |
|
|
vpi_put_value(LINKSTART, &dout_value, NULL , vpiNoDelay);
|
| 51 |
|
|
vpi_put_value(LINKDISABLE, &dout_value, NULL, vpiNoDelay);
|
| 52 |
|
|
vpi_put_value(AUTOSTART, &dout_value, NULL ,vpiNoDelay);
|
| 53 |
|
|
|
| 54 |
|
|
vpi_put_value(CREDITERRORRX, &dout_value, NULL , vpiNoDelay);
|
| 55 |
|
|
vpi_put_value(TOPSENDFCTNOW, &dout_value, NULL , vpiNoDelay);
|
| 56 |
|
|
|
| 57 |
|
|
vpi_put_value(TX_DATA, &dout_value, NULL , vpiNoDelay);
|
| 58 |
|
|
vpi_put_value(TX_WRITE, &dout_value, NULL, vpiNoDelay);
|
| 59 |
|
|
|
| 60 |
|
|
vpi_put_value(TX_TICK, &dout_value, NULL , vpiNoDelay);
|
| 61 |
|
|
vpi_put_value(TX_TIME, &dout_value, NULL , vpiNoDelay);
|
| 62 |
|
|
|
| 63 |
|
|
dout_value.value.integer = 1;
|
| 64 |
|
|
vpi_put_value(RESETn, &dout_value, NULL , vpiNoDelay);
|
| 65 |
|
|
|
| 66 |
|
|
return 0;
|
| 67 |
|
|
}
|