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

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

Almost complete design
with Test and test platform

  • Property svn:keywords set to Id
File size: 4.4 KB
Line 
1/*
2 * $Id: Dcache_Access.cpp 88 2008-12-10 18:31:39Z 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        for (uint32_t i=0; i<_param->_nb_dcache_port; ++i)
101          sensitive << (*(in_DCACHE_REQ_ACK [i]));
102        for (uint32_t i=0; i<_param->_nb_execute_loop; ++i)
103          for (uint32_t j=0; j<_param->_nb_load_store_unit[i]; ++j)
104            for (uint32_t k=0; k<_param->_nb_cache_access [i][j]; ++k)
105              {
106                sensitive << (*(in_LSQ_REQ_VAL       [i][j][k]))
107                          << (*(in_LSQ_REQ_ADDRESS   [i][j][k]))
108                          << (*(in_LSQ_REQ_WDATA     [i][j][k]))
109                          << (*(in_LSQ_REQ_TYPE      [i][j][k]));
110               
111                if (_param->_have_port_lsq_thread_id [i][j])
112                  sensitive << (*(in_LSQ_REQ_THREAD_ID [i][j][k]));
113                if (_param->_have_port_lsq_packet_id [i][j])
114                sensitive << (*(in_LSQ_REQ_PACKET_ID [i][j][k]));
115              }
116
117
118# ifdef SYSTEMCASS_SPECIFIC
119        // List dependency information
120# endif   
121
122        log_printf(INFO,Dcache_Access,FUNCTION,_("<%s> : Method - genMealy_rsp"),_name.c_str());
123
124        SC_METHOD (genMealy_rsp);
125        dont_initialize ();
126        sensitive << (*(in_CLOCK)).neg(); // need internal register
127
128        for (uint32_t i=0; i<_param->_nb_dcache_port; ++i)
129          {
130            sensitive << (*(in_DCACHE_RSP_VAL       [i]))
131                      << (*(in_DCACHE_RSP_RDATA     [i]))
132                      << (*(in_DCACHE_RSP_ERROR     [i]));
133            if (_param->_have_port_dcache_thread_id)
134            sensitive << (*(in_DCACHE_RSP_THREAD_ID [i]));
135            if (_param->_have_port_dcache_packet_id)
136            sensitive << (*(in_DCACHE_RSP_PACKET_ID [i]));
137
138          }
139        for (uint32_t i=0; i<_param->_nb_execute_loop; ++i)
140          for (uint32_t j=0; j<_param->_nb_load_store_unit[i]; ++j)
141            for (uint32_t k=0; k<_param->_nb_cache_access [i][j]; ++k)
142              sensitive << (*(in_LSQ_RSP_ACK [i][j][k]));
143
144
145
146# ifdef SYSTEMCASS_SPECIFIC
147        // List dependency information
148# endif   
149
150#endif
151      }
152    log_end(Dcache_Access,FUNCTION);
153  };
154   
155#undef  FUNCTION
156#define FUNCTION "Dcache_Access::~Dcache_Access"
157  Dcache_Access::~Dcache_Access (void)
158  {
159    log_begin(Dcache_Access,FUNCTION);
160
161#ifdef STATISTICS
162    if (usage_is_set(_usage,USE_STATISTICS))
163      {
164        statistics_deallocation();
165      }
166#endif
167
168    log_printf(INFO,Dcache_Access,FUNCTION,_("<%s> : Deallocation"),_name.c_str());
169    deallocation ();
170
171    log_end(Dcache_Access,FUNCTION);
172  };
173
174}; // end namespace dcache_access
175}; // end namespace core
176
177}; // end namespace behavioural
178}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.