source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Execute_unit/Execute_unit/Load_store_unit/src/Load_store_unit.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: 5.9 KB
Line 
1/*
2 * $Id: Load_store_unit.cpp 88 2008-12-10 18:31:39Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Execute_unit/Execute_unit/Load_store_unit/include/Load_store_unit.h"
9
10namespace morpheo                    {
11namespace behavioural {
12namespace core {
13namespace multi_execute_loop {
14namespace execute_loop {
15namespace multi_execute_unit {
16namespace execute_unit {
17namespace load_store_unit {
18
19
20#undef  FUNCTION
21#define FUNCTION "Load_store_unit::Load_store_unit"
22  Load_store_unit::Load_store_unit
23  (
24#ifdef SYSTEMC
25   sc_module_name name,
26#else
27   std::string name,
28#endif
29#ifdef STATISTICS
30   morpheo::behavioural::Parameters_Statistics * param_statistics,
31#endif
32   morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Parameters * param ,
33   morpheo::behavioural::Tusage_t usage
34   ):
35    _name              (name)
36    ,_param            (param)
37    ,_usage (usage)
38  {
39    log_printf(FUNC,Load_store_unit,FUNCTION,"Begin");
40
41#if DEBUG_Load_store_unit == true
42    log_printf(INFO,Load_store_unit,FUNCTION,_("<%s> Parameters"),_name.c_str());
43
44    std::cout << *param << std::endl;
45#endif   
46
47#ifdef SYSTEMC
48    log_printf(INFO,Load_store_unit,FUNCTION,"Allocation");
49
50    allocation ();
51#endif
52
53#ifdef STATISTICS
54    if (usage_is_set(_usage,USE_STATISTICS))
55      { 
56        log_printf(INFO,Load_store_unit,FUNCTION,"Allocation of statistics");
57       
58        statistics_declaration(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,Load_store_unit,FUNCTION,"Generate the vhdl");
67       
68        vhdl();
69      }
70#endif
71
72#ifdef SYSTEMC
73    if (usage_is_set(_usage,USE_SYSTEMC))
74      { 
75    // Function pointer
76
77    switch (_param->_speculative_load)
78      {
79      case SPECULATIVE_LOAD_COMMIT :
80        {
81          function_transition      = &morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Load_store_unit::function_speculative_load_commit_transition     ;
82          function_genMoore        = &morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Load_store_unit::function_speculative_load_commit_genMoore       ;
83          function_genMealy_dcache = &morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Load_store_unit::function_speculative_load_commit_genMealy_dcache;
84          function_genMealy_insert = &morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Load_store_unit::function_speculative_load_commit_genMealy_insert;
85          function_genMealy_retire = &morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Load_store_unit::function_speculative_load_commit_genMealy_retire;
86          break;
87        }
88      case NO_SPECULATIVE_LOAD     :
89      case SPECULATIVE_LOAD_ACCESS :
90        //case SPECULATIVE_LOAD_BYPASS :
91      default                      :
92        {
93          break;
94        }
95      }
96
97    log_printf(INFO,Load_store_unit,FUNCTION,"Constant affectation");
98
99    internal_DCACHE_RSP_ACK = 1;
100    PORT_WRITE(out_DCACHE_RSP_ACK [0], internal_DCACHE_RSP_ACK);
101    for (uint32_t i=1; i<_param->_nb_cache_port; ++i)
102      {
103        PORT_WRITE(out_DCACHE_RSP_ACK [i], 0);
104        PORT_WRITE(out_DCACHE_REQ_VAL [i], 0);
105      }
106
107    for (uint32_t i=1; i<_param->_nb_inst_memory; i++)
108      {
109        PORT_WRITE(out_MEMORY_OUT_VAL [i], 0);
110      }
111
112    log_printf(INFO,Load_store_unit,FUNCTION,"Method - transition");
113
114    SC_METHOD (transition);
115    dont_initialize ();
116    sensitive_pos << *(in_CLOCK);
117
118#ifdef SYSTEMCASS_SPECIFIC
119    // List dependency information
120#endif   
121
122    log_printf(INFO,Load_store_unit,FUNCTION,"Method - genMoore");
123
124    SC_METHOD (genMoore);
125    dont_initialize ();
126    sensitive_neg << *(in_CLOCK);
127
128#ifdef SYSTEMCASS_SPECIFIC
129    // List dependency information
130#endif   
131
132    log_printf(INFO,Load_store_unit,FUNCTION,"Method - genMealy_insert");
133
134    SC_METHOD (genMealy_insert);
135    dont_initialize ();
136    sensitive_neg << *(in_CLOCK);
137    for (uint32_t i=0; i<_param->_nb_inst_memory; i++)
138      sensitive << (*(in_MEMORY_IN_VAL       [i]))
139                << (*(in_MEMORY_IN_OPERATION [i]));
140
141#ifdef SYSTEMCASS_SPECIFIC
142    // List dependency information
143    for (uint32_t i=0; i<_param->_nb_inst_memory; i++)
144//       for (uint32_t x=0; x<_param->_nb_inst_memory; x++)
145        {
146          (*(out_MEMORY_IN_ACK [i])) (*(in_MEMORY_IN_VAL       [i]));
147          (*(out_MEMORY_IN_ACK [i])) (*(in_MEMORY_IN_OPERATION [i]));
148        }
149#endif   
150
151    log_printf(INFO,Load_store_unit,FUNCTION,"Method - genMealy_retire");
152
153    SC_METHOD (genMealy_retire);
154    dont_initialize ();
155    sensitive_neg << *(in_CLOCK);
156
157#ifdef SYSTEMCASS_SPECIFIC
158    // List dependency information
159#endif   
160
161    log_printf(INFO,Load_store_unit,FUNCTION,"Method - genMealy_dcache");
162
163    SC_METHOD (genMealy_dcache);
164    dont_initialize ();
165    sensitive_neg << *(in_CLOCK);
166
167#ifdef SYSTEMCASS_SPECIFIC
168    // List dependency information
169#endif   
170      }
171#endif
172    log_printf(FUNC,Load_store_unit,FUNCTION,"End");
173  };
174 
175#undef  FUNCTION
176#define FUNCTION "Load_store_unit::~Load_store_unit"
177  Load_store_unit::~Load_store_unit (void)
178  {
179    log_printf(FUNC,Load_store_unit,FUNCTION,"Begin");
180
181#ifdef STATISTICS
182    if (usage_is_set(_usage,USE_STATISTICS))
183      { 
184        log_printf(INFO,Load_store_unit,FUNCTION,"Generate Statistics file");
185       
186        delete _stat;
187      }
188#endif
189
190#ifdef SYSTEMC
191    log_printf(INFO,Load_store_unit,FUNCTION,"Deallocation");
192
193    deallocation ();
194#endif
195
196    log_printf(FUNC,Load_store_unit,FUNCTION,"End");
197  };
198
199}; // end namespace load_store_unit
200}; // end namespace execute_unit
201}; // end namespace multi_execute_unit
202}; // end namespace execute_loop
203}; // end namespace multi_execute_loop
204}; // end namespace core
205
206}; // end namespace behavioural
207}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.