[78] | 1 | /* |
---|
| 2 | * $Id: Return_Address_Stack_allocation.cpp 95 2008-12-16 16:24:26Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Return_Address_Stack/include/Return_Address_Stack.h" |
---|
| 9 | #include "Behavioural/include/Allocation.h" |
---|
| 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | namespace core { |
---|
| 14 | namespace multi_front_end { |
---|
| 15 | namespace front_end { |
---|
| 16 | namespace prediction_unit { |
---|
| 17 | namespace return_address_stack { |
---|
| 18 | |
---|
| 19 | #undef FUNCTION |
---|
| 20 | #define FUNCTION "Return_Address_Stack::allocation" |
---|
| 21 | void Return_Address_Stack::allocation ( |
---|
| 22 | #ifdef STATISTICS |
---|
[88] | 23 | morpheo::behavioural::Parameters_Statistics * param_statistics |
---|
[78] | 24 | #else |
---|
[88] | 25 | void |
---|
[78] | 26 | #endif |
---|
[88] | 27 | ) |
---|
[78] | 28 | { |
---|
| 29 | log_printf(FUNC,Return_Address_Stack,FUNCTION,"Begin"); |
---|
| 30 | |
---|
| 31 | _component = new Component (_usage); |
---|
| 32 | |
---|
| 33 | Entity * entity = _component->set_entity (_name |
---|
| 34 | ,"Return_Address_Stack" |
---|
| 35 | #ifdef POSITION |
---|
| 36 | ,COMBINATORY |
---|
| 37 | #endif |
---|
| 38 | ); |
---|
| 39 | |
---|
| 40 | _interfaces = entity->set_interfaces(); |
---|
| 41 | |
---|
| 42 | // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 43 | { |
---|
| 44 | Interface * interface = _interfaces->set_interface("" |
---|
| 45 | #ifdef POSITION |
---|
| 46 | ,IN |
---|
| 47 | ,SOUTH, |
---|
| 48 | "Generalist interface" |
---|
| 49 | #endif |
---|
| 50 | ); |
---|
| 51 | |
---|
| 52 | in_CLOCK = interface->set_signal_clk ("clock" ,1, CLOCK_VHDL_YES); |
---|
| 53 | in_NRESET = interface->set_signal_in <Tcontrol_t> ("nreset",1, RESET_VHDL_YES); |
---|
| 54 | } |
---|
| 55 | |
---|
| 56 | // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 57 | { |
---|
| 58 | ALLOC1_INTERFACE("predict", IN, SOUTH, "predict's interface", _param->_nb_inst_predict); |
---|
| 59 | |
---|
| 60 | ALLOC1_VALACK_IN ( in_PREDICT_VAL ,VAL); |
---|
| 61 | ALLOC1_VALACK_OUT(out_PREDICT_ACK ,ACK); |
---|
| 62 | ALLOC1_SIGNAL_IN ( in_PREDICT_CONTEXT_ID ,"context_id" ,Tcontext_t,_param->_size_context_id); |
---|
| 63 | ALLOC1_SIGNAL_OUT(out_PREDICT_HIT ,"hit" ,Tcontrol_t,1); |
---|
| 64 | ALLOC1_SIGNAL_IN ( in_PREDICT_PUSH ,"push" ,Tcontrol_t,1); |
---|
[88] | 65 | ALLOC1_SIGNAL_IN ( in_PREDICT_ADDRESS_PUSH,"address_push",Taddress_t,_param->_size_instruction_address); |
---|
| 66 | ALLOC1_SIGNAL_OUT(out_PREDICT_ADDRESS_POP ,"address_pop" ,Taddress_t,_param->_size_instruction_address); |
---|
[78] | 67 | ALLOC1_SIGNAL_OUT(out_PREDICT_INDEX ,"index" ,Tptr_t ,_param->_size_index); |
---|
| 68 | } |
---|
| 69 | |
---|
| 70 | // ~~~~~[ Interface : "decod" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 71 | { |
---|
| 72 | ALLOC1_INTERFACE("decod", IN, SOUTH, "decod's interface", _param->_nb_inst_decod); |
---|
| 73 | |
---|
| 74 | ALLOC1_VALACK_IN ( in_DECOD_VAL ,VAL); |
---|
| 75 | ALLOC1_VALACK_OUT(out_DECOD_ACK ,ACK); |
---|
| 76 | ALLOC1_SIGNAL_IN ( in_DECOD_CONTEXT_ID ,"context_id" ,Tcontext_t,_param->_size_context_id); |
---|
| 77 | ALLOC1_SIGNAL_OUT(out_DECOD_HIT ,"hit" ,Tcontrol_t,1); |
---|
| 78 | ALLOC1_SIGNAL_IN ( in_DECOD_PUSH ,"push" ,Tcontrol_t,1); |
---|
[88] | 79 | ALLOC1_SIGNAL_IN ( in_DECOD_ADDRESS_PUSH ,"address_push" ,Taddress_t,_param->_size_instruction_address); |
---|
| 80 | ALLOC1_SIGNAL_OUT(out_DECOD_ADDRESS_POP ,"address_pop" ,Taddress_t,_param->_size_instruction_address); |
---|
[78] | 81 | ALLOC1_SIGNAL_OUT(out_DECOD_INDEX ,"index" ,Tptr_t ,_param->_size_index); |
---|
| 82 | ALLOC1_SIGNAL_IN ( in_DECOD_MISS_PREDICTION,"miss_prediction",Tcontrol_t,1); |
---|
| 83 | } |
---|
| 84 | |
---|
| 85 | // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 86 | { |
---|
| 87 | ALLOC1_INTERFACE("update", IN, SOUTH, "update's interface", _param->_nb_inst_update); |
---|
| 88 | |
---|
[88] | 89 | ALLOC1_VALACK_IN ( in_UPDATE_VAL ,VAL); |
---|
| 90 | ALLOC1_VALACK_OUT(out_UPDATE_ACK ,ACK); |
---|
| 91 | ALLOC1_SIGNAL_IN ( in_UPDATE_CONTEXT_ID ,"context_id" ,Tcontext_t,_param->_size_context_id); |
---|
| 92 | ALLOC1_SIGNAL_IN ( in_UPDATE_PUSH ,"push" ,Tcontrol_t,1); |
---|
[95] | 93 | ALLOC1_SIGNAL_IN ( in_UPDATE_FLUSH ,"flush" ,Tcontrol_t,1); |
---|
[88] | 94 | ALLOC1_SIGNAL_IN ( in_UPDATE_ADDRESS ,"address" ,Taddress_t,_param->_size_instruction_address); |
---|
| 95 | ALLOC1_SIGNAL_IN ( in_UPDATE_INDEX ,"index" ,Tptr_t ,_param->_size_index); |
---|
| 96 | ALLOC1_SIGNAL_IN ( in_UPDATE_MISS_PREDICTION ,"miss_prediction" ,Tcontrol_t,1); |
---|
[81] | 97 | ALLOC1_SIGNAL_IN ( in_UPDATE_PREDICTION_IFETCH,"prediction_ifetch",Tcontrol_t,1); |
---|
[78] | 98 | } |
---|
| 99 | |
---|
[88] | 100 | if (usage_is_set(_usage,USE_SYSTEMC)) |
---|
| 101 | { |
---|
[78] | 102 | // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 103 | |
---|
| 104 | reg_stack = new ras_entry_t * [_param->_nb_context]; |
---|
| 105 | for (uint32_t i=0; i<_param->_nb_context; i++) |
---|
| 106 | reg_stack [i] = new ras_entry_t [_param->_size_queue [i]]; |
---|
| 107 | |
---|
| 108 | reg_TOP = new Tptr_t [_param->_nb_context]; |
---|
| 109 | reg_BOTTOM = new Tptr_t [_param->_nb_context]; |
---|
[81] | 110 | reg_NB_ELT = new Tptr_t [_param->_nb_context]; |
---|
[78] | 111 | |
---|
| 112 | reg_PREDICT_TOP = new Tptr_t [_param->_nb_context]; |
---|
| 113 | reg_PREDICT_BOTTOM = new Tptr_t [_param->_nb_context]; |
---|
[81] | 114 | reg_PREDICT_NB_ELT = new Tptr_t [_param->_nb_context]; |
---|
[78] | 115 | |
---|
| 116 | internal_PREDICT_ACK = new Tcontrol_t [_param->_nb_inst_predict]; |
---|
| 117 | internal_PREDICT_HIT = new Tcontrol_t [_param->_nb_inst_predict]; |
---|
| 118 | internal_DECOD_ACK = new Tcontrol_t [_param->_nb_inst_decod ]; |
---|
| 119 | internal_DECOD_HIT = new Tcontrol_t [_param->_nb_inst_decod ]; |
---|
| 120 | internal_UPDATE_ACK = new Tcontrol_t [_param->_nb_inst_update ]; |
---|
[88] | 121 | } |
---|
[78] | 122 | |
---|
| 123 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 124 | |
---|
| 125 | #ifdef POSITION |
---|
[88] | 126 | if (usage_is_set(_usage,USE_POSITION)) |
---|
| 127 | _component->generate_file(); |
---|
[78] | 128 | #endif |
---|
| 129 | |
---|
| 130 | log_printf(FUNC,Return_Address_Stack,FUNCTION,"End"); |
---|
| 131 | }; |
---|
| 132 | |
---|
| 133 | }; // end namespace return_address_stack |
---|
| 134 | }; // end namespace prediction_unit |
---|
| 135 | }; // end namespace front_end |
---|
| 136 | }; // end namespace multi_front_end |
---|
| 137 | }; // end namespace core |
---|
| 138 | }; // end namespace behavioural |
---|
| 139 | }; // end namespace morpheo |
---|