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

Last change on this file since 81 was 81, checked in by rosiere, 16 years ago
  • Finish Environment (and test)
  • Continue predictor_unit
  • Add external tools
  • svn keyword "Id" set
  • Property svn:keywords set to Id
File size: 6.5 KB
Line 
1/*
2 * $Id: Update_Prediction_Table.cpp 81 2008-04-15 18:40:01Z 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_PREDICTION [i]));
131          }
132       
133# ifdef SYSTEMCASS_SPECIFIC
134        // List dependency information
135        for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
136          {
137            (*(out_DECOD_ACK                  [i])) (*(in_DECOD_MISS_PREDICTION [i]));
138            if (_param->_have_port_context_id)
139            (*(out_DECOD_ACK                  [i])) (*(in_DECOD_CONTEXT_ID      [i]));
140          }
141# endif   
142
143        log_printf(INFO,Update_Prediction_Table,FUNCTION,"Method - genMealy_branch_complete");
144
145        SC_METHOD (genMealy_branch_complete);
146        dont_initialize ();
147        sensitive << (*(in_CLOCK)).neg(); // use internal register
148        for (uint32_t i=0; i<_param->_nb_inst_branch_complete; i++)
149          {
150            if (_param->_have_port_context_id)
151            sensitive << (*(in_BRANCH_COMPLETE_CONTEXT_ID [i]));
152            if (_param->_have_port_depth)
153            sensitive << (*(in_BRANCH_COMPLETE_DEPTH [i]));
154            sensitive << (*(in_BRANCH_COMPLETE_FLAG    [i]))
155                      << (*(in_BRANCH_COMPLETE_ADDRESS [i]));
156          }
157       
158# ifdef SYSTEMCASS_SPECIFIC
159        // List dependency information
160        for (uint32_t i=0; i<_param->_nb_inst_branch_complete; i++)
161          {
162            if (_param->_have_port_context_id)
163            (*(out_BRANCH_COMPLETE_MISS_PREDICTION [i])) (*(in_BRANCH_COMPLETE_CONTEXT_ID [i]));
164            if (_param->_have_port_depth)
165            (*(out_BRANCH_COMPLETE_MISS_PREDICTION [i])) (*(in_BRANCH_COMPLETE_DEPTH      [i]));
166            (*(out_BRANCH_COMPLETE_MISS_PREDICTION [i])) (*(in_BRANCH_COMPLETE_FLAG       [i]));
167            (*(out_BRANCH_COMPLETE_MISS_PREDICTION [i])) (*(in_BRANCH_COMPLETE_ADDRESS    [i]));
168
169            if (_param->_have_port_context_id)
170            (*(out_BRANCH_COMPLETE_TAKE            [i])) (*(in_BRANCH_COMPLETE_CONTEXT_ID [i]));
171            if (_param->_have_port_depth)
172            (*(out_BRANCH_COMPLETE_TAKE            [i])) (*(in_BRANCH_COMPLETE_DEPTH      [i]));
173            (*(out_BRANCH_COMPLETE_TAKE            [i])) (*(in_BRANCH_COMPLETE_FLAG       [i]));
174
175            if (_param->_have_port_context_id)
176            (*(out_BRANCH_COMPLETE_ADDRESS_SRC     [i])) (*(in_BRANCH_COMPLETE_CONTEXT_ID [i]));
177            if (_param->_have_port_depth)
178            (*(out_BRANCH_COMPLETE_ADDRESS_SRC     [i])) (*(in_BRANCH_COMPLETE_DEPTH      [i]));
179
180            if (_param->_have_port_context_id)
181            (*(out_BRANCH_COMPLETE_ADDRESS_DEST    [i])) (*(in_BRANCH_COMPLETE_CONTEXT_ID [i]));
182            if (_param->_have_port_depth)
183            (*(out_BRANCH_COMPLETE_ADDRESS_DEST    [i])) (*(in_BRANCH_COMPLETE_DEPTH      [i]));
184            (*(out_BRANCH_COMPLETE_ADDRESS_DEST    [i])) (*(in_BRANCH_COMPLETE_ADDRESS    [i]));
185          }
186# endif   
187       
188#endif
189      }
190    log_printf(FUNC,Update_Prediction_Table,FUNCTION,"End");
191  };
192   
193#undef  FUNCTION
194#define FUNCTION "Update_Prediction_Table::~Update_Prediction_Table"
195  Update_Prediction_Table::~Update_Prediction_Table (void)
196  {
197    log_printf(FUNC,Update_Prediction_Table,FUNCTION,"Begin");
198
199#ifdef STATISTICS
200    if (_usage & USE_STATISTICS)
201      {
202        statistics_deallocation();
203      }
204#endif
205
206    log_printf(INFO,Update_Prediction_Table,FUNCTION,"Deallocation");
207    deallocation ();
208
209    log_printf(FUNC,Update_Prediction_Table,FUNCTION,"End");
210  };
211
212}; // end namespace update_prediction_table
213}; // end namespace prediction_unit
214}; // end namespace front_end
215}; // end namespace multi_front_end
216}; // end namespace core
217
218}; // end namespace behavioural
219}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.