1 | #ifdef SYSTEMC |
---|
2 | /* |
---|
3 | * $Id: Register_Address_Translation_unit_genMealy_retire.cpp 112 2009-03-18 22:36: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 | |
---|
11 | namespace morpheo { |
---|
12 | namespace behavioural { |
---|
13 | namespace core { |
---|
14 | namespace multi_ooo_engine { |
---|
15 | namespace ooo_engine { |
---|
16 | namespace rename_unit { |
---|
17 | namespace register_translation_unit { |
---|
18 | namespace 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 event = (PORT_READ(in_RETIRE_EVENT_STATE [i][j]) != EVENT_STATE_NO_EVENT); |
---|
34 | bool reset_update_table = (PORT_READ(in_RETIRE_EVENT_VAL [i][j]) and // always ack |
---|
35 | (PORT_READ(in_RETIRE_EVENT_STATE [i][j]) == EVENT_STATE_EVENT)); |
---|
36 | |
---|
37 | // not event -> update_table == 1 -> always update |
---|
38 | // event -> update_table and not reset |
---|
39 | for (uint32_t k=0; k<_param->_nb_general_register_logic; ++k) |
---|
40 | internal_rat_gpr_update_table [i][j][k] = // not event or |
---|
41 | (rat_gpr_update_table [i][j][k] and not reset_update_table); |
---|
42 | for (uint32_t k=0; k<_param->_nb_special_register_logic; ++k) |
---|
43 | internal_rat_spr_update_table [i][j][k] = // not event or |
---|
44 | (rat_spr_update_table [i][j][k] and not reset_update_table); |
---|
45 | } |
---|
46 | |
---|
47 | |
---|
48 | // RETIRE is in order -> also don't need test if an instruction is valid |
---|
49 | for (uint32_t i=0; i<_param->_nb_inst_retire; i++) |
---|
50 | { |
---|
51 | log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * inst_retire [%d]",i); |
---|
52 | |
---|
53 | // init -> need't restore old value |
---|
54 | Tcontrol_t retire_restore_rd_phy_old = false; |
---|
55 | Tcontrol_t retire_restore_re_phy_old = false; |
---|
56 | |
---|
57 | Tcontext_t front_end_id = (_param->_have_port_front_end_id)?PORT_READ(in_RETIRE_FRONT_END_ID [i]):0; |
---|
58 | Tcontext_t context_id = (_param->_have_port_context_id )?PORT_READ(in_RETIRE_CONTEXT_ID [i]):0; |
---|
59 | Tcontrol_t restore = (PORT_READ(in_RETIRE_EVENT_STATE [front_end_id][context_id]) != EVENT_STATE_NO_EVENT); |
---|
60 | |
---|
61 | // Test if event -> need restore ? |
---|
62 | if (restore) |
---|
63 | { |
---|
64 | log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * Have event"); |
---|
65 | log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * front_end_id : %d",front_end_id); |
---|
66 | log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * context_id : %d",context_id ); |
---|
67 | |
---|
68 | // Test and update update table |
---|
69 | if (PORT_READ(in_RETIRE_WRITE_RD [i])) |
---|
70 | { |
---|
71 | Tgeneral_address_t rd_log = PORT_READ(in_RETIRE_NUM_REG_RD_LOG [i]); |
---|
72 | retire_restore_rd_phy_old = (internal_rat_gpr_update_table[front_end_id][context_id][rd_log] == 0); |
---|
73 | |
---|
74 | // log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * write_rd"); |
---|
75 | // log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * rd_log : %d",rd_log); |
---|
76 | // log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * rat_gpr_update : %d",internal_rat_gpr_update_table[front_end_id][context_id][rd_log]); |
---|
77 | |
---|
78 | internal_rat_gpr_update_table[front_end_id][context_id][rd_log] = 1; |
---|
79 | } |
---|
80 | if (PORT_READ(in_RETIRE_WRITE_RE [i])) |
---|
81 | { |
---|
82 | // log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * write_re"); |
---|
83 | |
---|
84 | Tgeneral_address_t re_log = PORT_READ(in_RETIRE_NUM_REG_RE_LOG [i]); |
---|
85 | retire_restore_re_phy_old = (internal_rat_spr_update_table[front_end_id][context_id][re_log] == 0); |
---|
86 | internal_rat_spr_update_table[front_end_id][context_id][re_log] = 1; |
---|
87 | } |
---|
88 | |
---|
89 | log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * restore_rd_phy_old : %d",retire_restore_rd_phy_old); |
---|
90 | log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * restore_re_phy_old : %d",retire_restore_re_phy_old); |
---|
91 | } |
---|
92 | |
---|
93 | internal_RETIRE_RESTORE_RD_PHY_OLD[i] = retire_restore_rd_phy_old; |
---|
94 | internal_RETIRE_RESTORE_RE_PHY_OLD[i] = retire_restore_re_phy_old; |
---|
95 | |
---|
96 | PORT_WRITE(out_RETIRE_RESTORE_RD_PHY_OLD[i], internal_RETIRE_RESTORE_RD_PHY_OLD[i]); |
---|
97 | PORT_WRITE(out_RETIRE_RESTORE_RE_PHY_OLD[i], internal_RETIRE_RESTORE_RE_PHY_OLD[i]); |
---|
98 | PORT_WRITE(out_RETIRE_RESTORE [i], restore); |
---|
99 | } |
---|
100 | |
---|
101 | log_end(Register_Address_Translation_unit,FUNCTION); |
---|
102 | }; |
---|
103 | |
---|
104 | }; // end namespace register_address_translation_unit |
---|
105 | }; // end namespace register_translation_unit |
---|
106 | }; // end namespace rename_unit |
---|
107 | }; // end namespace ooo_engine |
---|
108 | }; // end namespace multi_ooo_engine |
---|
109 | }; // end namespace core |
---|
110 | |
---|
111 | }; // end namespace behavioural |
---|
112 | }; // end namespace morpheo |
---|
113 | #endif |
---|