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 @ 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: 8.7 KB
Line 
1/*
2 * $Id: Register_Address_Translation_unit_allocation.cpp 88 2008-12-10 18:31:39Z 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
11namespace morpheo                    {
12namespace behavioural {
13namespace core {
14namespace multi_ooo_engine {
15namespace ooo_engine {
16namespace rename_unit {
17namespace register_translation_unit {
18namespace register_address_translation_unit {
19
20#undef  FUNCTION
21#define FUNCTION "Register_Address_Translation_unit::allocation"
22  void Register_Address_Translation_unit::allocation
23  (
24#ifdef STATISTICS
25   morpheo::behavioural::Parameters_Statistics * param_statistics
26#else
27   void
28#endif
29   )
30  {
31    log_printf(FUNC,Register_Address_Translation_unit,FUNCTION,"Begin");
32   
33    _component   = new Component (_usage);
34   
35    Entity * entity = _component->set_entity (_name       
36                                              ,"Register_Address_Translation_unit"
37#ifdef POSITION
38                                              ,COMBINATORY
39#endif
40                                              );
41   
42    _interfaces = entity->set_interfaces();
43   
44    // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45    {
46      Interface * interface = _interfaces->set_interface(""
47#ifdef POSITION
48                                                         ,IN
49                                                         ,SOUTH,
50                                                         "Generalist interface"
51#endif
52                                                         );
53     
54      in_CLOCK        = interface->set_signal_clk              ("clock" ,1, CLOCK_VHDL_YES);
55      in_NRESET       = interface->set_signal_in  <Tcontrol_t> ("nreset",1, RESET_VHDL_YES);
56    }
57   
58    // ~~~~~[ Interface "rename" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
59    {
60      ALLOC1_INTERFACE("rename",IN,EAST,"Input to rename source logical register", _param->_nb_inst_insert);
61
62      ALLOC1_VALACK_IN ( in_RENAME_VAL               , VAL);
63      ALLOC1_VALACK_OUT(out_RENAME_ACK               , ACK);
64      ALLOC1_SIGNAL_IN ( in_RENAME_FRONT_END_ID      ,"front_end_id"      ,Tcontext_t        ,_param->_size_front_end_id);
65      ALLOC1_SIGNAL_IN ( in_RENAME_CONTEXT_ID        ,"context_id"        ,Tcontext_t        ,_param->_size_context_id  );
66      ALLOC1_SIGNAL_IN ( in_RENAME_NUM_REG_RA_LOG    ,"num_reg_ra_log"    ,Tgeneral_address_t,_param->_size_general_register_logic);
67      ALLOC1_SIGNAL_IN ( in_RENAME_NUM_REG_RB_LOG    ,"num_reg_rb_log"    ,Tgeneral_address_t,_param->_size_general_register_logic);
68      ALLOC1_SIGNAL_IN ( in_RENAME_NUM_REG_RC_LOG    ,"num_reg_rc_log"    ,Tspecial_address_t,_param->_size_special_register_logic);
69      ALLOC1_SIGNAL_IN ( in_RENAME_NUM_REG_RD_LOG    ,"num_reg_rd_log"    ,Tgeneral_address_t,_param->_size_general_register_logic);
70      ALLOC1_SIGNAL_IN ( in_RENAME_NUM_REG_RE_LOG    ,"num_reg_re_log"    ,Tspecial_address_t,_param->_size_special_register_logic);
71      ALLOC1_SIGNAL_OUT(out_RENAME_NUM_REG_RA_PHY    ,"num_reg_ra_phy"    ,Tgeneral_address_t,_param->_size_general_register);
72      ALLOC1_SIGNAL_OUT(out_RENAME_NUM_REG_RB_PHY    ,"num_reg_rb_phy"    ,Tgeneral_address_t,_param->_size_general_register);
73      ALLOC1_SIGNAL_OUT(out_RENAME_NUM_REG_RC_PHY    ,"num_reg_rc_phy"    ,Tspecial_address_t,_param->_size_special_register);
74      ALLOC1_SIGNAL_OUT(out_RENAME_NUM_REG_RD_PHY_OLD,"num_reg_rd_phy_old",Tgeneral_address_t,_param->_size_general_register);
75      ALLOC1_SIGNAL_OUT(out_RENAME_NUM_REG_RE_PHY_OLD,"num_reg_re_phy_old",Tspecial_address_t,_param->_size_special_register);
76    }
77   
78    // ~~~~~[ Interface "insert" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
79    {
80      ALLOC1_INTERFACE("insert",IN,NORTH,"Input to rename destination logical register", _param->_nb_inst_insert);
81     
82      ALLOC1_VALACK_IN ( in_INSERT_VAL           ,VAL);
83      ALLOC1_VALACK_OUT(out_INSERT_ACK           ,ACK);
84//    ALLOC1_SIGNAL_IN ( in_INSERT_FRONT_END_ID  ,"front_end_id"  ,Tcontext_t        ,_param->_size_front_end_id);
85//    ALLOC1_SIGNAL_IN ( in_INSERT_CONTEXT_ID    ,"context_id"    ,Tcontext_t        ,_param->_size_context_id  );
86      ALLOC1_SIGNAL_IN ( in_INSERT_WRITE_RD      ,"write_rd"      ,Tcontrol_t        ,1);
87      ALLOC1_SIGNAL_IN ( in_INSERT_WRITE_RE      ,"write_re"      ,Tcontrol_t        ,1);
88      ALLOC1_SIGNAL_IN ( in_INSERT_NUM_REG_RD_LOG,"num_reg_rd_log",Tgeneral_address_t,_param->_size_general_register_logic);
89      ALLOC1_SIGNAL_IN ( in_INSERT_NUM_REG_RE_LOG,"num_reg_re_log",Tspecial_address_t,_param->_size_special_register_logic);
90      ALLOC1_SIGNAL_IN ( in_INSERT_NUM_REG_RD_PHY,"num_reg_rd_phy",Tgeneral_address_t,_param->_size_general_register);
91      ALLOC1_SIGNAL_IN ( in_INSERT_NUM_REG_RE_PHY,"num_reg_re_phy",Tspecial_address_t,_param->_size_special_register);
92    }
93   
94    // ~~~~~[ Interface "retire" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
95    {
96      ALLOC1_INTERFACE("retire",IN,NORTH,"Input to update on event", _param->_nb_inst_retire);
97
98      ALLOC1_VALACK_IN ( in_RETIRE_VAL               ,VAL);
99      ALLOC1_VALACK_OUT(out_RETIRE_ACK               ,ACK);
100      ALLOC1_SIGNAL_IN ( in_RETIRE_FRONT_END_ID      ,"front_end_id"      ,Tcontext_t        ,_param->_size_front_end_id);
101      ALLOC1_SIGNAL_IN ( in_RETIRE_CONTEXT_ID        ,"context_id"        ,Tcontext_t        ,_param->_size_context_id  );
102      ALLOC1_SIGNAL_IN ( in_RETIRE_EVENT_STATE       ,"event_state"       ,Tevent_state_t    ,_param->_size_event_state );
103      ALLOC1_SIGNAL_IN ( in_RETIRE_WRITE_RD          ,"write_rd"          ,Tcontrol_t        ,1);
104      ALLOC1_SIGNAL_IN ( in_RETIRE_WRITE_RE          ,"write_re"          ,Tcontrol_t        ,1);
105      ALLOC1_SIGNAL_IN ( in_RETIRE_NUM_REG_RD_LOG    ,"num_reg_rd_log"    ,Tgeneral_address_t,_param->_size_general_register_logic);
106      ALLOC1_SIGNAL_IN ( in_RETIRE_NUM_REG_RE_LOG    ,"num_reg_re_log"    ,Tspecial_address_t,_param->_size_special_register_logic);
107      ALLOC1_SIGNAL_IN ( in_RETIRE_NUM_REG_RD_PHY_OLD,"num_reg_rd_phy_old",Tgeneral_address_t,_param->_size_general_register);
108      ALLOC1_SIGNAL_IN ( in_RETIRE_NUM_REG_RE_PHY_OLD,"num_reg_re_phy_old",Tspecial_address_t,_param->_size_special_register);
109      ALLOC1_SIGNAL_OUT(out_RETIRE_RESTORE_RD_PHY_OLD,"restore_rd_phy_old",Tcontrol_t        ,1);
110      ALLOC1_SIGNAL_OUT(out_RETIRE_RESTORE_RE_PHY_OLD,"restore_re_phy_old",Tcontrol_t        ,1);
111    }
112
113    if (usage_is_set(_usage,USE_SYSTEMC))
114      {
115    internal_RENAME_ACK = new Tcontrol_t [_param->_nb_inst_insert];
116    internal_INSERT_ACK = new Tcontrol_t [_param->_nb_inst_insert];
117    internal_RETIRE_ACK = new Tcontrol_t [_param->_nb_inst_retire];
118
119    rat_gpr                       = new Tgeneral_address_t ** [_param->_nb_front_end];
120    rat_spr                       = new Tspecial_address_t ** [_param->_nb_front_end];
121    rat_gpr_update_table          = new bool               ** [_param->_nb_front_end];
122    rat_spr_update_table          = new bool               ** [_param->_nb_front_end];
123    internal_rat_gpr_update_table = new bool               ** [_param->_nb_front_end];
124    internal_rat_spr_update_table = new bool               ** [_param->_nb_front_end];
125
126    for (uint32_t i=0; i<_param->_nb_front_end; i++)
127      {
128        rat_gpr                       [i] = new Tgeneral_address_t * [_param->_nb_context[i]];
129        rat_spr                       [i] = new Tspecial_address_t * [_param->_nb_context[i]];
130        rat_gpr_update_table          [i] = new bool               * [_param->_nb_context[i]];
131        rat_spr_update_table          [i] = new bool               * [_param->_nb_context[i]];
132        internal_rat_gpr_update_table [i] = new bool               * [_param->_nb_context[i]];
133        internal_rat_spr_update_table [i] = new bool               * [_param->_nb_context[i]];
134
135        for (uint32_t j=0; j<_param->_nb_context[i]; j++)
136          {
137            rat_gpr                       [i][j] = new Tgeneral_address_t [_param->_nb_general_register_logic];
138            rat_spr                       [i][j] = new Tspecial_address_t [_param->_nb_special_register_logic];
139            rat_gpr_update_table          [i][j] = new bool               [_param->_nb_general_register_logic];
140            rat_spr_update_table          [i][j] = new bool               [_param->_nb_special_register_logic];
141            internal_rat_gpr_update_table [i][j] = new bool               [_param->_nb_general_register_logic];
142            internal_rat_spr_update_table [i][j] = new bool               [_param->_nb_special_register_logic];
143          }
144      }
145      }
146
147    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
148
149#ifdef POSITION
150    if (usage_is_set(_usage,USE_POSITION))
151      _component->generate_file();
152#endif
153
154    log_printf(FUNC,Register_Address_Translation_unit,FUNCTION,"End");
155  };
156
157}; // end namespace register_address_translation_unit
158}; // end namespace register_translation_unit
159}; // end namespace rename_unit
160}; // end namespace ooo_engine
161}; // end namespace multi_ooo_engine
162}; // end namespace core
163
164}; // end namespace behavioural
165}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.