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] - Diff between revs 21 and 40

Show entire file | Details | Blame | View Log

Rev 21 Rev 40
Line 1... Line 1...
static int receive_rx_data_spw_ultra_light_calltf(char*user_data)
static int receive_rx_data_spw_ultra_light_calltf(char*user_data)
{
{
        vpiHandle CREDIT_ERROR_RX  = vpi_handle_by_name("module_tb.CREDIT_ERROR_RX",NULL);
 
        vpiHandle SEND_FCT_NOW     = vpi_handle_by_name("module_tb.TOP_SEND_FCT_NOW",NULL);
 
 
 
        vpiHandle DATARX_FLAG      = vpi_handle_by_name("module_tb.DATARX_FLAG",NULL);
        vpiHandle DATARX_FLAG      = vpi_handle_by_name("module_tb.DATARX_FLAG",NULL);
        vpiHandle BUFFER_WRITE     = vpi_handle_by_name("module_tb.BUFFER_WRITE",NULL);
        vpiHandle BUFFER_READ   = vpi_handle_by_name("module_tb.BUFFER_READ",NULL);
 
        vpiHandle F_FULL_RX     = vpi_handle_by_name("module_tb.F_FULL_RX",NULL);
 
        vpiHandle F_EMPTY_RX    = vpi_handle_by_name("module_tb.F_EMPTY_RX",NULL);
 
        vpiHandle COUNTER_FIFO_RX      = vpi_handle_by_name("module_tb.COUNTER_FIFO_RX",NULL);
 
 
        value_to_rx.format = vpiIntVal;
        value_to_rx.format = vpiIntVal;
 
 
        if(SC_TOP->reset_set())
        if(SC_TOP->reset_set())
        {
        {
 
 
 
                //printf("state: %d\n",state_test_rx);
 
 
 
                switch(state_test_rx)
 
                {
 
                        case 0:
 
                                vpi_get_value(F_EMPTY_RX, &value_to_rx);
 
                                if(value_to_rx.value.integer == 1)
 
                                        state_test_rx = 1;
 
                        break;
 
                        case 1:
                value_to_rx.value.integer = 0;
                value_to_rx.value.integer = 0;
                vpi_put_value(SEND_FCT_NOW, &value_to_rx, NULL, vpiNoDelay);
                                vpi_put_value(BUFFER_READ, &value_to_rx, NULL, vpiNoDelay);
 
                                state_test_rx = 2;
 
                        break;
 
                        case 2:
 
                                value_to_rx.value.integer = 0;
 
                                vpi_get_value(COUNTER_FIFO_RX, &value_to_rx);
 
                                if(value_to_rx.value.integer > 0)
 
                                {
 
                                        state_test_rx = 3;
 
                                }
 
                        break;
 
                        case 3:
 
 
 
                                if(LOOPBACK_VLOG_EN == 0)
 
                                {
                vpi_get_value(DATARX_FLAG, &value_to_rx);
                vpi_get_value(DATARX_FLAG, &value_to_rx);
                SC_TOP->data_o(value_to_rx.value.integer,data_rx_received_cnt);
                SC_TOP->data_o(value_to_rx.value.integer,data_rx_received_cnt);
 
 
                data_rx_received_cnt++;
                data_rx_received_cnt++;
 
 
                if(data_rx_received_cnt == 100)
                                        if(data_rx_received_cnt == SC_TOP->size_data_test_sc())
                        data_rx_received_cnt = 0;
                        data_rx_received_cnt = 0;
 
                                }
 
 
                fct_send_cnt++;
                                if(LOOPBACK_VLOG_EN == 1)
 
 
                if(fct_send_cnt == 7)
 
                {
                {
 
                                        vpi_get_value(DATARX_FLAG, &value_to_rx);
 
                                        SC_TOP->data_rx_vlog_loopback_o(value_to_rx.value.integer,data_rx_received_cnt);
 
 
 
                                        data_rx_received_cnt++;
 
 
 
                                        if(data_rx_received_cnt == SC_TOP->size_data_test_vlog())
 
                                                data_rx_received_cnt = 0;
 
                                }
 
 
 
                                state_test_rx = 4;
 
                        break;
 
                        case 4:
                        value_to_rx.value.integer = 1;
                        value_to_rx.value.integer = 1;
                        vpi_put_value(SEND_FCT_NOW, &value_to_rx, NULL, vpiNoDelay);
                                vpi_put_value(BUFFER_READ, &value_to_rx, NULL, vpiNoDelay);
                        fct_send_cnt = 0;
                                state_test_rx = 5;
 
                        break;
 
                        case 5:
 
                                value_to_rx.value.integer = 0;
 
                                vpi_put_value(BUFFER_READ, &value_to_rx, NULL, vpiNoDelay);
 
 
 
                                vpi_get_value(F_EMPTY_RX, &value_to_rx);
 
                                if(value_to_rx.value.integer == 1)
 
                                        state_test_rx = 1;
 
                        break;
                }
                }
 
 
        }
        }
 
 
        return 0;
        return 0;

powered by: WebSVN 2.1.0

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