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_genMealy_retire.cpp @ 88

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

Almost complete design
with Test and test platform

  • Property svn:keywords set to Id
File size: 4.9 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Register_Address_Translation_unit_genMealy_retire.cpp 88 2008-12-10 18:31:39Z rosiere $
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Register_translation_unit/Register_Address_Translation_unit/include/Register_Address_Translation_unit.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
21#undef  FUNCTION
22#define FUNCTION "Register_Address_Translation_unit::genMealy_retire"
23  void Register_Address_Translation_unit::genMealy_retire (void)
24  {
25    log_begin(Register_Address_Translation_unit,FUNCTION);
26    log_function(Register_Address_Translation_unit,FUNCTION,_name.c_str());
27
28    // Init internal update table
29    for (uint32_t i=0; i<_param->_nb_front_end; i++)
30      for (uint32_t j=0; j<_param->_nb_context[i]; j++)
31        {
32          for (uint32_t k=0; k<_param->_nb_general_register_logic; ++k)
33            internal_rat_gpr_update_table [i][j][k] = rat_gpr_update_table [i][j][k];
34          for (uint32_t k=0; k<_param->_nb_special_register_logic; ++k)
35            internal_rat_spr_update_table [i][j][k] = rat_spr_update_table [i][j][k];
36        }
37
38
39    // RETIRE is in order -> also don't need test if an instruction is valid
40    for (uint32_t i=0; i<_param->_nb_inst_retire; i++)
41      {
42        log_printf(TRACE,Register_Address_Translation_unit,FUNCTION,"  * inst_retire [%d]",i);
43
44        // init -> need't restore old value
45        Tcontrol_t     retire_restore_rd_phy_old = false;
46        Tcontrol_t     retire_restore_re_phy_old = false;
47        Tevent_state_t event_state               = PORT_READ(in_RETIRE_EVENT_STATE [i]);
48
49        // Test if event -> need restore ?
50        if (event_state != EVENT_STATE_NO_EVENT)
51          {
52            Tcontext_t front_end_id = (_param->_have_port_front_end_id)?PORT_READ(in_RETIRE_FRONT_END_ID [i]):0;
53            Tcontext_t context_id   = (_param->_have_port_context_id  )?PORT_READ(in_RETIRE_CONTEXT_ID   [i]):0;
54
55            log_printf(TRACE,Register_Address_Translation_unit,FUNCTION,"    * Have event");
56            log_printf(TRACE,Register_Address_Translation_unit,FUNCTION,"    * front_end_id         : %d",front_end_id);
57            log_printf(TRACE,Register_Address_Translation_unit,FUNCTION,"    * context_id           : %d",context_id  );
58                       
59            // Test if event have just occure -> reset update_table
60            if (event_state == EVENT_STATE_EVENT)
61              {
62                // Reset update_table
63                for (uint32_t j=0; j<_param->_nb_general_register_logic; j++)
64                  internal_rat_gpr_update_table[front_end_id][context_id][j] = 0;
65                for (uint32_t j=0; j<_param->_nb_special_register_logic; j++)
66                  internal_rat_spr_update_table[front_end_id][context_id][j] = 0;
67              }
68           
69            // Test and update update table
70            if (PORT_READ(in_RETIRE_WRITE_RD [i]))
71              {
72                Tgeneral_address_t rd_log = PORT_READ(in_RETIRE_NUM_REG_RD_LOG [i]);
73                retire_restore_rd_phy_old = (internal_rat_gpr_update_table[front_end_id][context_id][rd_log] == 0);
74
75//                 log_printf(TRACE,Register_Address_Translation_unit,FUNCTION,"    * write_rd");
76//                 log_printf(TRACE,Register_Address_Translation_unit,FUNCTION,"      * rd_log             : %d",rd_log);
77//                 log_printf(TRACE,Register_Address_Translation_unit,FUNCTION,"      * rat_gpr_update     : %d",internal_rat_gpr_update_table[front_end_id][context_id][rd_log]);
78
79                internal_rat_gpr_update_table[front_end_id][context_id][rd_log] = 1;
80              }
81            if (PORT_READ(in_RETIRE_WRITE_RE [i]))
82              {
83//                 log_printf(TRACE,Register_Address_Translation_unit,FUNCTION,"    * write_re");
84
85                Tgeneral_address_t re_log = PORT_READ(in_RETIRE_NUM_REG_RE_LOG [i]);
86                retire_restore_re_phy_old = (internal_rat_spr_update_table[front_end_id][context_id][re_log] == 0);
87                internal_rat_spr_update_table[front_end_id][context_id][re_log] = 1;
88              }
89
90            log_printf(TRACE,Register_Address_Translation_unit,FUNCTION,"    * restore_rd_phy_old   : %d",retire_restore_rd_phy_old);
91            log_printf(TRACE,Register_Address_Translation_unit,FUNCTION,"    * restore_re_phy_old   : %d",retire_restore_re_phy_old);
92          }
93             
94        PORT_WRITE(out_RETIRE_RESTORE_RD_PHY_OLD[i], retire_restore_rd_phy_old);
95        PORT_WRITE(out_RETIRE_RESTORE_RE_PHY_OLD[i], retire_restore_re_phy_old);
96      }
97
98    log_end(Register_Address_Translation_unit,FUNCTION);
99  };
100
101}; // end namespace register_address_translation_unit
102}; // end namespace register_translation_unit
103}; // end namespace rename_unit
104}; // end namespace ooo_engine
105}; // end namespace multi_ooo_engine
106}; // end namespace core
107
108}; // end namespace behavioural
109}; // end namespace morpheo             
110#endif
Note: See TracBrowser for help on using the repository browser.