OpenCores
URL https://opencores.org/ocsvn/spacewiresystemc/spacewiresystemc/trunk

Subversion Repositories spacewiresystemc

[/] [spacewiresystemc/] [trunk/] [vpi/] [vpi_test_suit/] [global_init.h] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 redbear
static int global_init_calltf(char*user_data)
2
{
3
 
4
        vpiHandle DATA_I  = vpi_handle_by_name("module_tb.DATA_I",NULL);
5
        vpiHandle WR_DATA  = vpi_handle_by_name("module_tb.WR_DATA",NULL);
6
        vpiHandle RD_DATA  = vpi_handle_by_name("module_tb.RD_DATA",NULL);
7
        vpiHandle TICK_IN  = vpi_handle_by_name("module_tb.TICK_IN",NULL);
8
        vpiHandle TIME_IN  = vpi_handle_by_name("module_tb.TIME_IN",NULL);
9
        vpiHandle TX_CLK_DIV  = vpi_handle_by_name("module_tb.TX_CLK_DIV",NULL);
10
 
11
        vpiHandle LINKSTART  = vpi_handle_by_name("module_tb.LINK_START",NULL);
12
        vpiHandle LINKDISABLE= vpi_handle_by_name("module_tb.LINK_DISABLE",NULL);
13
        vpiHandle AUTOSTART  = vpi_handle_by_name("module_tb.AUTOSTART",NULL);
14
        vpiHandle RESETn     = vpi_handle_by_name("module_tb.RESETn",NULL);
15
 
16
        vpiHandle DIN     = vpi_handle_by_name("module_tb.Din", NULL);
17
        vpiHandle SIN     = vpi_handle_by_name("module_tb.Sin", NULL);
18
 
19
        dout_value.format = vpiIntVal;
20
        sout_value.format = vpiIntVal;
21
 
22
        counter = 0;
23
        position = 0;
24
        counter_null = 0;
25
        state_test_rx=0;
26
 
27
        lib_handle = dlopen("./final_spw.so", RTLD_LAZY);
28
 
29
        if(!lib_handle)
30
        {
31
                fprintf(stderr, "%s\n", dlerror());
32
        }
33
 
34
        create = (Control_SC* (*)())dlsym(lib_handle, "create_object");
35
        destroy = (void (*)(Control_SC*))dlsym(lib_handle, "destroy_object");
36
 
37
        SC_TOP = (Control_SC*)create();
38
        SC_TOP->init();
39
 
40
        //SC_TOP->reset_set_low();
41
 
42
        sout_value.value.integer = SC_TOP->get_value_sout();
43
        dout_value.value.integer = SC_TOP->get_value_dout();
44
 
45
        vpi_put_value(DIN, &dout_value, NULL, vpiNoDelay);
46
        vpi_put_value(SIN, &sout_value, NULL, vpiNoDelay);
47
 
48
        dout_value.value.integer = 0;
49
        vpi_put_value(LINKSTART, &dout_value, NULL, vpiNoDelay);
50
        vpi_put_value(LINKDISABLE, &dout_value, NULL, vpiNoDelay);
51
        vpi_put_value(AUTOSTART, &dout_value, NULL, vpiNoDelay);
52
 
53
        vpi_put_value(DATA_I, &dout_value, NULL, vpiNoDelay);
54
        vpi_put_value(WR_DATA, &dout_value, NULL, vpiNoDelay);
55
        vpi_put_value(RD_DATA, &dout_value, NULL, vpiNoDelay);
56
        vpi_put_value(TICK_IN, &dout_value, NULL, vpiNoDelay);
57
        vpi_put_value(TIME_IN, &dout_value, NULL, vpiNoDelay);
58
        vpi_put_value(TX_CLK_DIV, &dout_value, NULL, vpiNoDelay);
59
 
60
        dout_value.value.integer = 1;
61
        vpi_put_value(RESETn, &dout_value, NULL, vpiNoDelay);
62
 
63
        return 0;
64
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.