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

Subversion Repositories spacewiresystemc

[/] [spacewiresystemc/] [trunk/] [vpi/] [vpi_test_stress/] [write_tx_data_spw_ultra_light.h] - Blame information for rev 40

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 redbear
static int write_tx_data_spw_ultra_light_calltf(char*user_data)
2
{
3
        vpiHandle TX_DATA      = vpi_handle_by_name("module_tb.TOP_TX_DATA",NULL);
4
        vpiHandle TX_WRITE     = vpi_handle_by_name("module_tb.TOP_TX_WRITE",NULL);
5 40 redbear
        vpiHandle F_FULL       = vpi_handle_by_name("module_tb.F_FULL",NULL);
6
        vpiHandle F_EMPTY      = vpi_handle_by_name("module_tb.F_EMPTY",NULL);
7
        vpiHandle COUNTER_FIFO_TX      = vpi_handle_by_name("module_tb.COUNTER_FIFO_TX",NULL);
8 5 redbear
 
9 10 redbear
        value_to_tx.format = vpiIntVal;
10 5 redbear
 
11 10 redbear
        if(SC_TOP->reset_set())
12
        {
13
                if(SC_TOP->start_tx_test())
14
                {
15 40 redbear
 
16
                        //printf("state: %d\n",state_test);
17
 
18 10 redbear
                        switch(state_test)
19
                        {
20
                                case SEND_DATA:
21
 
22
                                        value_to_tx.value.integer = 0;
23
                                        vpi_put_value(TX_WRITE, &value_to_tx, NULL, vpiNoDelay);
24 40 redbear
 
25
                                        value_to_tx.value.integer = SC_TOP->take_data(position);
26
                                        vpi_put_value(TX_DATA, &value_to_tx, NULL, vpiNoDelay);
27
 
28 10 redbear
                                        state_test = 59;
29
                                break;
30
                                case 59:
31 12 redbear
 
32 40 redbear
                                        vpi_get_value(COUNTER_FIFO_TX, &value_to_tx);
33 10 redbear
 
34 40 redbear
                                        if(value_to_tx.value.integer < 63 )
35 10 redbear
                                        {
36 40 redbear
                                                value_to_tx.value.integer = 1;
37 10 redbear
                                                vpi_put_value(TX_WRITE, &value_to_tx, NULL, vpiNoDelay);
38
                                                state_test = WAIT_DATA;
39 40 redbear
                                                position = position + 1;
40 10 redbear
                                        }
41 40 redbear
                                        else
42
                                        {
43 10 redbear
 
44 40 redbear
 
45
                                        }
46
 
47 10 redbear
                                break;
48
                                case WAIT_DATA:
49 40 redbear
 
50
                                        value_to_tx.value.integer = 0;
51
                                        vpi_put_value(TX_WRITE, &value_to_tx, NULL, vpiNoDelay);
52
 
53
                                        //vpi_get_value(F_FULL, &value_to_tx);
54 10 redbear
 
55 40 redbear
                                        state_test = SEND_DATA;
56
 
57
                                        if(position < SC_TOP->size_data_test_vlog())
58 10 redbear
                                        {
59 40 redbear
                                                //value_to_tx.value.integer = 0;
60
                                                //vpi_put_value(TX_WRITE, &value_to_tx, NULL, vpiNoDelay);
61
                                                state_test = SEND_DATA;
62 10 redbear
                                        }
63
                                        else
64
                                        {
65 40 redbear
                                                //value_to_tx.value.integer = 0;
66
                                                //vpi_put_value(TX_WRITE, &value_to_tx, NULL, vpiNoDelay);
67
                                                state_test = 60;
68
                                                printf("value is %d\n",position);
69
                                        }
70
 
71 10 redbear
                                break;
72
                                case 60:
73
                                        SC_TOP->end_tx_test();
74
                                        counter = position = state_test = 0;
75
                                break;
76
                        }
77
                }
78
                else
79
                {
80
                        position = 0;
81
                }
82 40 redbear
 
83 10 redbear
        }
84
 
85 5 redbear
        return 0;
86
}

powered by: WebSVN 2.1.0

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