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

Subversion Repositories spacewiresystemc

[/] [spacewiresystemc/] [trunk/] [vpi/] [vpi_test_stress/] [receive_rx_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 receive_rx_data_spw_ultra_light_calltf(char*user_data)
2
{
3 40 redbear
        vpiHandle DATARX_FLAG   = vpi_handle_by_name("module_tb.DATARX_FLAG",NULL);
4
        vpiHandle BUFFER_READ   = vpi_handle_by_name("module_tb.BUFFER_READ",NULL);
5
        vpiHandle F_FULL_RX     = vpi_handle_by_name("module_tb.F_FULL_RX",NULL);
6
        vpiHandle F_EMPTY_RX    = vpi_handle_by_name("module_tb.F_EMPTY_RX",NULL);
7
        vpiHandle COUNTER_FIFO_RX      = vpi_handle_by_name("module_tb.COUNTER_FIFO_RX",NULL);
8 5 redbear
 
9 21 redbear
        value_to_rx.format = vpiIntVal;
10
 
11
        if(SC_TOP->reset_set())
12
        {
13 5 redbear
 
14 40 redbear
                //printf("state: %d\n",state_test_rx);
15
 
16
                switch(state_test_rx)
17
                {
18
                        case 0:
19
                                vpi_get_value(F_EMPTY_RX, &value_to_rx);
20
                                if(value_to_rx.value.integer == 1)
21
                                        state_test_rx = 1;
22
                        break;
23
                        case 1:
24
                                value_to_rx.value.integer = 0;
25
                                vpi_put_value(BUFFER_READ, &value_to_rx, NULL, vpiNoDelay);
26
                                state_test_rx = 2;
27
                        break;
28
                        case 2:
29
                                value_to_rx.value.integer = 0;
30
                                vpi_get_value(COUNTER_FIFO_RX, &value_to_rx);
31
                                if(value_to_rx.value.integer > 0)
32
                                {
33
                                        state_test_rx = 3;
34
                                }
35
                        break;
36
                        case 3:
37
 
38
                                if(LOOPBACK_VLOG_EN == 0)
39
                                {
40
                                        vpi_get_value(DATARX_FLAG, &value_to_rx);
41
                                        SC_TOP->data_o(value_to_rx.value.integer,data_rx_received_cnt);
42 21 redbear
 
43 40 redbear
                                        data_rx_received_cnt++;
44 5 redbear
 
45 40 redbear
                                        if(data_rx_received_cnt == SC_TOP->size_data_test_sc())
46
                                                data_rx_received_cnt = 0;
47
                                }
48 21 redbear
 
49 40 redbear
                                if(LOOPBACK_VLOG_EN == 1)
50
                                {
51
                                        vpi_get_value(DATARX_FLAG, &value_to_rx);
52
                                        SC_TOP->data_rx_vlog_loopback_o(value_to_rx.value.integer,data_rx_received_cnt);
53
 
54
                                        data_rx_received_cnt++;
55 21 redbear
 
56 40 redbear
                                        if(data_rx_received_cnt == SC_TOP->size_data_test_vlog())
57
                                                data_rx_received_cnt = 0;
58
                                }
59
 
60
                                state_test_rx = 4;
61
                        break;
62
                        case 4:
63
                                value_to_rx.value.integer = 1;
64
                                vpi_put_value(BUFFER_READ, &value_to_rx, NULL, vpiNoDelay);
65
                                state_test_rx = 5;
66
                        break;
67
                        case 5:
68
                                value_to_rx.value.integer = 0;
69
                                vpi_put_value(BUFFER_READ, &value_to_rx, NULL, vpiNoDelay);
70
 
71
                                vpi_get_value(F_EMPTY_RX, &value_to_rx);
72
                                if(value_to_rx.value.integer == 1)
73
                                        state_test_rx = 1;
74
                        break;
75 21 redbear
                }
76
 
77
        }
78
 
79 5 redbear
        return 0;
80
}

powered by: WebSVN 2.1.0

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