source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Register_translation_unit/Register_Address_Translation_unit/src/Register_Address_Translation_unit_allocation.cpp @ 145

Last change on this file since 145 was 145, checked in by rosiere, 14 years ago

1) add test with SPECINT2K
2) new config of Selftest
3) modif RAT to support multiple depth_save ... but not finish (need fix Update Prediction Table)
4) add Function_pointer but need fix

  • Property svn:keywords set to Id
File size: 11.3 KB
Line 
1/*
2 * $Id: Register_Address_Translation_unit_allocation.cpp 145 2010-10-13 18:15:51Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Register_translation_unit/Register_Address_Translation_unit/include/Register_Address_Translation_unit.h"
9#include "Behavioural/include/Allocation.h"
10#include "Behavioural/include/Allocation.h"
11
12namespace morpheo                    {
13namespace behavioural {
14namespace core {
15namespace multi_ooo_engine {
16namespace ooo_engine {
17namespace rename_unit {
18namespace register_translation_unit {
19namespace register_address_translation_unit {
20
21#undef  FUNCTION
22#define FUNCTION "Register_Address_Translation_unit::allocation"
23  void Register_Address_Translation_unit::allocation
24  (
25#ifdef STATISTICS
26   morpheo::behavioural::Parameters_Statistics * param_statistics
27#else
28   void
29#endif
30   )
31  {
32    log_printf(FUNC,Register_Address_Translation_unit,FUNCTION,"Begin");
33   
34    _component   = new Component (_usage);
35   
36    Entity * entity = _component->set_entity (_name       
37                                              ,"Register_Address_Translation_unit"
38#ifdef POSITION
39                                              ,COMBINATORY
40#endif
41                                              );
42   
43    _interfaces = entity->set_interfaces();
44   
45    // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
46    {
47      Interface * interface = _interfaces->set_interface(""
48#ifdef POSITION
49                                                         ,IN
50                                                         ,SOUTH,
51                                                         "Generalist interface"
52#endif
53                                                         );
54     
55      in_CLOCK        = interface->set_signal_clk              ("clock" ,1, CLOCK_VHDL_YES);
56      in_NRESET       = interface->set_signal_in  <Tcontrol_t> ("nreset",1, RESET_VHDL_YES);
57    }
58   
59    // ~~~~~[ Interface "rename" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
60    {
61      ALLOC1_INTERFACE_BEGIN("rename",IN,EAST,_("Input to rename source logical register"), _param->_nb_inst_insert);
62
63      ALLOC1_VALACK_IN      ( in_RENAME_VAL               , VAL);
64      ALLOC1_VALACK_OUT     (out_RENAME_ACK               , ACK);
65      ALLOC1_SIGNAL_IN      ( in_RENAME_FRONT_END_ID      ,"front_end_id"      ,Tcontext_t        ,_param->_size_front_end_id);
66      ALLOC1_SIGNAL_IN      ( in_RENAME_CONTEXT_ID        ,"context_id"        ,Tcontext_t        ,_param->_size_context_id  );
67      ALLOC1_SIGNAL_IN_COND ( in_RENAME_DEPTH             ,"depth"             ,Tdepth_t          ,_param->_size_depth,_param->_rat_scheme == RAT_DEPTH_SAVE);
68      ALLOC1_SIGNAL_IN      ( in_RENAME_SAVE_RAT          ,"save_rat"          ,Tcontrol_t        ,1);
69      ALLOC1_SIGNAL_IN      ( in_RENAME_NUM_REG_RA_LOG    ,"num_reg_ra_log"    ,Tgeneral_address_t,_param->_size_general_register_logic);
70      ALLOC1_SIGNAL_IN      ( in_RENAME_NUM_REG_RB_LOG    ,"num_reg_rb_log"    ,Tgeneral_address_t,_param->_size_general_register_logic);
71      ALLOC1_SIGNAL_IN      ( in_RENAME_NUM_REG_RC_LOG    ,"num_reg_rc_log"    ,Tspecial_address_t,_param->_size_special_register_logic);
72      ALLOC1_SIGNAL_IN      ( in_RENAME_NUM_REG_RD_LOG    ,"num_reg_rd_log"    ,Tgeneral_address_t,_param->_size_general_register_logic);
73      ALLOC1_SIGNAL_IN      ( in_RENAME_NUM_REG_RE_LOG    ,"num_reg_re_log"    ,Tspecial_address_t,_param->_size_special_register_logic);
74      ALLOC1_SIGNAL_OUT     (out_RENAME_NUM_REG_RA_PHY    ,"num_reg_ra_phy"    ,Tgeneral_address_t,_param->_size_general_register);
75      ALLOC1_SIGNAL_OUT     (out_RENAME_NUM_REG_RB_PHY    ,"num_reg_rb_phy"    ,Tgeneral_address_t,_param->_size_general_register);
76      ALLOC1_SIGNAL_OUT     (out_RENAME_NUM_REG_RC_PHY    ,"num_reg_rc_phy"    ,Tspecial_address_t,_param->_size_special_register);
77      ALLOC1_SIGNAL_OUT     (out_RENAME_NUM_REG_RD_PHY_OLD,"num_reg_rd_phy_old",Tgeneral_address_t,_param->_size_general_register);
78      ALLOC1_SIGNAL_OUT     (out_RENAME_NUM_REG_RE_PHY_OLD,"num_reg_re_phy_old",Tspecial_address_t,_param->_size_special_register);
79
80      ALLOC1_INTERFACE_END(_param->_nb_inst_insert);
81    }
82   
83    // ~~~~~[ Interface "insert" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
84    {
85      ALLOC1_INTERFACE_BEGIN("insert",IN,NORTH,_("Input to rename destination logical register"), _param->_nb_inst_insert);
86     
87      ALLOC1_VALACK_IN ( in_INSERT_VAL           ,VAL);
88      ALLOC1_VALACK_OUT(out_INSERT_ACK           ,ACK);
89//    ALLOC1_SIGNAL_IN ( in_INSERT_FRONT_END_ID  ,"front_end_id"  ,Tcontext_t        ,_param->_size_front_end_id);
90//    ALLOC1_SIGNAL_IN ( in_INSERT_CONTEXT_ID    ,"context_id"    ,Tcontext_t        ,_param->_size_context_id  );
91      ALLOC1_SIGNAL_IN ( in_INSERT_WRITE_RD      ,"write_rd"      ,Tcontrol_t        ,1);
92      ALLOC1_SIGNAL_IN ( in_INSERT_WRITE_RE      ,"write_re"      ,Tcontrol_t        ,1);
93      ALLOC1_SIGNAL_IN ( in_INSERT_NUM_REG_RD_LOG,"num_reg_rd_log",Tgeneral_address_t,_param->_size_general_register_logic);
94      ALLOC1_SIGNAL_IN ( in_INSERT_NUM_REG_RE_LOG,"num_reg_re_log",Tspecial_address_t,_param->_size_special_register_logic);
95      ALLOC1_SIGNAL_IN ( in_INSERT_NUM_REG_RD_PHY,"num_reg_rd_phy",Tgeneral_address_t,_param->_size_general_register);
96      ALLOC1_SIGNAL_IN ( in_INSERT_NUM_REG_RE_PHY,"num_reg_re_phy",Tspecial_address_t,_param->_size_special_register);
97
98      ALLOC1_INTERFACE_END(_param->_nb_inst_insert);
99    }
100   
101    // ~~~~~[ Interface "retire" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
102    {
103      ALLOC1_INTERFACE_BEGIN("retire",IN,NORTH,_("Input to update on event"), _param->_nb_inst_retire);
104
105      ALLOC1_VALACK_IN ( in_RETIRE_VAL               ,VAL);
106      ALLOC1_VALACK_OUT(out_RETIRE_ACK               ,ACK);
107      ALLOC1_SIGNAL_IN ( in_RETIRE_FRONT_END_ID      ,"front_end_id"      ,Tcontext_t        ,_param->_size_front_end_id);
108      ALLOC1_SIGNAL_IN ( in_RETIRE_CONTEXT_ID        ,"context_id"        ,Tcontext_t        ,_param->_size_context_id  );
109      ALLOC1_SIGNAL_IN ( in_RETIRE_WRITE_RD          ,"write_rd"          ,Tcontrol_t        ,1);
110      ALLOC1_SIGNAL_IN ( in_RETIRE_WRITE_RE          ,"write_re"          ,Tcontrol_t        ,1);
111      ALLOC1_SIGNAL_IN ( in_RETIRE_NUM_REG_RD_LOG    ,"num_reg_rd_log"    ,Tgeneral_address_t,_param->_size_general_register_logic);
112      ALLOC1_SIGNAL_IN ( in_RETIRE_NUM_REG_RE_LOG    ,"num_reg_re_log"    ,Tspecial_address_t,_param->_size_special_register_logic);
113      ALLOC1_SIGNAL_IN ( in_RETIRE_NUM_REG_RD_PHY_NEW,"num_reg_rd_phy_new",Tgeneral_address_t,_param->_size_general_register);
114      ALLOC1_SIGNAL_IN ( in_RETIRE_NUM_REG_RE_PHY_NEW,"num_reg_re_phy_new",Tspecial_address_t,_param->_size_special_register);
115      ALLOC1_SIGNAL_IN ( in_RETIRE_RESTORE           ,"restore"           ,Tcontrol_t        ,1);
116
117      ALLOC1_INTERFACE_END(_param->_nb_inst_retire);
118    }
119
120    // ~~~~~[ Interface : "retire_event" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
121    {
122      ALLOC2_INTERFACE_BEGIN("retire_event", IN,NORTH, _("Retire event"), _param->_nb_front_end, _param->_nb_context[it1]);
123
124      _ALLOC2_VALACK_IN      ( in_RETIRE_EVENT_VAL        ,VAL,_param->_nb_front_end, _param->_nb_context[it1]);
125      _ALLOC2_VALACK_OUT     (out_RETIRE_EVENT_ACK        ,ACK,_param->_nb_front_end, _param->_nb_context[it1]);
126      _ALLOC2_SIGNAL_IN      ( in_RETIRE_EVENT_STATE      ,"state"             ,Tevent_state_t    ,_param->_size_event_state, _param->_nb_front_end, _param->_nb_context[it1]);
127      _ALLOC2_SIGNAL_IN_COND ( in_RETIRE_EVENT_TYPE       ,"type"              ,Tevent_type_t     ,_param->_size_event_type , _param->_nb_front_end, _param->_nb_context[it1],_param->_rat_scheme == RAT_DEPTH_SAVE);
128      _ALLOC2_SIGNAL_IN_COND ( in_RETIRE_EVENT_DEPTH      ,"depth"             ,Tdepth_t          ,_param->_size_depth      , _param->_nb_front_end, _param->_nb_context[it1],_param->_rat_scheme == RAT_DEPTH_SAVE);
129
130      ALLOC2_INTERFACE_END(_param->_nb_front_end, _param->_nb_context[it1]);
131    }
132
133    // ~~~~~[ Interface : "depth" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
134    {
135      ALLOC2_INTERFACE_BEGIN("depth",IN,WEST,_("Interface with Prediction unit."),_param->_nb_front_end, _param->_nb_context[it1]);
136
137      _ALLOC2_SIGNAL_IN ( in_DEPTH_MIN                    ,"MIN"               ,Tdepth_t         ,_param->_size_depth       ,_param->_nb_front_end,_param->_nb_context[it1]);
138      _ALLOC2_SIGNAL_IN ( in_DEPTH_MAX                    ,"MAX"               ,Tdepth_t         ,_param->_size_depth       ,_param->_nb_front_end,_param->_nb_context[it1]); 
139      _ALLOC2_SIGNAL_IN ( in_DEPTH_FULL                   ,"FULL"              ,Tcontrol_t       ,1                         ,_param->_nb_front_end,_param->_nb_context[it1]); 
140
141      ALLOC2_INTERFACE_END(_param->_nb_front_end,_param->_nb_context[it1]);
142    }
143
144    if (usage_is_set(_usage,USE_SYSTEMC))
145      {
146    ALLOC1(internal_RENAME_ACK       ,Tcontrol_t,_param->_nb_inst_insert);
147    ALLOC1(internal_INSERT_ACK       ,Tcontrol_t,_param->_nb_inst_insert);
148    ALLOC1(internal_RETIRE_ACK       ,Tcontrol_t,_param->_nb_inst_retire);
149    ALLOC2(internal_RETIRE_EVENT_ACK ,Tcontrol_t,_param->_nb_front_end,_param->_nb_context[it1]);
150
151    ALLOC3(RAT_GPR_NOT_SPECULATIVE  ,Tgeneral_address_t,_param->_nb_front_end,_param->_nb_context[it1],_param->_nb_general_register_logic);
152    ALLOC3(RAT_SPR_NOT_SPECULATIVE  ,Tspecial_address_t,_param->_nb_front_end,_param->_nb_context[it1],_param->_nb_special_register_logic);
153
154    switch(_param->_rat_scheme)
155      {
156      case RAT_NO_SAVE    :
157        {
158          break;
159        }
160      case RAT_ONE_SAVE   :
161        {
162          ALLOC4(RAT_GPR_SPECULATIVE      ,Tgeneral_address_t,_param->_nb_front_end,_param->_nb_context[it1],1,_param->_nb_general_register_logic);
163          ALLOC4(RAT_SPR_SPECULATIVE      ,Tspecial_address_t,_param->_nb_front_end,_param->_nb_context[it1],1,_param->_nb_special_register_logic);
164
165          ALLOC4(RAT_GPR_SPECULATIVE_VALID,bool              ,_param->_nb_front_end,_param->_nb_context[it1],1,_param->_nb_general_register_logic);
166          ALLOC4(RAT_SPR_SPECULATIVE_VALID,bool              ,_param->_nb_front_end,_param->_nb_context[it1],1,_param->_nb_special_register_logic);
167         
168          break;
169        }
170      case RAT_DEPTH_SAVE :
171        {
172          ALLOC4(RAT_GPR_SPECULATIVE      ,Tgeneral_address_t,_param->_nb_front_end,_param->_nb_context[it1],_param->_nb_branch_speculated[it1][it2],_param->_nb_general_register_logic);
173          ALLOC4(RAT_SPR_SPECULATIVE      ,Tspecial_address_t,_param->_nb_front_end,_param->_nb_context[it1],_param->_nb_branch_speculated[it1][it2],_param->_nb_special_register_logic);
174
175          ALLOC4(RAT_GPR_SPECULATIVE_VALID,bool              ,_param->_nb_front_end,_param->_nb_context[it1],_param->_nb_branch_speculated[it1][it2],_param->_nb_general_register_logic);
176          ALLOC4(RAT_SPR_SPECULATIVE_VALID,bool              ,_param->_nb_front_end,_param->_nb_context[it1],_param->_nb_branch_speculated[it1][it2],_param->_nb_special_register_logic);
177   
178          ALLOC3(reg_RAT_USE              ,bool              ,_param->_nb_front_end,_param->_nb_context[it1],_param->_nb_branch_speculated[it1][it2]);
179          ALLOC2(reg_SAVE_RAT             ,bool              ,_param->_nb_front_end,_param->_nb_context[it1]);
180
181          break;
182        }
183      }
184      }
185
186    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
187
188#ifdef POSITION
189    if (usage_is_set(_usage,USE_POSITION))
190      _component->generate_file();
191#endif
192
193    log_printf(FUNC,Register_Address_Translation_unit,FUNCTION,"End");
194  };
195
196}; // end namespace register_address_translation_unit
197}; // end namespace register_translation_unit
198}; // end namespace rename_unit
199}; // end namespace ooo_engine
200}; // end namespace multi_ooo_engine
201}; // end namespace core
202
203}; // end namespace behavioural
204}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.