source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State.cpp @ 101

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

1) Add soc test
2) fix bug (Pc management, Decod and execute, Update prediction ...)

  • Property svn:keywords set to Id
File size: 4.2 KB
Line 
1/*
2 * $Id: Context_State.cpp 101 2009-01-15 17:19:08Z 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#endif
143      }
144    log_end(Context_State,FUNCTION);
145  };
146   
147#undef  FUNCTION
148#define FUNCTION "Context_State::~Context_State"
149  Context_State::~Context_State (void)
150  {
151    log_begin(Context_State,FUNCTION);
152
153#ifdef STATISTICS
154    if (usage_is_set(_usage,USE_STATISTICS))
155      {
156        statistics_deallocation();
157      }
158#endif
159
160    log_printf(INFO,Context_State,FUNCTION,_("Deallocation"));
161    deallocation ();
162
163    log_end(Context_State,FUNCTION);
164  };
165
166}; // end namespace context_state
167}; // end namespace front_end
168}; // end namespace multi_front_end
169}; // end namespace core
170
171}; // end namespace behavioural
172}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.