source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Special_Register_unit/src/Special_Register_unit.cpp @ 88

Last change on this file since 88 was 88, checked in by rosiere, 16 years ago

Almost complete design
with Test and test platform

  • Property svn:keywords set to Id
File size: 4.2 KB
Line 
1/*
2 * $Id: Special_Register_unit.cpp 88 2008-12-10 18:31:39Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Special_Register_unit/include/Special_Register_unit.h"
9
10namespace morpheo                    {
11namespace behavioural {
12namespace core {
13namespace multi_ooo_engine {
14namespace ooo_engine {
15namespace special_register_unit {
16
17
18#undef  FUNCTION
19#define FUNCTION "Special_Register_unit::Special_Register_unit"
20  Special_Register_unit::Special_Register_unit
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_ooo_engine::ooo_engine::special_register_unit::Parameters * param,
31   morpheo::behavioural::Tusage_t usage
32   ):
33    _name              (name)
34    ,_param            (param)
35    ,_usage            (usage)
36  {
37    log_begin(Special_Register_unit,FUNCTION);
38
39    usage_environment(_usage);
40
41#if DEBUG_Core == true
42    log_printf(INFO,Core,FUNCTION,_("<%s> Parameters"),_name.c_str());
43
44    std::cout << *param << std::endl;
45#endif   
46
47    log_printf(INFO,Special_Register_unit,FUNCTION,_("<%s> : Allocation"),_name.c_str());
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,Special_Register_unit,FUNCTION,_("<%s> : Allocation of statistics"),_name.c_str());
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,Special_Register_unit,FUNCTION,_("<%s> : Generate the vhdl"),_name.c_str());
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_inst_reexecute; i++)
79          {
80            internal_SPR_ACCESS_ACK [i] = 1;
81            PORT_WRITE(out_SPR_ACCESS_ACK [i], internal_SPR_ACCESS_ACK [i]);
82          }
83
84        for (uint32_t i=0; i<_param->_nb_front_end; i++)
85          for (uint32_t j=0; j<_param->_nb_context[i]; j++)
86            {
87              internal_SPR_COMMIT_ACK [i][j] = 1;
88              internal_SPR_EVENT_ACK  [i][j] = 1;
89              PORT_WRITE(out_SPR_COMMIT_ACK [i][j], internal_SPR_COMMIT_ACK [i][j]);
90              PORT_WRITE(out_SPR_EVENT_ACK  [i][j], internal_SPR_EVENT_ACK  [i][j]);
91            }
92
93        log_printf(INFO,Special_Register_unit,FUNCTION,_("<%s> : Method - transition"),_name.c_str());
94
95        SC_METHOD (transition);
96        dont_initialize ();
97        sensitive << (*(in_CLOCK)).pos();
98       
99# ifdef SYSTEMCASS_SPECIFIC
100        // List dependency information
101# endif   
102
103        log_printf(INFO,Special_Register_unit,FUNCTION,_("<%s> : Method - genMoore"),_name.c_str());
104
105        SC_METHOD (genMoore);
106        dont_initialize ();
107        sensitive << (*(in_CLOCK)).neg(); // need internal register
108       
109# ifdef SYSTEMCASS_SPECIFIC
110        // List dependency information
111# endif   
112
113        log_printf(INFO,Special_Register_unit,FUNCTION,_("<%s> : Method - genMealy_spr_access"),_name.c_str());
114
115        SC_METHOD (genMealy_spr_access);
116        dont_initialize ();
117        sensitive << (*(in_CLOCK)).neg(); // need internal register
118       
119        for (uint32_t i=0; i<_param->_nb_inst_reexecute; i++)
120          {
121            sensitive << (*(in_SPR_ACCESS_NUM_GROUP    [i]))
122                      << (*(in_SPR_ACCESS_NUM_REG      [i]))
123//                    << (*(in_SPR_ACCESS_VAL          [i]))
124//                    << (*(in_SPR_ACCESS_WEN          [i]))
125              ;
126            if (_param->_have_port_front_end_id)
127            sensitive << (*(in_SPR_ACCESS_FRONT_END_ID [i]));
128            if (_param->_have_port_context_id)
129            sensitive << (*(in_SPR_ACCESS_CONTEXT_ID   [i]));
130          }
131
132
133# ifdef SYSTEMCASS_SPECIFIC
134        // List dependency information
135# endif   
136       
137#endif
138      }
139    log_end(Special_Register_unit,FUNCTION);
140  };
141   
142#undef  FUNCTION
143#define FUNCTION "Special_Register_unit::~Special_Register_unit"
144  Special_Register_unit::~Special_Register_unit (void)
145  {
146    log_begin(Special_Register_unit,FUNCTION);
147
148#ifdef STATISTICS
149    if (usage_is_set(_usage,USE_STATISTICS))
150      {
151        statistics_deallocation();
152      }
153#endif
154
155    log_printf(INFO,Special_Register_unit,FUNCTION,_("<%s> : Deallocation"),_name.c_str());
156    deallocation ();
157
158    log_end(Special_Register_unit,FUNCTION);
159  };
160
161}; // end namespace special_register_unit
162}; // end namespace ooo_engine
163}; // end namespace multi_ooo_engine
164}; // end namespace core
165
166}; // end namespace behavioural
167}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.