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

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

1) Fix performance
2) add auto generation to SPECINT2000
3) add reset in genMoore and genMealy

  • Property svn:keywords set to Id
File size: 5.2 KB
Line 
1/*
2 * $Id: Return_Address_Stack.cpp 123 2009-06-08 20:43:30Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Return_Address_Stack/include/Return_Address_Stack.h"
9
10namespace morpheo                    {
11namespace behavioural {
12namespace core {
13namespace multi_front_end {
14namespace front_end {
15namespace prediction_unit {
16namespace return_address_stack {
17
18
19#undef  FUNCTION
20#define FUNCTION "Return_Address_Stack::Return_Address_Stack"
21  Return_Address_Stack::Return_Address_Stack
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::return_address_stack::Parameters * param,
32   morpheo::behavioural::Tusage_t usage
33   ):
34    _name              (name)
35    ,_param            (param)
36    ,_usage            (usage)
37  {
38    log_printf(FUNC,Return_Address_Stack,FUNCTION,"Begin");
39
40// #if DEBUG_Return_Address_Stac == true
41//     log_printf(INFO,Return_Address_Stac,FUNCTION,_("<%s> Parameters"),_name.c_str());
42
43//     std::cout << *param << std::endl;
44// #endif   
45
46    log_printf(INFO,Return_Address_Stack,FUNCTION,"Allocation");
47
48    allocation (
49#ifdef STATISTICS
50                param_statistics
51#endif
52                );
53
54#ifdef STATISTICS
55    if (usage_is_set(_usage,USE_STATISTICS))
56      { 
57        log_printf(INFO,Return_Address_Stack,FUNCTION,"Allocation of statistics");
58
59        statistics_allocation(param_statistics);
60      }
61#endif
62
63#ifdef VHDL
64    if (usage_is_set(_usage,USE_VHDL))
65      {
66        // generate the vhdl
67        log_printf(INFO,Return_Address_Stack,FUNCTION,"Generate the vhdl");
68       
69        vhdl();
70      }
71#endif
72
73#ifdef SYSTEMC
74    if (usage_is_set(_usage,USE_SYSTEMC))
75      {
76        for (uint32_t i=0; i<_param->_nb_inst_predict; i++)
77          {
78            internal_PREDICT_ACK [i] = 1;
79            PORT_WRITE(out_PREDICT_ACK [i], internal_PREDICT_ACK [i]);
80          }
81        for (uint32_t i=0; i<_param->_nb_inst_decod  ; i++)
82          {
83            internal_DECOD_ACK   [i] = 1;
84            PORT_WRITE(out_DECOD_ACK   [i], internal_DECOD_ACK   [i]);
85          }
86        for (uint32_t i=0; i<_param->_nb_inst_update ; i++)
87          {
88            internal_UPDATE_ACK  [i] = 1;
89            PORT_WRITE(out_UPDATE_ACK  [i], internal_UPDATE_ACK  [i]);
90          }
91
92        log_printf(INFO,Return_Address_Stack,FUNCTION,"Method - transition");
93
94        SC_METHOD (transition);
95        dont_initialize ();
96        sensitive << (*(in_CLOCK)).pos();
97       
98# ifdef SYSTEMCASS_SPECIFIC
99        // List dependency information
100# endif   
101
102        log_printf(INFO,Return_Address_Stack,FUNCTION,"Method - genMealy_decod");
103
104        SC_METHOD (genMealy_decod);
105        dont_initialize ();
106        sensitive << (*(in_CLOCK)).neg(); // use internal registers
107        for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
108          {
109            if (_param->_have_port_context_id)
110            sensitive << (*( in_DECOD_CONTEXT_ID [i])); 
111            sensitive << (*( in_DECOD_PUSH       [i]));
112          }
113
114# ifdef SYSTEMCASS_SPECIFIC
115        // List dependency information
116        for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
117          {
118            if (_param->_have_port_context_id)
119            (*(out_DECOD_HIT         [i])) (*( in_DECOD_CONTEXT_ID [i]));
120            (*(out_DECOD_HIT         [i])) (*( in_DECOD_PUSH       [i]));
121
122            if (_param->_have_port_context_id)
123            (*(out_DECOD_ADDRESS_POP [i])) (*( in_DECOD_CONTEXT_ID [i]));
124            (*(out_DECOD_ADDRESS_POP [i])) (*( in_DECOD_PUSH       [i]));
125
126            if (_param->_have_port_context_id)
127            (*(out_DECOD_INDEX       [i])) (*( in_DECOD_CONTEXT_ID [i]));
128            (*(out_DECOD_INDEX       [i])) (*( in_DECOD_PUSH       [i]));
129          }
130# endif
131
132        log_printf(INFO,Return_Address_Stack,FUNCTION,"Method - genMealy_predict");
133
134        SC_METHOD (genMealy_predict);
135        dont_initialize ();
136        sensitive << (*(in_CLOCK)).neg(); // use internal registers
137        for (uint32_t i=0; i<_param->_nb_inst_predict; i++)
138          {
139            if (_param->_have_port_context_id)
140            sensitive << (*( in_PREDICT_CONTEXT_ID [i])); 
141            sensitive << (*( in_PREDICT_PUSH       [i]));
142          }
143
144# ifdef SYSTEMCASS_SPECIFIC
145        // List dependency information
146        for (uint32_t i=0; i<_param->_nb_inst_predict; i++)
147          {
148            if (_param->_have_port_context_id)
149            (*(out_PREDICT_HIT         [i])) (*( in_PREDICT_CONTEXT_ID [i]));
150            (*(out_PREDICT_HIT         [i])) (*( in_PREDICT_PUSH       [i]));
151
152            if (_param->_have_port_context_id)
153            (*(out_PREDICT_ADDRESS_POP [i])) (*( in_PREDICT_CONTEXT_ID [i]));
154            (*(out_PREDICT_ADDRESS_POP [i])) (*( in_PREDICT_PUSH       [i]));
155
156            if (_param->_have_port_context_id)
157            (*(out_PREDICT_INDEX       [i])) (*( in_PREDICT_CONTEXT_ID [i]));
158            (*(out_PREDICT_INDEX       [i])) (*( in_PREDICT_PUSH       [i]));
159          }
160# endif
161#endif
162      }
163    log_printf(FUNC,Return_Address_Stack,FUNCTION,"End");
164  };
165   
166#undef  FUNCTION
167#define FUNCTION "Return_Address_Stack::~Return_Address_Stack"
168  Return_Address_Stack::~Return_Address_Stack (void)
169  {
170    log_printf(FUNC,Return_Address_Stack,FUNCTION,"Begin");
171
172#ifdef STATISTICS
173    if (usage_is_set(_usage,USE_STATISTICS))
174      {
175        statistics_deallocation();
176      }
177#endif
178
179    log_printf(INFO,Return_Address_Stack,FUNCTION,"Deallocation");
180    deallocation ();
181
182    log_printf(FUNC,Return_Address_Stack,FUNCTION,"End");
183  };
184
185}; // end namespace return_address_stack
186}; // end namespace prediction_unit
187}; // end namespace front_end
188}; // end namespace multi_front_end
189}; // end namespace core
190
191}; // end namespace behavioural
192}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.