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

Subversion Repositories spacewiresystemc

[/] [spacewiresystemc/] [trunk/] [systemC/] [rx_spw.h] - Diff between revs 29 and 40

Show entire file | Details | Blame | View Log

Rev 29 Rev 40
Line 1... Line 1...
//+FHDR------------------------------------------------------------------------
 
//Copyright (c) 2013 Latin Group American Integhrated Circuit, Inc. All rights reserved
 
//GLADIC Open Source RTL
 
//-----------------------------------------------------------------------------
 
//FILE NAME      :
 
//DEPARTMENT     : IC Design / Verification
 
//AUTHOR         : Felipe Fernandes da Costa
 
//AUTHOR’S EMAIL :
 
//-----------------------------------------------------------------------------
 
//RELEASE HISTORY
 
//VERSION DATE AUTHOR DESCRIPTION
 
//1.0 YYYY-MM-DD name
 
//-----------------------------------------------------------------------------
 
//KEYWORDS : General file searching keywords, leave blank if none.
 
//-----------------------------------------------------------------------------
 
//PURPOSE  : ECSS_E_ST_50_12C_31_july_2008
 
//-----------------------------------------------------------------------------
 
//PARAMETERS
 
//PARAM NAME            RANGE   : DESCRIPTION : DEFAULT : UNITS
 
//e.g.DATA_WIDTH        [32,16] : width of the DATA : 32:
 
//-----------------------------------------------------------------------------
 
//REUSE ISSUES
 
//Reset Strategy        :
 
//Clock Domains         :
 
//Critical Timing       :
 
//Test Features         :
 
//Asynchronous I/F      :
 
//Scan Methodology      :
 
//Instantiations        :
 
//Synthesizable (y/n)   :
 
//Other                 :
 
//-FHDR------------------------------------------------------------------------
 
 
 
#ifndef SPW_RX_H
#ifndef SPW_RX_H
#define SPW_RX_H
#define SPW_RX_H
 
 
#define STATE_RESET     0
#define STATE_RESET     0
#define STATE_ENABLED   1
#define STATE_ENABLED   1
Line 109... Line 76...
        bool control_found;
        bool control_found;
        bool data_found;
        bool data_found;
        bool time_code_found;
        bool time_code_found;
 
 
 
 
 
        bool last_is_control;
 
        bool last_is_data;
 
 
 
 
        bool NULL_FOUND;
        bool NULL_FOUND;
        bool FCT_FOUND;
        bool FCT_FOUND;
        bool DATA_FOUND;
        bool DATA_FOUND;
        bool TIMECODE_FOUND;
        bool TIMECODE_FOUND;
 
 
