source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Dcache_Access/src/Dcache_Access.cpp @ 132

Last change on this file since 132 was 132, checked in by rosiere, 15 years ago

1) add constant method - compatibility with SystemC
2) add Script to test sensitive list
3) fix bug in sensitive list

  • Property svn:keywords set to Id
File size: 4.5 KB
Line 
1/*
2 * $Id: Dcache_Access.cpp 132 2009-07-11 16:39:35Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Core/Dcache_Access/include/Dcache_Access.h"
9
10namespace morpheo                    {
11namespace behavioural {
12namespace core {
13namespace dcache_access {
14
15
16#undef  FUNCTION
17#define FUNCTION "Dcache_Access::Dcache_Access"
18  Dcache_Access::Dcache_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::dcache_access::Parameters * param,
29   morpheo::behavioural::Tusage_t usage
30   ):
31    _name              (name)
32    ,_param            (param)
33    ,_usage            (usage)
34  {
35    log_begin(Dcache_Access,FUNCTION);
36
37    usage_environment(_usage);
38
39// #if DEBUG_Dcache_Access == true
40//     log_printf(INFO,Dcache_Access,FUNCTION,_("<%s> Parameters"),_name.c_str());
41
42//     std::cout << *param << std::endl;
43// #endif   
44
45    log_printf(INFO,Dcache_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,Dcache_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,Dcache_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,Dcache_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,Dcache_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,Dcache_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                  << (*(in_NRESET));
101        for (uint32_t i=0; i<_param->_nb_dcache_port; ++i)
102          sensitive << (*(in_DCACHE_REQ_ACK [i]));
103        for (uint32_t i=0; i<_param->_nb_execute_loop; ++i)
104          for (uint32_t j=0; j<_param->_nb_load_store_unit[i]; ++j)
105            for (uint32_t k=0; k<_param->_nb_cache_access [i][j]; ++k)
106              {
107                sensitive << (*(in_LSQ_REQ_VAL       [i][j][k]))
108                          << (*(in_LSQ_REQ_ADDRESS   [i][j][k]))
109                          << (*(in_LSQ_REQ_WDATA     [i][j][k]))
110                          << (*(in_LSQ_REQ_TYPE      [i][j][k]));
111               
112                if (_param->_have_port_lsq_thread_id [i][j])
113                  sensitive << (*(in_LSQ_REQ_THREAD_ID [i][j][k]));
114                if (_param->_have_port_lsq_packet_id [i][j])
115                sensitive << (*(in_LSQ_REQ_PACKET_ID [i][j][k]));
116              }
117
118
119# ifdef SYSTEMCASS_SPECIFIC
120        // List dependency information
121# endif   
122
123        log_printf(INFO,Dcache_Access,FUNCTION,_("<%s> : Method - genMealy_rsp"),_name.c_str());
124
125        SC_METHOD (genMealy_rsp);
126        dont_initialize ();
127        sensitive << (*(in_CLOCK)).neg() // need internal register
128                  << (*(in_NRESET));
129
130        for (uint32_t i=0; i<_param->_nb_dcache_port; ++i)
131          {
132            sensitive << (*(in_DCACHE_RSP_VAL       [i]))
133                      << (*(in_DCACHE_RSP_RDATA     [i]))
134                      << (*(in_DCACHE_RSP_ERROR     [i]));
135            if (_param->_have_port_dcache_thread_id)
136            sensitive << (*(in_DCACHE_RSP_THREAD_ID [i]));
137            if (_param->_have_port_dcache_packet_id)
138            sensitive << (*(in_DCACHE_RSP_PACKET_ID [i]));
139
140          }
141        for (uint32_t i=0; i<_param->_nb_execute_loop; ++i)
142          for (uint32_t j=0; j<_param->_nb_load_store_unit[i]; ++j)
143            for (uint32_t k=0; k<_param->_nb_cache_access [i][j]; ++k)
144              sensitive << (*(in_LSQ_RSP_ACK [i][j][k]));
145
146
147
148# ifdef SYSTEMCASS_SPECIFIC
149        // List dependency information
150# endif   
151
152#endif
153      }
154    log_end(Dcache_Access,FUNCTION);
155  };
156   
157#undef  FUNCTION
158#define FUNCTION "Dcache_Access::~Dcache_Access"
159  Dcache_Access::~Dcache_Access (void)
160  {
161    log_begin(Dcache_Access,FUNCTION);
162
163#ifdef STATISTICS
164    if (usage_is_set(_usage,USE_STATISTICS))
165      {
166        statistics_deallocation();
167      }
168#endif
169
170    log_printf(INFO,Dcache_Access,FUNCTION,_("<%s> : Deallocation"),_name.c_str());
171    deallocation ();
172
173    log_end(Dcache_Access,FUNCTION);
174  };
175
176}; // end namespace dcache_access
177}; // end namespace core
178
179}; // end namespace behavioural
180}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.