source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table.cpp @ 131

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

1) add constant method
2) test with systemc 2.2.0

  • Property svn:keywords set to Id
File size: 6.8 KB
Line 
1/*
2 * $Id: Update_Prediction_Table.cpp 131 2009-07-08 18:40:08Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/include/Update_Prediction_Table.h"
9
10namespace morpheo                    {
11namespace behavioural {
12namespace core {
13namespace multi_front_end {
14namespace front_end {
15namespace prediction_unit {
16namespace update_prediction_table {
17
18
19#undef  FUNCTION
20#define FUNCTION "Update_Prediction_Table::Update_Prediction_Table"
21  Update_Prediction_Table::Update_Prediction_Table
22  (
23#ifdef SYSTEMC
24   sc_module_name name,
25#else
26   string name,
27#endif
28#ifdef STATISTICS
29   morpheo::behavioural::Parameters_Statistics * param_statistics,
30#endif
31   morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::Parameters * param,
32   morpheo::behavioural::Tusage_t usage
33   ):
34    _name              (name)
35    ,_param            (param)
36    ,_usage            (usage)
37  {
38    log_printf(FUNC,Update_Prediction_Table,FUNCTION,"Begin");
39
40    usage_environment(_usage);
41
42// #if DEBUG_Update_Prediction_Table == true
43//     log_printf(INFO,Update_Prediction_Table,FUNCTION,_("<%s> Parameters"),_name.c_str());
44
45//     std::cout << *param << std::endl;
46// #endif   
47
48    log_printf(INFO,Update_Prediction_Table,FUNCTION,"Allocation");
49
50    allocation (
51#ifdef STATISTICS
52                param_statistics
53#endif
54                );
55
56#ifdef STATISTICS
57    if (usage_is_set(_usage,USE_STATISTICS))
58      { 
59        log_printf(INFO,Update_Prediction_Table,FUNCTION,"Allocation of statistics");
60
61        statistics_allocation(param_statistics);
62      }
63#endif
64
65#ifdef VHDL
66    if (usage_is_set(_usage,USE_VHDL))
67      {
68        // generate the vhdl
69        log_printf(INFO,Update_Prediction_Table,FUNCTION,"Generate the vhdl");
70       
71        vhdl();
72      }
73#endif
74
75#ifdef SYSTEMC
76    if (usage_is_set(_usage,USE_SYSTEMC))
77      {
78#ifdef SYSTEMCASS_SPECIFIC
79        constant();
80#else
81        log_printf(INFO,Update_Prediction_Table,FUNCTION,"Method - constant");
82
83        SC_METHOD (constant);
84//      dont_initialize ();
85       
86# ifdef SYSTEMCASS_SPECIFIC
87        // List dependency information
88# endif   
89#endif
90        log_printf(INFO,Update_Prediction_Table,FUNCTION,"Method - transition");
91
92        SC_METHOD (transition);
93        dont_initialize ();
94        sensitive << (*(in_CLOCK)).pos();
95       
96# ifdef SYSTEMCASS_SPECIFIC
97        // List dependency information
98# endif   
99
100        log_printf(INFO,Update_Prediction_Table,FUNCTION,"Method - genMoore");
101
102        SC_METHOD (genMoore);
103        dont_initialize ();
104        sensitive << (*(in_CLOCK)).neg(); // use internal register
105       
106# ifdef SYSTEMCASS_SPECIFIC
107        // List dependency information
108# endif   
109
110        log_printf(INFO,Update_Prediction_Table,FUNCTION,"Method - genMealy_predict");
111
112        SC_METHOD (genMealy_predict);
113        dont_initialize ();
114        sensitive << (*(in_CLOCK)).neg(); // use internal register
115        for (uint32_t i=0; i<_param->_nb_inst_predict; i++)
116          {
117            if (_param->_have_port_context_id)
118              sensitive << (*(in_PREDICT_CONTEXT_ID [i]));
119//          sensitive << (*(in_PREDICT_BTB_IS_ACCURATE [i]));
120          }
121       
122# ifdef SYSTEMCASS_SPECIFIC
123        // List dependency information
124        for (uint32_t i=0; i<_param->_nb_inst_predict; i++)
125          {
126            (*(out_PREDICT_ACK                  [i])) (*(in_PREDICT_BTB_IS_ACCURATE [i]));
127            if (_param->_have_port_context_id)
128            (*(out_PREDICT_ACK                  [i])) (*(in_PREDICT_CONTEXT_ID      [i]));
129          }
130# endif   
131
132        log_printf(INFO,Update_Prediction_Table,FUNCTION,"Method - genMealy_decod");
133
134        SC_METHOD (genMealy_decod);
135        dont_initialize ();
136        sensitive << (*(in_CLOCK)).neg(); // use internal register
137        for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
138          {
139            if (_param->_have_port_context_id)
140              sensitive << (*(in_DECOD_CONTEXT_ID [i]));
141          }
142       
143// # ifdef SYSTEMCASS_SPECIFIC
144//      // List dependency information
145//      for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
146//        {
147//          if (_param->_have_port_context_id)
148//          (*(out_DECOD_ACK                  [i])) (*(in_DECOD_CONTEXT_ID  [i]));
149//        }
150// # endif   
151
152        log_printf(INFO,Update_Prediction_Table,FUNCTION,"Method - genMealy_branch_complete");
153
154        SC_METHOD (genMealy_branch_complete);
155        dont_initialize ();
156        sensitive << (*(in_CLOCK)).neg(); // use internal register
157        for (uint32_t i=0; i<_param->_nb_inst_branch_complete; i++)
158          {
159            if (_param->_have_port_context_id)
160            sensitive << (*(in_BRANCH_COMPLETE_CONTEXT_ID [i]));
161            if (_param->_have_port_depth)
162            sensitive << (*(in_BRANCH_COMPLETE_DEPTH [i]));
163            sensitive << (*(in_BRANCH_COMPLETE_NO_SEQUENCE [i]))
164                      << (*(in_BRANCH_COMPLETE_ADDRESS [i]));
165          }
166       
167# ifdef SYSTEMCASS_SPECIFIC
168//      // List dependency information
169//      for (uint32_t i=0; i<_param->_nb_inst_branch_complete; i++)
170//        {
171//          if (_param->_have_port_context_id)
172//          (*(out_BRANCH_COMPLETE_MISS_PREDICTION [i])) (*(in_BRANCH_COMPLETE_CONTEXT_ID [i]));
173//          if (_param->_have_port_depth)
174//          (*(out_BRANCH_COMPLETE_MISS_PREDICTION [i])) (*(in_BRANCH_COMPLETE_DEPTH      [i]));
175//          (*(out_BRANCH_COMPLETE_MISS_PREDICTION [i])) (*(in_BRANCH_COMPLETE_NO_SEQUENCE[i]));
176//          (*(out_BRANCH_COMPLETE_MISS_PREDICTION [i])) (*(in_BRANCH_COMPLETE_ADDRESS    [i]));
177
178// //       if (_param->_have_port_context_id)
179// //       (*(out_BRANCH_COMPLETE_TAKE            [i])) (*(in_BRANCH_COMPLETE_CONTEXT_ID [i]));
180// //       if (_param->_have_port_depth)
181// //       (*(out_BRANCH_COMPLETE_TAKE            [i])) (*(in_BRANCH_COMPLETE_DEPTH      [i]));
182// //       (*(out_BRANCH_COMPLETE_TAKE            [i])) (*(in_BRANCH_COMPLETE_NO_SEQUENCE[i]));
183
184// //       if (_param->_have_port_context_id)
185// //       (*(out_BRANCH_COMPLETE_ADDRESS_SRC     [i])) (*(in_BRANCH_COMPLETE_CONTEXT_ID [i]));
186// //       if (_param->_have_port_depth)
187// //       (*(out_BRANCH_COMPLETE_ADDRESS_SRC     [i])) (*(in_BRANCH_COMPLETE_DEPTH      [i]));
188
189// //       if (_param->_have_port_context_id)
190// //       (*(out_BRANCH_COMPLETE_ADDRESS_DEST    [i])) (*(in_BRANCH_COMPLETE_CONTEXT_ID [i]));
191// //       if (_param->_have_port_depth)
192// //       (*(out_BRANCH_COMPLETE_ADDRESS_DEST    [i])) (*(in_BRANCH_COMPLETE_DEPTH      [i]));
193// //       (*(out_BRANCH_COMPLETE_ADDRESS_DEST    [i])) (*(in_BRANCH_COMPLETE_ADDRESS    [i]));
194//        }
195# endif   
196       
197#endif
198      }
199    log_printf(FUNC,Update_Prediction_Table,FUNCTION,"End");
200  };
201   
202#undef  FUNCTION
203#define FUNCTION "Update_Prediction_Table::~Update_Prediction_Table"
204  Update_Prediction_Table::~Update_Prediction_Table (void)
205  {
206    log_printf(FUNC,Update_Prediction_Table,FUNCTION,"Begin");
207
208#ifdef STATISTICS
209    if (usage_is_set(_usage,USE_STATISTICS))
210      {
211        statistics_deallocation();
212      }
213#endif
214
215    log_printf(INFO,Update_Prediction_Table,FUNCTION,"Deallocation");
216    deallocation ();
217
218    log_printf(FUNC,Update_Prediction_Table,FUNCTION,"End");
219  };
220
221}; // end namespace update_prediction_table
222}; // end namespace prediction_unit
223}; // end namespace front_end
224}; // end namespace multi_front_end
225}; // end namespace core
226
227}; // end namespace behavioural
228}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.