1 | #ifdef SYSTEMC |
---|
2 | /* |
---|
3 | * $Id: Register_Address_Translation_unit_function_depth_save_genMealy_rename.cpp 145 2010-10-13 18:15:51Z 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::function_depth_save_genMealy_rename" |
---|
23 | void Register_Address_Translation_unit::function_depth_save_genMealy_rename (void) |
---|
24 | { |
---|
25 | log_begin(Register_Address_Translation_unit,FUNCTION); |
---|
26 | log_function(Register_Address_Translation_unit,FUNCTION,_name.c_str()); |
---|
27 | |
---|
28 | if (PORT_READ(in_NRESET) != 0) |
---|
29 | { |
---|
30 | bool have_branch_previous = false; |
---|
31 | bool can_continue [_param->_nb_front_end][_param->_max_nb_context]; |
---|
32 | |
---|
33 | for (uint32_t i=0; i<_param->_nb_front_end; ++i) |
---|
34 | for (uint32_t j=0; j<_param->_nb_context[i]; ++j) |
---|
35 | can_continue [i][j] = true; |
---|
36 | |
---|
37 | for (uint32_t i=0; i<_param->_nb_inst_insert; i++) |
---|
38 | if (PORT_READ(in_RENAME_VAL [i])) // not in sensitive list : it's to have valide value to array access |
---|
39 | { |
---|
40 | log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * RENAME [%d]",i); |
---|
41 | |
---|
42 | Tcontext_t front_end_id = (_param->_have_port_front_end_id)?PORT_READ(in_RENAME_FRONT_END_ID [i]):0; |
---|
43 | Tcontext_t context_id = (_param->_have_port_context_id )?PORT_READ(in_RENAME_CONTEXT_ID [i]):0; |
---|
44 | // bool have_event = (PORT_READ(in_RETIRE_EVENT_VAL [front_end_id][context_id]) and // always ack |
---|
45 | // (PORT_READ(in_RETIRE_EVENT_STATE [front_end_id][context_id]) == EVENT_STATE_EVENT)); |
---|
46 | |
---|
47 | bool have_branch_current = PORT_READ(in_RENAME_SAVE_RAT [i]); |
---|
48 | |
---|
49 | // one branch per cycle |
---|
50 | can_continue[front_end_id][context_id] &= not (have_branch_current and have_branch_previous); |
---|
51 | |
---|
52 | log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * front_end_id : %d",front_end_id); |
---|
53 | log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * context_id : %d",context_id); |
---|
54 | // log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * have_event : %d",have_event); |
---|
55 | log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * have_branch_previous : %d",have_branch_previous); |
---|
56 | log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * have_branch_current : %d",have_branch_current ); |
---|
57 | log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * can_continue : %d",can_continue[front_end_id][context_id]); |
---|
58 | |
---|
59 | Tgeneral_address_t num_reg_ra_log = PORT_READ(in_RENAME_NUM_REG_RA_LOG [i]); //%_param->_nb_general_register; |
---|
60 | Tgeneral_address_t num_reg_rb_log = PORT_READ(in_RENAME_NUM_REG_RB_LOG [i]); //%_param->_nb_general_register; |
---|
61 | Tspecial_address_t num_reg_rc_log = PORT_READ(in_RENAME_NUM_REG_RC_LOG [i]); //%_param->_nb_special_register; |
---|
62 | Tgeneral_address_t num_reg_rd_log = PORT_READ(in_RENAME_NUM_REG_RD_LOG [i]); //%_param->_nb_general_register; |
---|
63 | Tspecial_address_t num_reg_re_log = PORT_READ(in_RENAME_NUM_REG_RE_LOG [i]); //%_param->_nb_special_register; |
---|
64 | |
---|
65 | Tgeneral_address_t num_reg_ra_phy = rat_gpr_speculative[front_end_id][context_id][num_reg_ra_log]; |
---|
66 | Tgeneral_address_t num_reg_rb_phy = rat_gpr_speculative[front_end_id][context_id][num_reg_rb_log]; |
---|
67 | Tspecial_address_t num_reg_rc_phy = rat_spr_speculative[front_end_id][context_id][num_reg_rc_log]; |
---|
68 | Tgeneral_address_t num_reg_rd_phy_old= rat_gpr_speculative[front_end_id][context_id][num_reg_rd_log]; |
---|
69 | Tspecial_address_t num_reg_re_phy_old= rat_spr_speculative[front_end_id][context_id][num_reg_re_log]; |
---|
70 | |
---|
71 | log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * num_reg_ra : %d -> %d",num_reg_ra_log,num_reg_ra_phy ); |
---|
72 | log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * num_reg_rb : %d -> %d",num_reg_rb_log,num_reg_rb_phy ); |
---|
73 | log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * num_reg_rc : %d -> %d",num_reg_rc_log,num_reg_rc_phy ); |
---|
74 | log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * num_reg_rd : %d -> %d",num_reg_rd_log,num_reg_rd_phy_old); |
---|
75 | log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * num_reg_re : %d -> %d",num_reg_re_log,num_reg_re_phy_old); |
---|
76 | |
---|
77 | internal_RENAME_ACK [i] = can_continue[front_end_id][context_id]; |
---|
78 | PORT_WRITE(out_RENAME_ACK [i],internal_RENAME_ACK [i]); |
---|
79 | PORT_WRITE(out_RENAME_NUM_REG_RA_PHY [i], num_reg_ra_phy ); |
---|
80 | PORT_WRITE(out_RENAME_NUM_REG_RB_PHY [i], num_reg_rb_phy ); |
---|
81 | PORT_WRITE(out_RENAME_NUM_REG_RC_PHY [i], num_reg_rc_phy ); |
---|
82 | PORT_WRITE(out_RENAME_NUM_REG_RD_PHY_OLD [i], num_reg_rd_phy_old); |
---|
83 | PORT_WRITE(out_RENAME_NUM_REG_RE_PHY_OLD [i], num_reg_re_phy_old); |
---|
84 | |
---|
85 | internal_RENAME_SAVE [i] = have_branch_current; |
---|
86 | |
---|
87 | // save info to the next instruction |
---|
88 | have_branch_previous |= have_branch_current; |
---|
89 | } |
---|
90 | } |
---|
91 | |
---|
92 | log_end(Register_Address_Translation_unit,FUNCTION); |
---|
93 | }; |
---|
94 | |
---|
95 | }; // end namespace register_address_translation_unit |
---|
96 | }; // end namespace register_translation_unit |
---|
97 | }; // end namespace rename_unit |
---|
98 | }; // end namespace ooo_engine |
---|
99 | }; // end namespace multi_ooo_engine |
---|
100 | }; // end namespace core |
---|
101 | |
---|
102 | }; // end namespace behavioural |
---|
103 | }; // end namespace morpheo |
---|
104 | #endif |
---|