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

Last change on this file since 82 was 82, checked in by rosiere, 16 years ago
  • support locale (now must "just" translate)
  • update all component with new test format
  • update all component with usage
  • New component : decod queue and prediction_unit
  • Property svn:keywords set to Id
File size: 6.6 KB
Line 
1/*
2 * $Id: Update_Prediction_Table.cpp 82 2008-05-01 16:48:45Z 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    log_printf(INFO,Update_Prediction_Table,FUNCTION,"Allocation");
43
44    allocation (
45#ifdef STATISTICS
46                param_statistics
47#endif
48                );
49
50#ifdef STATISTICS
51    if (_usage & USE_STATISTICS)
52      { 
53        log_printf(INFO,Update_Prediction_Table,FUNCTION,"Allocation of statistics");
54
55        statistics_allocation(param_statistics);
56      }
57#endif
58
59#ifdef VHDL
60    if (_usage & USE_VHDL)
61      {
62        // generate the vhdl
63        log_printf(INFO,Update_Prediction_Table,FUNCTION,"Generate the vhdl");
64       
65        vhdl();
66      }
67#endif
68
69#ifdef SYSTEMC
70    if (_usage & USE_SYSTEMC)
71      {
72
73        for (uint32_t i=0; i<_param->_nb_inst_branch_complete; i++)
74          {
75            internal_BRANCH_COMPLETE_ACK [i] = 1;
76            PORT_WRITE(out_BRANCH_COMPLETE_ACK [i], internal_BRANCH_COMPLETE_ACK [i]);
77          }
78
79        log_printf(INFO,Update_Prediction_Table,FUNCTION,"Method - transition");
80
81        SC_METHOD (transition);
82        dont_initialize ();
83        sensitive << (*(in_CLOCK)).pos();
84       
85# ifdef SYSTEMCASS_SPECIFIC
86        // List dependency information
87# endif   
88
89        log_printf(INFO,Update_Prediction_Table,FUNCTION,"Method - genMoore");
90
91        SC_METHOD (genMoore);
92        dont_initialize ();
93        sensitive << (*(in_CLOCK)).neg();
94       
95# ifdef SYSTEMCASS_SPECIFIC
96        // List dependency information
97# endif   
98
99        log_printf(INFO,Update_Prediction_Table,FUNCTION,"Method - genMealy_predict");
100
101        SC_METHOD (genMealy_predict);
102        dont_initialize ();
103        sensitive << (*(in_CLOCK)).neg(); // use internal register
104        for (uint32_t i=0; i<_param->_nb_inst_predict; i++)
105          {
106            if (_param->_have_port_context_id)
107              sensitive << (*(in_PREDICT_CONTEXT_ID [i]));
108            sensitive << (*(in_PREDICT_BTB_IS_ACCURATE [i]));
109          }
110       
111# ifdef SYSTEMCASS_SPECIFIC
112        // List dependency information
113        for (uint32_t i=0; i<_param->_nb_inst_predict; i++)
114          {
115            (*(out_PREDICT_ACK                  [i])) (*(in_PREDICT_BTB_IS_ACCURATE [i]));
116            if (_param->_have_port_context_id)
117            (*(out_PREDICT_ACK                  [i])) (*(in_PREDICT_CONTEXT_ID      [i]));
118          }
119# endif   
120
121        log_printf(INFO,Update_Prediction_Table,FUNCTION,"Method - genMealy_decod");
122
123        SC_METHOD (genMealy_decod);
124        dont_initialize ();
125        sensitive << (*(in_CLOCK)).neg(); // use internal register
126        for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
127          {
128            if (_param->_have_port_context_id)
129              sensitive << (*(in_DECOD_CONTEXT_ID [i]));
130            sensitive << (*(in_DECOD_MISS_IFETCH [i]))
131                      << (*(in_DECOD_MISS_DECOD  [i]));
132          }
133       
134# ifdef SYSTEMCASS_SPECIFIC
135        // List dependency information
136        for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
137          {
138            (*(out_DECOD_ACK                  [i])) (*(in_DECOD_MISS_IFETCH [i]));
139            (*(out_DECOD_ACK                  [i])) (*(in_DECOD_MISS_DECOD  [i]));
140            if (_param->_have_port_context_id)
141            (*(out_DECOD_ACK                  [i])) (*(in_DECOD_CONTEXT_ID  [i]));
142          }
143# endif   
144
145        log_printf(INFO,Update_Prediction_Table,FUNCTION,"Method - genMealy_branch_complete");
146
147        SC_METHOD (genMealy_branch_complete);
148        dont_initialize ();
149        sensitive << (*(in_CLOCK)).neg(); // use internal register
150        for (uint32_t i=0; i<_param->_nb_inst_branch_complete; i++)
151          {
152            if (_param->_have_port_context_id)
153            sensitive << (*(in_BRANCH_COMPLETE_CONTEXT_ID [i]));
154            if (_param->_have_port_max_depth)
155            sensitive << (*(in_BRANCH_COMPLETE_DEPTH [i]));
156            sensitive << (*(in_BRANCH_COMPLETE_FLAG    [i]))
157                      << (*(in_BRANCH_COMPLETE_ADDRESS [i]));
158          }
159       
160# ifdef SYSTEMCASS_SPECIFIC
161        // List dependency information
162        for (uint32_t i=0; i<_param->_nb_inst_branch_complete; i++)
163          {
164            if (_param->_have_port_context_id)
165            (*(out_BRANCH_COMPLETE_MISS_PREDICTION [i])) (*(in_BRANCH_COMPLETE_CONTEXT_ID [i]));
166            if (_param->_have_port_max_depth)
167            (*(out_BRANCH_COMPLETE_MISS_PREDICTION [i])) (*(in_BRANCH_COMPLETE_DEPTH      [i]));
168            (*(out_BRANCH_COMPLETE_MISS_PREDICTION [i])) (*(in_BRANCH_COMPLETE_FLAG       [i]));
169            (*(out_BRANCH_COMPLETE_MISS_PREDICTION [i])) (*(in_BRANCH_COMPLETE_ADDRESS    [i]));
170
171            if (_param->_have_port_context_id)
172            (*(out_BRANCH_COMPLETE_TAKE            [i])) (*(in_BRANCH_COMPLETE_CONTEXT_ID [i]));
173            if (_param->_have_port_max_depth)
174            (*(out_BRANCH_COMPLETE_TAKE            [i])) (*(in_BRANCH_COMPLETE_DEPTH      [i]));
175            (*(out_BRANCH_COMPLETE_TAKE            [i])) (*(in_BRANCH_COMPLETE_FLAG       [i]));
176
177            if (_param->_have_port_context_id)
178            (*(out_BRANCH_COMPLETE_ADDRESS_SRC     [i])) (*(in_BRANCH_COMPLETE_CONTEXT_ID [i]));
179            if (_param->_have_port_max_depth)
180            (*(out_BRANCH_COMPLETE_ADDRESS_SRC     [i])) (*(in_BRANCH_COMPLETE_DEPTH      [i]));
181
182            if (_param->_have_port_context_id)
183            (*(out_BRANCH_COMPLETE_ADDRESS_DEST    [i])) (*(in_BRANCH_COMPLETE_CONTEXT_ID [i]));
184            if (_param->_have_port_max_depth)
185            (*(out_BRANCH_COMPLETE_ADDRESS_DEST    [i])) (*(in_BRANCH_COMPLETE_DEPTH      [i]));
186            (*(out_BRANCH_COMPLETE_ADDRESS_DEST    [i])) (*(in_BRANCH_COMPLETE_ADDRESS    [i]));
187          }
188# endif   
189       
190#endif
191      }
192    log_printf(FUNC,Update_Prediction_Table,FUNCTION,"End");
193  };
194   
195#undef  FUNCTION
196#define FUNCTION "Update_Prediction_Table::~Update_Prediction_Table"
197  Update_Prediction_Table::~Update_Prediction_Table (void)
198  {
199    log_printf(FUNC,Update_Prediction_Table,FUNCTION,"Begin");
200
201#ifdef STATISTICS
202    if (_usage & USE_STATISTICS)
203      {
204        statistics_deallocation();
205      }
206#endif
207
208    log_printf(INFO,Update_Prediction_Table,FUNCTION,"Deallocation");
209    deallocation ();
210
211    log_printf(FUNC,Update_Prediction_Table,FUNCTION,"End");
212  };
213
214}; // end namespace update_prediction_table
215}; // end namespace prediction_unit
216}; // end namespace front_end
217}; // end namespace multi_front_end
218}; // end namespace core
219
220}; // end namespace behavioural
221}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.