Line 129... Line 100...
        void CalcPARITY()
        void CalcPARITY()
        {
        {
                control_parity_error = false;
                control_parity_error = false;
                data_parity_error = false;
                data_parity_error = false;
                time_code_parity_error = false;
                time_code_parity_error = false;
                if(last_char == ESC || last_char == FCT || last_char == EOP || last_char == EEP)
 
 
 
 
                if(last_is_control)
                {
                {
                        if(control_found)
                        if(control_found)
                        {
                        {
                                if(!(control_sys[2]^last_control_sys[0]^last_control_sys[1]) != control_sys[3])
                                if(!(control_sys[2]^last_control_sys[0]^last_control_sys[1]) != control_sys[3])
                                {
                                {
Line 143... Line 116...
                        {
                        {
                                if(!(data_sys[8]^last_control_sys[0]^last_control_sys[1])  != data_sys[9])
                                if(!(data_sys[8]^last_control_sys[0]^last_control_sys[1])  != data_sys[9])
                                {
                                {
                                        data_parity_error = true;
                                        data_parity_error = true;
                                }
                                }
                        }else if(time_code_found)
 
                        {
 
                                if(!(timecode_sys[8]^last_control_sys[0]^last_control_sys[1]) != timecode_sys[9])
 
                                {
 
                                        time_code_parity_error = true;
 
                                }
 
                        }
                        }
                }else if(last_char == DATA)
 
 
                }else if(last_is_data)
                {
                {
                        if(control_found)
                        if(control_found)
                        {
                        {
                                if(!(data_sys[8]^last_control_sys[0]^last_control_sys[1])  != data_sys[9])
                                if(!(data_sys[8]^last_control_sys[0]^last_control_sys[1])  != data_sys[9])
                                {
                                {
Line 164... Line 132...
                        {
                        {
                                if(!(data_sys[8]^last_data[0]^last_data[1]^last_data[2]^last_data[3]^last_data[4]^last_data[5]^last_data[6]^last_data[7]) != data_sys[9])
                                if(!(data_sys[8]^last_data[0]^last_data[1]^last_data[2]^last_data[3]^last_data[4]^last_data[5]^last_data[6]^last_data[7]) != data_sys[9])
                                {
                                {
                                        data_parity_error = true;
                                        data_parity_error = true;
                                }
                                }
                        }else if(time_code_found)
 
                        {
 
                                if(!(data_sys[8]^timecode_sys[0]^timecode_sys[1]^timecode_sys[2]^timecode_sys[3]^timecode_sys[4]^timecode_sys[5]^timecode_sys[6]^timecode_sys[7])  != data_sys[9])
 
                                {
 
                                        time_code_parity_error = true;
 
                                }
 
                        }
                        }
                }else if(last_char == TIME_CODE)
 
                {
 
                        if(control_found)
 
                        {
 
                                if(!(timecode_sys[8]^last_control_sys[0]^last_control_sys[1])  != timecode_sys[9])
 
                                {
 
                                        control_parity_error = true;
 
                                }
 
                        }/*else if(data_found)
 
                        {
 
                                if(!(timecode[8]^data_sys[0]^data_sys[1]^data_sys[2]^data_sys[3]^data_sys[4])^data_sys[5]^data_sys[6]^data_sys[7] != timecode[9])
 
                                {
 
                                        data_parity_error = true;
 
                                }
 
                        }else if(time_code_found)
 
                        {
 
                                if(!(timecode[8]^timecode_sys[0]^timecode_sys[1]^timecode_sys[2]^timecode_sys[3]^timecode_sys[4]^timecode_sys[5]^timecode_sys[6]^timecode_sys[7])  != timecode[9])
 
                                {
 
                                        time_code_parity_error = true;
 
                                }
 
                        }*/
 
                }
                }
 
 
        }
        }
 
 
        void gotFCT()
        void gotFCT()
        {
        {
                while(1)
                while(1)
Line 313... Line 255...
                GOT_BIT        = true;
                GOT_BIT        = true;
                NULL_FOUND     = false;
                NULL_FOUND     = false;
                FCT_FOUND      = false;
                FCT_FOUND      = false;
                DATA_FOUND     = false;
                DATA_FOUND     = false;
                TIMECODE_FOUND = false;
                TIMECODE_FOUND = false;
 
 
 
                last_is_control = false;
 
                last_is_data    = false;
 
 
                data_col_store.clear();
                data_col_store.clear();
 
 
                if(!connected)
                if(!connected)
                {
                {
                        if(counter == 0)
                        if(counter == 0)
Line 345... Line 291...
                                {
                                {
                                        control_found = true;
                                        control_found = true;
                                        NULL_FOUND = true;
                                        NULL_FOUND = true;
                                        FCT_FOUND = false;
                                        FCT_FOUND = false;
                                        DATA_FOUND = false;
                                        DATA_FOUND = false;
 
 
                                        last_char = ESC;
                                        last_char = ESC;
 
 
                                        data_col_store.push_back("NULL");
                                        data_rx_sc_o(0,control,last_control_sys,data,timecode_sys);
                                        data_col_store.push_back(" - ");
 
                                        data_col_store.push_back(last_control_sys(2,0).to_string(SC_HEX) + control(2,0).to_string());
 
                                        data_col_store.push_back(" - ");
 
                                        data_col_store.push_back(sc_time_stamp().to_string());
 
                                        REC_TX_SPW->storedata(data_col_store);
 
 
 
                                        if(counter_fct > 0)
                                        if(counter_fct > 0)
                                        {
                                        {
                                                counter_fct = counter_fct -1;
                                                counter_fct = counter_fct -1;
                                        }
                                        }
Line 368... Line 310...
                                        counter_fct++;
                                        counter_fct++;
                                        FCT_FOUND = true;
                                        FCT_FOUND = true;
                                        connected = true;
                                        connected = true;
                                        NULL_FOUND = false;
                                        NULL_FOUND = false;
 
 
                                        data_col_store.push_back("FCT");
                                        data_rx_sc_o(1,control,last_control_sys,data,timecode_sys);
                                        data_col_store.push_back(" - ");
 
                                        data_col_store.push_back(last_control_sys(2,0).to_string(SC_HEX) + control(2,0).to_string());
 
                                        data_col_store.push_back(" - ");
 
                                        data_col_store.push_back(sc_time_stamp().to_string());
 
                                        REC_TX_SPW->storedata(data_col_store);
 
 
 
 
 
                                }else if(last_control_sys(2,0) == 4 && control(2,0) == 7)
                                }else if(last_control_sys(2,0) == 4 && control(2,0) == 7)
                                {
                                {
                                        last_char = ESC;
                                        last_char = ESC;
                                        if(counter_fct > 0)
                                        if(counter_fct > 0)
Line 388... Line 324...
                                }else
                                }else
                                {
                                {
                                        invalid_combination = true;
                                        invalid_combination = true;
                                        connected = false;
                                        connected = false;
                                        //cout << last_control_sys(2,0) <<  control_sys(2,0) << endl;
                                        //cout << last_control_sys(2,0) <<  control_sys(2,0) << endl;
                                        data_col_store.push_back("INVALID CONNECTION");
 
                                        data_col_store.push_back(" - ");
                                        data_rx_sc_o(4,control,last_control_sys,data,timecode_sys);
                                        data_col_store.push_back(last_control_sys(2,0).to_string(SC_HEX) + control(2,0).to_string());
 
                                        data_col_store.push_back(" - ");
 
                                        data_col_store.push_back(sc_time_stamp().to_string());
 
                                        REC_TX_SPW->storedata(data_col_store);
 
                                }
                                }
                                last_control_sys = control;
                                last_control_sys = control;
                                //control_sys = control;
 
 
 
                        }
                        }
                }
                }
                else
                else
                {
                {
                        if(counter == 0)
                        if(counter == 0)
Line 422... Line 352...
                        {
                        {
                                timecode(1,1) = data(1,1) = control(0,0) = DIN;
                                timecode(1,1) = data(1,1) = control(0,0) = DIN;
 
 
                                if(control(2,2) == 1)
                                if(control(2,2) == 1)
                                {
                                {
 
 
 
                                        last_is_control = control_found;
 
                                        last_is_data    = data_found;
 
 
                                        control_found = true;
                                        control_found = true;
 
                                        data_found    = false;
                                        counter = 0;
                                        counter = 0;
 
 
                                        if(last_control_sys(2,0) == 7 && control(2,0) == 4)
                                        if(last_control_sys(2,0) == 7 && control(2,0) == 4)
                                        {
                                        {
                                                data_col_store.clear();
 
 
 
                                                control_found = true;
                                                control_found = true;
                                                NULL_FOUND = true;
                                                NULL_FOUND = true;
                                                FCT_FOUND  = false;
                                                FCT_FOUND  = false;
                                                DATA_FOUND = false;
                                                DATA_FOUND = false;
                                                last_char = ESC;
                                                last_char = ESC;
 
 
                                                data_col_store.push_back("NULL");
                                                data_rx_sc_o(0,control,last_control_sys,data,timecode_sys);
                                                data_col_store.push_back(" - ");
 
                                                data_col_store.push_back(last_control_sys(2,0).to_string(SC_HEX) + control(2,0).to_string());
 
                                                data_col_store.push_back(" - ");
 
                                                data_col_store.push_back(sc_time_stamp().to_string());
 
                                                REC_TX_SPW->storedata(data_col_store);
 
 
 
                                                if(counter_fct > 0)
                                                if(counter_fct > 0)
                                                {
                                                {
                                                        counter_fct = counter_fct -1;
                                                        counter_fct = counter_fct -1;
                                                }
                                                }
 
 
 
 
                                        }else if(last_control_sys(2,0) != 7 && control(2,0) == 4)
                                        }else if(last_control_sys(2,0) != 7 && control(2,0) == 4)
                                        {
                                        {
                                                data_col_store.clear();
 
 
 
                                                last_char = FCT;
                                                last_char = FCT;
                                                counter_fct++;
                                                counter_fct++;
 
 
                                                FCT_FOUND  = true;
                                                FCT_FOUND  = true;
                                                NULL_FOUND = false;
                                                NULL_FOUND = false;
                                                DATA_FOUND = false;
                                                DATA_FOUND = false;
 
 
                                                data_col_store.push_back("FCT");
                                                data_rx_sc_o(1,control,last_control_sys,data,timecode_sys);
                                                data_col_store.push_back(" - ");
 
                                                data_col_store.push_back(last_control_sys(2,0).to_string(SC_HEX) + control(2,0).to_string());
 
                                                data_col_store.push_back(" - ");
 
                                                data_col_store.push_back(sc_time_stamp().to_string());
 
                                                REC_TX_SPW->storedata(data_col_store);
 
 
 
                                        }else if(last_control_sys(2,0) != 7 && control(2,0) == 5)
                                        }else if(last_control_sys(2,0) != 7 && control(2,0) == 5)
                                        {
                                        {
                                                data_col_store.clear();
 
 
 
                                                last_char = EOP;
                                                last_char = EOP;
                                                data_col_store.push_back("EOP");
 
 
 
                                                FCT_FOUND  = false;
                                                FCT_FOUND  = false;
                                                NULL_FOUND = false;
                                                NULL_FOUND = false;
                                                DATA_FOUND = true;
                                                DATA_FOUND = true;
 
 
                                                intermediate_data = data_generated_verilog[data_iteration];
                                                data_rx_sc_o(2,control,last_control_sys,data,timecode_sys);
                                                data_col_store.push_back(intermediate_data.to_string(SC_HEX));
 
 
 
                                                data_col_store.push_back(last_control_sys(2,0).to_string(SC_HEX) + control(2,0).to_string());
 
                                                data_col_store.push_back(" ");
 
                                                COMPARE_SPW->compare_test(&data_col_store);
 
                                                data_iteration++;
 
 
 
                                                data_col_store.push_back(sc_time_stamp().to_string());
 
                                                REC_TX_SPW->storedata(data_col_store);
 
 
 
                                                if(counter_fct > 0)
                                                if(counter_fct > 0)
                                                {
                                                {
                                                        counter_fct = counter_fct - 1;
                                                        counter_fct = counter_fct - 1;
                                                }
                                                }
 
 
                                                counter_received_data = counter_received_data + 8;
                                                counter_received_data = counter_received_data + 8;
                                        }else if(last_control_sys(2,0) != 7 && control(2,0) == 6)
                                        }else if(last_control_sys(2,0) != 7 && control(2,0) == 6)
                                        {
                                        {
 
 
                                                data_col_store.clear();
                                                //data_col_store.clear();
 
 
                                                last_char = EEP;
                                                last_char = EEP;
 
 
                                                FCT_FOUND  = false;
                                                FCT_FOUND  = false;
                                                NULL_FOUND = false;
                                                NULL_FOUND = false;
                                                DATA_FOUND = true;
                                                DATA_FOUND = true;
 
 
                                                data_col_store.push_back("EEP");
                                                data_rx_sc_o(3,control,last_control_sys,data,timecode_sys);
                                                intermediate_data = data_generated_verilog[data_iteration];
 
                                                data_col_store.push_back(intermediate_data.to_string(SC_HEX));
 
 
 
                                                data_col_store.push_back(last_control_sys(2,0).to_string(SC_HEX) + control(2,0).to_string());
 
                                                data_col_store.push_back(" ");
 
                                                COMPARE_SPW->compare_test(&data_col_store);
 
                                                data_iteration++;
 
 
 
                                                data_col_store.push_back(sc_time_stamp().to_string());
 
                                                REC_TX_SPW->storedata(data_col_store);
 
 
 
                                                if(counter_fct > 0)
                                                if(counter_fct > 0)
                                                {
                                                {
                                                        counter_fct = counter_fct -1;
                                                        counter_fct = counter_fct -1;
                                                }
                                                }
Line 546... Line 446...
                                                {
                                                {
                                                        counter_fct = counter_fct -1;
                                                        counter_fct = counter_fct -1;
                                                }
                                                }
                                        }else
                                        }else
                                        {
                                        {
                                                data_col_store.clear();
                                                //data_col_store.clear();
 
 
                                                invalid_combination = true;
                                                invalid_combination = true;
                                                connected = false;
                                                connected = false;
                                                //cout << last_control_sys(2,0) <<  control_sys(2,0) << endl;
 
                                                data_col_store.push_back("INVALID CONNECTION");
                                                data_rx_sc_o(4,control,last_control_sys,data,timecode_sys);
                                                data_col_store.push_back(" - ");
 
                                                data_col_store.push_back(last_control_sys(2,0).to_string(SC_HEX) + control_sys(2,0).to_string());
 
                                                data_col_store.push_back(" - ");
 
                                                data_col_store.push_back(sc_time_stamp().to_string());
 
                                                REC_TX_SPW->storedata(data_col_store);
 
                                        }
                                        }
                                        last_control_sys = control;
                                        last_control_sys = control;
 
 
 
 
                                }
                                }
Line 592... Line 487...
                                counter++;
                                counter++;
                        }else if(counter == 9)
                        }else if(counter == 9)
                        {
                        {
                                timecode(7,7) = data(7,7) = DIN;
                                timecode(7,7) = data(7,7) = DIN;
 
 
 
                                last_is_control = control_found;
 
                                last_is_data    = data_found;
 
 
 
                                control_found = false;
 
                                data_found    = true;
 
 
                                if(data(8,8) == 0 && last_control_sys(2,0) != 7)
                                if(data(8,8) == 0 && last_control_sys(2,0) != 7)
                                {
                                {
                                        data_col_store.clear();
                                        data_col_store.clear();
 
 
                                        data_found = true;
 
 
 
                                        FCT_FOUND = false;
                                        FCT_FOUND = false;
                                        NULL_FOUND = false;
                                        NULL_FOUND = false;
                                        DATA_FOUND = true;
                                        DATA_FOUND = true;
                                        //data_store.push_back(data);
                                        //data_store.push_back(data);
                                        last_char = DATA;
                                        last_char = DATA;
 
 
                                        control_sys = 0;
                                        control_sys = 0;
                                        last_control_sys =0;
                                        last_control_sys =0;
 
 
                                        data_col_store.push_back("DATA");
                                        data_rx_sc_o(5,control,last_control_sys,data,timecode_sys);
 
 
                                        intermediate_data = data_generated_verilog[data_iteration];
 
                                        data_col_store.push_back(intermediate_data.to_string(SC_HEX));
 
 
 
                                        data_col_store.push_back(data(8,0).to_string(SC_HEX));
 
                                        data_col_store.push_back(" ");
 
                                        COMPARE_SPW->compare_test(&data_col_store);
 
 
 
                                        data_col_store.push_back(sc_time_stamp().to_string());
 
                                        REC_TX_SPW->storedata(data_col_store);
 
                                        counter_received_data = counter_received_data + 8;
                                        counter_received_data = counter_received_data + 8;
 
 
                                        data_iteration++;
                                        //data_iteration++;
                                        last_data = data;
                                        last_data = data;
 
 
                                        if(counter_fct > 0)
                                        if(counter_fct > 0)
                                        {
                                        {
                                                counter_fct = counter_fct -1;
                                                counter_fct = counter_fct -1;
Line 636... Line 526...
                                        FCT_FOUND  = false;
                                        FCT_FOUND  = false;
                                        NULL_FOUND = false;
                                        NULL_FOUND = false;
                                        DATA_FOUND = false;
                                        DATA_FOUND = false;
                                        TIMECODE_FOUND = true;
                                        TIMECODE_FOUND = true;
 
 
                                        time_code_found = true;
 
                                        timecode_sys = timecode;
                                        timecode_sys = timecode;
                                        time_code_found = false;
 
 
 
                                        last_char = TIME_CODE;
                                        last_char = TIME_CODE;
                                        control_sys = 0;
                                        control_sys = 0;
                                        last_control_sys =0;
                                        last_control_sys =0;
                                        data_col_store.push_back("TIMECODE");
 
                                        data_col_store.push_back(" - ");
                                        data_rx_sc_o(6,control,last_control_sys,data,timecode_sys);
                                        data_col_store.push_back(timecode_sys(7,0).to_string());
 
                                        data_col_store.push_back(" - ");
 
                                        data_col_store.push_back(sc_time_stamp().to_string());
 
                                        REC_TX_SPW->storedata(data_col_store);
 
                                        last_timecode = timecode_sys;
 
 
 
                                        if(counter_fct > 0)
                                        if(counter_fct > 0)
                                        {
                                        {
                                                counter_fct = counter_fct -1;
                                                counter_fct = counter_fct -1;
                                        }
                                        }

powered by: WebSVN 2.1.0

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