source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Icache_Access/src/Icache_Access.cpp @ 88

Last change on this file since 88 was 88, checked in by rosiere, 16 years ago

Almost complete design
with Test and test platform

  • Property svn:keywords set to Id
File size: 7.2 KB
Line 
1/*
2 * $Id: Icache_Access.cpp 88 2008-12-10 18:31:39Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Core/Icache_Access/include/Icache_Access.h"
9
10namespace morpheo                    {
11namespace behavioural {
12namespace core {
13namespace icache_access {
14
15
16#undef  FUNCTION
17#define FUNCTION "Icache_Access::Icache_Access"
18  Icache_Access::Icache_Access
19  (
20#ifdef SYSTEMC
21   sc_module_name name,
22#else
23   string name,
24#endif
25#ifdef STATISTICS
26   morpheo::behavioural::Parameters_Statistics * param_statistics,
27#endif
28   morpheo::behavioural::core::icache_access::Parameters * param,
29   morpheo::behavioural::Tusage_t usage
30   ):
31    _name              (name)
32    ,_param            (param)
33    ,_usage            (usage)
34  {
35    log_begin(Icache_Access,FUNCTION);
36
37    usage_environment(_usage);
38
39#if DEBUG_Core == true
40    log_printf(INFO,Core,FUNCTION,_("<%s> Parameters"),_name.c_str());
41
42    std::cout << *param << std::endl;
43#endif   
44
45    log_printf(INFO,Icache_Access,FUNCTION,_("<%s> : Allocation"),_name.c_str());
46
47    allocation (
48#ifdef STATISTICS
49                param_statistics
50#endif
51                );
52
53#ifdef STATISTICS
54    if (usage_is_set(_usage,USE_STATISTICS))
55      { 
56        log_printf(INFO,Icache_Access,FUNCTION,_("<%s> : Allocation of statistics"),_name.c_str());
57
58        statistics_allocation(param_statistics);
59      }
60#endif
61
62#ifdef VHDL
63    if (usage_is_set(_usage,USE_VHDL))
64      {
65        // generate the vhdl
66        log_printf(INFO,Icache_Access,FUNCTION,_("<%s> : Generate the vhdl"),_name.c_str());
67       
68        vhdl();
69      }
70#endif
71
72#ifdef SYSTEMC
73    if (usage_is_set(_usage,USE_SYSTEMC))
74      {
75        log_printf(INFO,Icache_Access,FUNCTION,_("<%s> : Method - transition"),_name.c_str());
76
77        SC_METHOD (transition);
78        dont_initialize ();
79        sensitive << (*(in_CLOCK)).pos();
80       
81# ifdef SYSTEMCASS_SPECIFIC
82        // List dependency information
83# endif   
84
85//      log_printf(INFO,Icache_Access,FUNCTION,_("<%s> : Method - genMoore"),_name.c_str());
86
87//      SC_METHOD (genMoore);
88//      dont_initialize ();
89//      sensitive << (*(in_CLOCK)).neg(); // need internal register
90       
91// # ifdef SYSTEMCASS_SPECIFIC
92//      // List dependency information
93// # endif   
94
95        log_printf(INFO,Icache_Access,FUNCTION,_("<%s> : Method - genMealy_req"),_name.c_str());
96
97        SC_METHOD (genMealy_req);
98        dont_initialize ();
99        sensitive << (*(in_CLOCK)).neg(); // need internal register
100
101        for (uint32_t i=0; i<_param->_nb_icache_port; ++i)
102          sensitive << (*(in_ICACHE_REQ_ACK [i]));
103        for (uint32_t i=0; i<_param->_nb_front_end; ++i)
104          for (uint32_t j=0; j<_param->_nb_context[i]; ++j)
105            {
106              sensitive << (*(in_CONTEXT_REQ_VAL        [i][j]))
107                        << (*(in_CONTEXT_REQ_ADDRESS    [i][j]))
108                        << (*(in_CONTEXT_REQ_TYPE       [i][j]));
109              if (_param->_have_port_packet_id [i][j])
110              sensitive << (*(in_CONTEXT_REQ_PACKET_ID  [i][j]));
111            }
112
113# ifdef SYSTEMCASS_SPECIFIC
114        // List dependency information
115
116        for (uint32_t i=0; i<_param->_nb_icache_port; ++i)
117          {
118            for (uint32_t x=0; x<_param->_nb_icache_port; ++x)
119              {
120                (*(out_ICACHE_REQ_VAL       [i])) (*(in_ICACHE_REQ_ACK [x]));
121                if (_param->_have_port_icache_thread_id)
122                (*(out_ICACHE_REQ_THREAD_ID [i])) (*(in_ICACHE_REQ_ACK [x]));
123                if (_param->_have_port_icache_packet_id)
124                (*(out_ICACHE_REQ_PACKET_ID [i])) (*(in_ICACHE_REQ_ACK [x]));
125                (*(out_ICACHE_REQ_ADDRESS   [i])) (*(in_ICACHE_REQ_ACK [x]));
126                (*(out_ICACHE_REQ_TYPE      [i])) (*(in_ICACHE_REQ_ACK [x]));
127              }
128            for (uint32_t x=0; x<_param->_nb_front_end; ++x)
129              for (uint32_t y=0; y<_param->_nb_context[x]; ++y)
130                {
131                  (*(out_ICACHE_REQ_VAL       [i])) (*(in_CONTEXT_REQ_VAL        [x][y]));
132                  if (_param->_have_port_packet_id [x][y])
133                  (*(out_ICACHE_REQ_PACKET_ID [i])) (*(in_CONTEXT_REQ_PACKET_ID  [x][y]));
134                  (*(out_ICACHE_REQ_ADDRESS   [i])) (*(in_CONTEXT_REQ_ADDRESS    [x][y]));
135                  (*(out_ICACHE_REQ_TYPE      [i])) (*(in_CONTEXT_REQ_TYPE       [x][y]));
136                }
137          }
138
139        for (uint32_t i=0; i<_param->_nb_front_end; ++i)
140          for (uint32_t j=0; j<_param->_nb_context[i]; ++j)
141            {
142              for (uint32_t x=0; x<_param->_nb_front_end; ++x)
143                for (uint32_t y=0; y<_param->_nb_context[x]; ++y)
144                  (*(out_CONTEXT_REQ_ACK [i][j])) (*(in_CONTEXT_REQ_VAL        [x][y]));
145
146              for (uint32_t x=0; x<_param->_nb_icache_port; ++x)
147                (*(out_CONTEXT_REQ_ACK [i][j])) (*(in_ICACHE_REQ_ACK [x]));
148            }
149# endif   
150
151        log_printf(INFO,Icache_Access,FUNCTION,_("<%s> : Method - genMealy_rsp"),_name.c_str());
152
153        SC_METHOD (genMealy_rsp);
154        dont_initialize ();
155        sensitive << (*(in_CLOCK)).neg(); // need internal register
156        for (uint32_t i=0; i<_param->_nb_icache_port; ++i)
157          {
158            sensitive << (*(in_ICACHE_RSP_VAL         [i]))
159                      << (*(in_ICACHE_RSP_ERROR       [i]));
160            if (_param->_have_port_icache_thread_id)
161            sensitive << (*(in_ICACHE_RSP_THREAD_ID   [i]));
162            if (_param->_have_port_icache_packet_id)
163            sensitive << (*(in_ICACHE_RSP_PACKET_ID   [i]));
164
165            for (uint32_t j=0; j<_param->_icache_nb_instruction[i]; ++j)
166              sensitive << (*(in_ICACHE_RSP_INSTRUCTION [i][j]));
167          }
168       
169        for (uint32_t i=0; i<_param->_nb_front_end; ++i)
170          for (uint32_t j=0; j<_param->_nb_context[i]; ++j)
171            sensitive << (*(in_CONTEXT_RSP_ACK [i][j]));
172
173
174       
175# ifdef SYSTEMCASS_SPECIFIC
176        // List dependency information
177
178        for (uint32_t i=0; i<_param->_nb_icache_port; ++i)
179          {
180            if (_param->_have_port_icache_thread_id)
181            (*(out_ICACHE_RSP_ACK [i])) (*(in_ICACHE_RSP_THREAD_ID   [i]));
182
183            for (uint32_t x=0; x<_param->_nb_front_end; ++x)
184              for (uint32_t y=0; y<_param->_nb_context[x]; ++y)
185                (*(out_ICACHE_RSP_ACK [i])) (*(in_CONTEXT_RSP_ACK [x][y]));
186          }
187
188        for (uint32_t i=0; i<_param->_nb_front_end; ++i)
189          for (uint32_t j=0; j<_param->_nb_context[i]; ++j)
190            for (uint32_t x=0; x<_param->_nb_icache_port; ++x)
191              {
192                if (_param->_have_port_icache_thread_id)
193                  {
194                    (*(out_CONTEXT_RSP_VAL         [i][j]))    (*(in_ICACHE_RSP_THREAD_ID   [x]));
195                    if (_param->_have_port_packet_id [i][j])
196                    (*(out_CONTEXT_RSP_PACKET_ID   [i][j]))    (*(in_ICACHE_RSP_THREAD_ID   [x]));
197                    (*(out_CONTEXT_RSP_ERROR       [i][j]))    (*(in_ICACHE_RSP_THREAD_ID   [x]));
198                    for (uint32_t k=0; k<_param->_nb_instruction [i][j]; ++k)
199                    (*(out_CONTEXT_RSP_INSTRUCTION [i][j][k])) (*(in_ICACHE_RSP_THREAD_ID   [x]));
200                  }
201
202                (*(out_CONTEXT_RSP_VAL         [i][j]))    (*(in_ICACHE_RSP_VAL         [x]));
203                if (_param->_have_port_packet_id [i][j])
204                (*(out_CONTEXT_RSP_PACKET_ID   [i][j]))    (*(in_ICACHE_RSP_PACKET_ID   [x]));
205                (*(out_CONTEXT_RSP_ERROR       [i][j]))    (*(in_ICACHE_RSP_ERROR       [x]));
206                for (uint32_t k=0; k<_param->_nb_instruction [i][j]; ++k)
207                  for (uint32_t y=0; y<_param->_icache_nb_instruction[x]; ++y)
208                    (*(out_CONTEXT_RSP_INSTRUCTION [i][j][k])) (*(in_ICACHE_RSP_INSTRUCTION [x][y]));
209              }
210# endif
211       
212#endif
213      }
214    log_end(Icache_Access,FUNCTION);
215  };
216   
217#undef  FUNCTION
218#define FUNCTION "Icache_Access::~Icache_Access"
219  Icache_Access::~Icache_Access (void)
220  {
221    log_begin(Icache_Access,FUNCTION);
222
223#ifdef STATISTICS
224    if (usage_is_set(_usage,USE_STATISTICS))
225      {
226        statistics_deallocation();
227      }
228#endif
229
230    log_printf(INFO,Icache_Access,FUNCTION,_("<%s> : Deallocation"),_name.c_str());
231    deallocation ();
232
233    log_end(Icache_Access,FUNCTION);
234  };
235
236}; // end namespace icache_access
237}; // end namespace core
238
239}; // end namespace behavioural
240}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.