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

Subversion Repositories spacewiresystemc

[/] [spacewiresystemc/] [trunk/] [systemC/] [send_module_sc.h] - Blame information for rev 40

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 29 redbear
#ifndef SPW_TX_SEND
2
#define SPW_TX_SEND
3
 
4
class SPW_TX_SEND_DATA;
5
 
6
SC_MODULE(SPW_TX_SEND_DATA)
7
{
8
        sc_in<bool> CLOCK_SEND_DATA;
9
        sc_in<bool> RESET_SEND_DATA;
10
        sc_in<bool> E_SEND_DATA;
11
 
12
        sc_out<bool> TICKIN_TX_SEND_DATA;
13
        sc_out<sc_uint<8> > TIMEIN_CONTROL_FLAG_TX_SEND_DATA;
14
 
15
        sc_out<bool> TXWRITE_TX_SEND_DATA;
16
        sc_out<sc_uint<9> > TXDATA_FLAGCTRL_TX_SEND_DATA;
17
 
18
        sc_in<bool> READY_TX_SEND_DATA;
19
        sc_in<bool> READY_TICK_DATA;
20
 
21
        sc_uint<9> data_send;
22
 
23
        int a = 0;
24
        int c = 0;
25
 
26
        void SEND_DATA()
27
        {
28
                if(!RESET_SEND_DATA)
29
                {
30
                        TXWRITE_TX_SEND_DATA = false;
31 40 redbear
                        //data_send = data_generated_sc[0];
32 29 redbear
                        a=0;
33
                }
34
                else
35
                {
36
                        if(E_SEND_DATA && data_generated_sc.size() > 0)
37
                        {
38
 
39
                                if(a < data_generated_sc.size()-(unsigned int)1)
40
                                {
41 40 redbear
                                        TXDATA_FLAGCTRL_TX_SEND_DATA = data_generated_sc[a];
42 29 redbear
                                        if(!READY_TX_SEND_DATA)
43
                                        {
44
                                                TXWRITE_TX_SEND_DATA = true;
45
                                        }else
46
                                        {
47
                                                TXWRITE_TX_SEND_DATA = false;
48
                                        }
49
                                }
50
                                //cout << TXDATA_FLAGCTRL_TX_SEND_DATA.read().to_string(SC_HEX) << " " << READY_TX_SEND_DATA << " " << TXWRITE_TX_SEND_DATA << endl;
51
 
52
                        }
53
 
54
                }
55
        }
56
 
57
 
58
        void INCREMMENT_DATA()
59
        {
60 40 redbear
                if(a == data_generated_sc.size())
61
                        a=0;
62
                else
63 29 redbear
                        a++;
64
        }
65
 
66
        void SEND_TIME_CODE()
67
        {
68
                if(!RESET_SEND_DATA)
69
                {
70
                        TICKIN_TX_SEND_DATA = false;
71
                        TIMEIN_CONTROL_FLAG_TX_SEND_DATA = 0;
72
                        c=0;
73
                }
74
                else
75
                {
76
                        if(start_tick_data)
77
                        {
78 40 redbear
                                if( c <= data_generated_sc.size())
79 29 redbear
                                {
80
 
81
                                        if(!READY_TICK_DATA)
82
                                        {
83
                                                TICKIN_TX_SEND_DATA = true;
84
                                        }
85
                                        else
86
                                        {
87
                                                TICKIN_TX_SEND_DATA = false;
88
                                                c++;
89
                                                TIMEIN_CONTROL_FLAG_TX_SEND_DATA = TIMEIN_CONTROL_FLAG_TX_SEND_DATA.read() +1;
90
                                        }
91
                                }
92
                                else
93
                                {
94
                                        c=0;
95
                                        TIMEIN_CONTROL_FLAG_TX_SEND_DATA = 0;
96
                                }
97
                        }
98
                }
99
        }
100
        SC_CTOR(SPW_TX_SEND_DATA)
101
        {
102
                SC_METHOD(SEND_DATA);
103
                sensitive << CLOCK_SEND_DATA;
104
                SC_METHOD(INCREMMENT_DATA);
105
                sensitive << READY_TX_SEND_DATA.pos();
106
                SC_METHOD(SEND_TIME_CODE);
107
                sensitive << CLOCK_SEND_DATA.pos();
108
        }
109
};
110
#endif

powered by: WebSVN 2.1.0

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