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

Subversion Repositories spacewiresystemc

[/] [spacewiresystemc/] [trunk/] [vpi/] [vpi_test_stress/] [run_sim.h] - Blame information for rev 12

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 redbear
static int run_sim_calltf(char*user_data)
2
{
3
        vpiHandle DOUT         = vpi_handle_by_name("module_tb.TOP_DOUT", NULL);
4
        vpiHandle SOUT         = vpi_handle_by_name("module_tb.TOP_SOUT", NULL);
5
        vpiHandle DIN          = vpi_handle_by_name("module_tb.TOP_DIN", NULL);
6
        vpiHandle SIN          = vpi_handle_by_name("module_tb.TOP_SIN", NULL);
7
 
8 12 redbear
        vpiHandle DTA        = vpi_handle_by_name("module_tb.SPW_SC_FSM", NULL);
9 5 redbear
        //vpiHandle TX_CLOCK_OUT        = vpi_handle_by_name("module_tb.TX_CLOCK_OUT", NULL);
10
 
11
        vpiHandle i          = vpi_handle_by_name("module_tb.i", NULL);
12 12 redbear
        vpiHandle tx_clock   = vpi_handle_by_name("module_tb.time_clk_ns", NULL);
13 5 redbear
 
14 12 redbear
 
15 5 redbear
        dout_value.format    = vpiIntVal;
16
        sout_value.format    = vpiIntVal;
17
 
18
        din_value.format     = vpiIntVal;
19
        sin_value.format     = vpiIntVal;
20
 
21
        fsm_value.format     = vpiIntVal;
22
 
23
        v_generate.format=vpiIntVal;
24 12 redbear
        fsm_value.format     = vpiIntVal;
25 5 redbear
        //message_value.format = vpiIntVal;
26
 
27
        if(SC_TOP->finish_simulation() == 1)
28
        {
29
                v_generate.value.integer = 1;
30
                vpi_put_value(i, &v_generate, NULL, vpiNoDelay);
31
                SC_TOP->stop_sim();
32
                destroy(SC_TOP);
33
        }
34
        else
35
        {
36
                SC_TOP->run_sim();
37
 
38
                sin_value.value.integer = SC_TOP->get_value_sout();
39
                din_value.value.integer = SC_TOP->get_value_dout();
40
                vpi_put_value(DIN, &din_value, NULL, vpiNoDelay);
41
                vpi_put_value(SIN, &sin_value, NULL, vpiNoDelay);
42
 
43
                vpi_get_value(SOUT, &sout_value);
44
                vpi_get_value(DOUT, &dout_value);
45
                SC_TOP->set_rx_sin(sout_value.value.integer);
46
                SC_TOP->set_rx_din(dout_value.value.integer);
47
 
48 12 redbear
                fsm_value.value.integer = SC_TOP->get_spw_fsm();
49
                vpi_put_value(DTA, &fsm_value, NULL, vpiNoDelay);
50 5 redbear
 
51 12 redbear
                vpi_get_value(tx_clock, &sout_value);
52
 
53
                if(sout_value.value.integer != SC_TOP->verilog_frequency())
54
                {
55
                        sin_value.value.integer = SC_TOP->verilog_frequency();
56
                        vpi_put_value(tx_clock, &sin_value, NULL, vpiNoDelay);
57
                }
58 5 redbear
                //fsm_value.value.integer = SC_TOP->clock_tx();
59
                //vpi_put_value(TX_CLOCK_OUT, &fsm_value, NULL, vpiNoDelay);
60
 
61
        }
62
 
63
 
64
        return 0;
65
}

powered by: WebSVN 2.1.0

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