source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State.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.0 KB
Line 
1/*
2 * $Id: Context_State.cpp 123 2009-06-08 20:43:30Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Core/Multi_Front_end/Front_end/Context_State/include/Context_State.h"
9
10namespace morpheo                    {
11namespace behavioural {
12namespace core {
13namespace multi_front_end {
14namespace front_end {
15namespace context_state {
16
17
18#undef  FUNCTION
19#define FUNCTION "Context_State::Context_State"
20  Context_State::Context_State
21  (
22#ifdef SYSTEMC
23   sc_module_name name,
24#else
25   string name,
26#endif
27#ifdef STATISTICS
28   morpheo::behavioural::Parameters_Statistics * param_statistics,
29#endif
30   morpheo::behavioural::core::multi_front_end::front_end::context_state::Parameters * param,
31   morpheo::behavioural::Tusage_t usage
32   ):
33    _name              (name)
34    ,_param            (param)
35    ,_usage            (usage)
36  {
37    log_begin(Context_State,FUNCTION);
38
39    usage_environment(_usage);
40
41// #if DEBUG_Context_State == true
42//     log_printf(INFO,Context_State,FUNCTION,_("<%s> Parameters"),_name.c_str());
43
44//     std::cout << *param << std::endl;
45// #endif   
46
47    log_printf(INFO,Context_State,FUNCTION,_("Allocation"));
48
49    allocation (
50#ifdef STATISTICS
51                param_statistics
52#endif
53                );
54
55#ifdef STATISTICS
56    if (usage_is_set(_usage,USE_STATISTICS))
57      { 
58        log_printf(INFO,Context_State,FUNCTION,_("Allocation of statistics"));
59
60        statistics_allocation(param_statistics);
61      }
62#endif
63
64#ifdef VHDL
65    if (usage_is_set(_usage,USE_VHDL))
66      {
67        // generate the vhdl
68        log_printf(INFO,Context_State,FUNCTION,_("Generate the vhdl"));
69       
70        vhdl();
71      }
72#endif
73
74#ifdef SYSTEMC
75    if (usage_is_set(_usage,USE_SYSTEMC))
76      {
77        // Constant
78        for (uint32_t i=0; i<_param->_nb_context; i++)
79          {
80            internal_BRANCH_EVENT_ACK [i] = 1;
81            PORT_WRITE(out_BRANCH_EVENT_ACK [i], internal_BRANCH_EVENT_ACK [i]);
82          }
83
84//      for (uint32_t i=0; i<_param->_nb_decod_unit; i++)
85//        {
86//          internal_DECOD_EVENT_ACK [i] = 1;
87//          PORT_WRITE(out_DECOD_EVENT_ACK [i], internal_DECOD_EVENT_ACK [i]);
88//        }
89
90        internal_COMMIT_EVENT_ACK = 1;
91        PORT_WRITE(out_COMMIT_EVENT_ACK, internal_COMMIT_EVENT_ACK);
92
93        for (uint32_t i=0; i<_param->_nb_inst_branch_complete; i++)
94          {
95            internal_BRANCH_COMPLETE_ACK [i] = 1;
96            PORT_WRITE(out_BRANCH_COMPLETE_ACK [i], internal_BRANCH_COMPLETE_ACK [i]);
97          }
98
99        log_printf(INFO,Context_State,FUNCTION,_("Method - transition"));
100
101        SC_METHOD (transition);
102        dont_initialize ();
103        sensitive << (*(in_CLOCK)).pos();
104       
105# ifdef SYSTEMCASS_SPECIFIC
106        // List dependency information
107# endif   
108
109        log_printf(INFO,Context_State,FUNCTION,_("Method - genMoore"));
110
111        SC_METHOD (genMoore);
112        dont_initialize ();
113        sensitive << (*(in_CLOCK)).neg(); // use internal register
114       
115# ifdef SYSTEMCASS_SPECIFIC
116        // List dependency information
117# endif   
118
119        log_printf(INFO,Context_State,FUNCTION,_("Method - genMealy_decod_event"));
120
121        SC_METHOD (genMealy_decod_event);
122        dont_initialize ();
123        sensitive << (*(in_CLOCK)).neg(); // use internal register
124        for (uint32_t i=0; i<_param->_nb_decod_unit; ++i)
125          {
126            sensitive << (*(in_DECOD_EVENT_VAL        [i])) // not necessary
127                      << (*(in_DECOD_EVENT_TYPE       [i]));
128            if (_param->_have_port_context_id)                                 
129            sensitive << (*(in_DECOD_EVENT_CONTEXT_ID [i]));
130          }
131        for (uint32_t i=0; i<_param->_nb_context; ++i)
132          {
133            sensitive << (*(in_NB_INST_DECOD_ALL      [i]))
134                      << (*(in_NB_INST_COMMIT_ALL     [i]))
135                      << (*(in_NB_INST_COMMIT_MEM     [i]));
136          }
137       
138# ifdef SYSTEMCASS_SPECIFIC
139        // List dependency information
140# endif   
141
142        log_printf(INFO,Context_State,FUNCTION,_("Method - genMealy_context_event"));
143
144        SC_METHOD (genMealy_context_event);
145        dont_initialize ();
146//      sensitive << (*(in_CLOCK)).neg(); // use internal register
147        sensitive << (*(in_COMMIT_EVENT_VAL             ));
148        if (_param->_have_port_context_id)                                     
149        sensitive << (*(in_COMMIT_EVENT_CONTEXT_ID      ));
150        for (uint32_t i=0; i<_param->_nb_inst_branch_complete; ++i)
151          {
152            sensitive << (*(in_BRANCH_COMPLETE_VAL             [i]))
153                      << (*(in_BRANCH_COMPLETE_MISS_PREDICTION [i]));
154            if (_param->_have_port_context_id)                                 
155            sensitive << (*(in_BRANCH_COMPLETE_CONTEXT_ID      [i]));
156          }
157       
158# ifdef SYSTEMCASS_SPECIFIC
159        // List dependency information
160# endif   
161       
162#endif
163      }
164    log_end(Context_State,FUNCTION);
165  };
166   
167#undef  FUNCTION
168#define FUNCTION "Context_State::~Context_State"
169  Context_State::~Context_State (void)
170  {
171    log_begin(Context_State,FUNCTION);
172
173#ifdef STATISTICS
174    if (usage_is_set(_usage,USE_STATISTICS))
175      {
176        statistics_deallocation();
177      }
178#endif
179
180    log_printf(INFO,Context_State,FUNCTION,_("Deallocation"));
181    deallocation ();
182
183    log_end(Context_State,FUNCTION);
184  };
185
186}; // end namespace context_state
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.