source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table.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: 6.9 KB
Line 
1/*
2 * $Id: Update_Prediction_Table.cpp 132 2009-07-11 16:39:35Z 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                  << (*(in_NRESET));
116        for (uint32_t i=0; i<_param->_nb_inst_predict; i++)
117          {
118            if (_param->_have_port_context_id)
119              sensitive << (*(in_PREDICT_CONTEXT_ID [i]));
120//          sensitive << (*(in_PREDICT_BTB_IS_ACCURATE [i]));
121          }
122       
123# ifdef SYSTEMCASS_SPECIFIC
124        // List dependency information
125        for (uint32_t i=0; i<_param->_nb_inst_predict; i++)
126          {
127            (*(out_PREDICT_ACK                  [i])) (*(in_PREDICT_BTB_IS_ACCURATE [i]));
128            if (_param->_have_port_context_id)
129            (*(out_PREDICT_ACK                  [i])) (*(in_PREDICT_CONTEXT_ID      [i]));
130          }
131# endif   
132
133        log_printf(INFO,Update_Prediction_Table,FUNCTION,"Method - genMealy_decod");
134
135        SC_METHOD (genMealy_decod);
136        dont_initialize ();
137        sensitive << (*(in_CLOCK)).neg() // use internal register
138                  << (*(in_NRESET));
139        for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
140          {
141            if (_param->_have_port_context_id)
142              sensitive << (*(in_DECOD_CONTEXT_ID [i]));
143          }
144       
145// # ifdef SYSTEMCASS_SPECIFIC
146//      // List dependency information
147//      for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
148//        {
149//          if (_param->_have_port_context_id)
150//          (*(out_DECOD_ACK                  [i])) (*(in_DECOD_CONTEXT_ID  [i]));
151//        }
152// # endif   
153
154        log_printf(INFO,Update_Prediction_Table,FUNCTION,"Method - genMealy_branch_complete");
155
156        SC_METHOD (genMealy_branch_complete);
157        dont_initialize ();
158        sensitive << (*(in_CLOCK)).neg() // use internal register
159                  << (*(in_NRESET));
160        for (uint32_t i=0; i<_param->_nb_inst_branch_complete; i++)
161          {
162            if (_param->_have_port_context_id)
163            sensitive << (*(in_BRANCH_COMPLETE_CONTEXT_ID [i]));
164            if (_param->_have_port_depth)
165            sensitive << (*(in_BRANCH_COMPLETE_DEPTH [i]));
166            sensitive << (*(in_BRANCH_COMPLETE_VAL         [i]))
167                      << (*(in_BRANCH_COMPLETE_NO_SEQUENCE [i]))
168                      << (*(in_BRANCH_COMPLETE_ADDRESS     [i]));
169          }
170       
171# ifdef SYSTEMCASS_SPECIFIC
172//      // List dependency information
173//      for (uint32_t i=0; i<_param->_nb_inst_branch_complete; i++)
174//        {
175//          if (_param->_have_port_context_id)
176//          (*(out_BRANCH_COMPLETE_MISS_PREDICTION [i])) (*(in_BRANCH_COMPLETE_CONTEXT_ID [i]));
177//          if (_param->_have_port_depth)
178//          (*(out_BRANCH_COMPLETE_MISS_PREDICTION [i])) (*(in_BRANCH_COMPLETE_DEPTH      [i]));
179//          (*(out_BRANCH_COMPLETE_MISS_PREDICTION [i])) (*(in_BRANCH_COMPLETE_NO_SEQUENCE[i]));
180//          (*(out_BRANCH_COMPLETE_MISS_PREDICTION [i])) (*(in_BRANCH_COMPLETE_ADDRESS    [i]));
181
182// //       if (_param->_have_port_context_id)
183// //       (*(out_BRANCH_COMPLETE_TAKE            [i])) (*(in_BRANCH_COMPLETE_CONTEXT_ID [i]));
184// //       if (_param->_have_port_depth)
185// //       (*(out_BRANCH_COMPLETE_TAKE            [i])) (*(in_BRANCH_COMPLETE_DEPTH      [i]));
186// //       (*(out_BRANCH_COMPLETE_TAKE            [i])) (*(in_BRANCH_COMPLETE_NO_SEQUENCE[i]));
187
188// //       if (_param->_have_port_context_id)
189// //       (*(out_BRANCH_COMPLETE_ADDRESS_SRC     [i])) (*(in_BRANCH_COMPLETE_CONTEXT_ID [i]));
190// //       if (_param->_have_port_depth)
191// //       (*(out_BRANCH_COMPLETE_ADDRESS_SRC     [i])) (*(in_BRANCH_COMPLETE_DEPTH      [i]));
192
193// //       if (_param->_have_port_context_id)
194// //       (*(out_BRANCH_COMPLETE_ADDRESS_DEST    [i])) (*(in_BRANCH_COMPLETE_CONTEXT_ID [i]));
195// //       if (_param->_have_port_depth)
196// //       (*(out_BRANCH_COMPLETE_ADDRESS_DEST    [i])) (*(in_BRANCH_COMPLETE_DEPTH      [i]));
197// //       (*(out_BRANCH_COMPLETE_ADDRESS_DEST    [i])) (*(in_BRANCH_COMPLETE_ADDRESS    [i]));
198//        }
199# endif   
200       
201#endif
202      }
203    log_printf(FUNC,Update_Prediction_Table,FUNCTION,"End");
204  };
205   
206#undef  FUNCTION
207#define FUNCTION "Update_Prediction_Table::~Update_Prediction_Table"
208  Update_Prediction_Table::~Update_Prediction_Table (void)
209  {
210    log_printf(FUNC,Update_Prediction_Table,FUNCTION,"Begin");
211
212#ifdef STATISTICS
213    if (usage_is_set(_usage,USE_STATISTICS))
214      {
215        statistics_deallocation();
216      }
217#endif
218
219    log_printf(INFO,Update_Prediction_Table,FUNCTION,"Deallocation");
220    deallocation ();
221
222    log_printf(FUNC,Update_Prediction_Table,FUNCTION,"End");
223  };
224
225}; // end namespace update_prediction_table
226}; // end namespace prediction_unit
227}; // end namespace front_end
228}; // end namespace multi_front_end
229}; // end namespace core
230
231}; // end namespace behavioural
232}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.