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 @ 106

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

1) RAT : Fix bug when update and event in same cycle
2) Context State : Compute depth
3) Load Store Unit : In check logic, translate all access in little endian. More easy to check
4) UFPT : End Event

  • Property svn:keywords set to Id
File size: 4.6 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Register_Address_Translation_unit_genMealy_retire.cpp 106 2009-02-09 22:55:26Z 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          // An event occure
33          bool no_event = not (PORT_READ(in_RETIRE_EVENT_STATE [i][j]) and (PORT_READ(in_RETIRE_EVENT_STATE [i][j]) == EVENT_STATE_EVENT));
34          for (uint32_t k=0; k<_param->_nb_general_register_logic; ++k)
35            internal_rat_gpr_update_table [i][j][k] = rat_gpr_update_table [i][j][k] and no_event;
36          for (uint32_t k=0; k<_param->_nb_special_register_logic; ++k)
37            internal_rat_spr_update_table [i][j][k] = rat_spr_update_table [i][j][k] and no_event;
38        }
39
40
41    // RETIRE is in order -> also don't need test if an instruction is valid
42    for (uint32_t i=0; i<_param->_nb_inst_retire; i++)
43      {
44        log_printf(TRACE,Register_Address_Translation_unit,FUNCTION,"  * inst_retire [%d]",i);
45
46        // init -> need't restore old value
47        Tcontrol_t retire_restore_rd_phy_old = false;
48        Tcontrol_t retire_restore_re_phy_old = false;
49
50        Tcontext_t front_end_id = (_param->_have_port_front_end_id)?PORT_READ(in_RETIRE_FRONT_END_ID [i]):0;
51        Tcontext_t context_id   = (_param->_have_port_context_id  )?PORT_READ(in_RETIRE_CONTEXT_ID   [i]):0;
52
53        // Test if event -> need restore ?
54        if (PORT_READ(in_RETIRE_EVENT_STATE [front_end_id][context_id]) != EVENT_STATE_NO_EVENT)
55          {
56            log_printf(TRACE,Register_Address_Translation_unit,FUNCTION,"    * Have event");
57            log_printf(TRACE,Register_Address_Translation_unit,FUNCTION,"    * front_end_id         : %d",front_end_id);
58            log_printf(TRACE,Register_Address_Translation_unit,FUNCTION,"    * context_id           : %d",context_id  );
59                       
60            // Test and update update table
61            if (PORT_READ(in_RETIRE_WRITE_RD [i]))
62              {
63                Tgeneral_address_t rd_log = PORT_READ(in_RETIRE_NUM_REG_RD_LOG [i]);
64                retire_restore_rd_phy_old = (internal_rat_gpr_update_table[front_end_id][context_id][rd_log] == 0);
65
66//                 log_printf(TRACE,Register_Address_Translation_unit,FUNCTION,"    * write_rd");
67//                 log_printf(TRACE,Register_Address_Translation_unit,FUNCTION,"      * rd_log             : %d",rd_log);
68//                 log_printf(TRACE,Register_Address_Translation_unit,FUNCTION,"      * rat_gpr_update     : %d",internal_rat_gpr_update_table[front_end_id][context_id][rd_log]);
69
70                internal_rat_gpr_update_table[front_end_id][context_id][rd_log] = 1;
71              }
72            if (PORT_READ(in_RETIRE_WRITE_RE [i]))
73              {
74//                 log_printf(TRACE,Register_Address_Translation_unit,FUNCTION,"    * write_re");
75
76                Tgeneral_address_t re_log = PORT_READ(in_RETIRE_NUM_REG_RE_LOG [i]);
77                retire_restore_re_phy_old = (internal_rat_spr_update_table[front_end_id][context_id][re_log] == 0);
78                internal_rat_spr_update_table[front_end_id][context_id][re_log] = 1;
79              }
80
81            log_printf(TRACE,Register_Address_Translation_unit,FUNCTION,"    * restore_rd_phy_old   : %d",retire_restore_rd_phy_old);
82            log_printf(TRACE,Register_Address_Translation_unit,FUNCTION,"    * restore_re_phy_old   : %d",retire_restore_re_phy_old);
83          }
84             
85        PORT_WRITE(out_RETIRE_RESTORE_RD_PHY_OLD[i], retire_restore_rd_phy_old);
86        PORT_WRITE(out_RETIRE_RESTORE_RE_PHY_OLD[i], retire_restore_re_phy_old);
87      }
88
89    log_end(Register_Address_Translation_unit,FUNCTION);
90  };
91
92}; // end namespace register_address_translation_unit
93}; // end namespace register_translation_unit
94}; // end namespace rename_unit
95}; // end namespace ooo_engine
96}; // end namespace multi_ooo_engine
97}; // end namespace core
98
99}; // end namespace behavioural
100}; // end namespace morpheo             
101#endif
Note: See TracBrowser for help on using the repository browser.