[78] | 1 | /* |
---|
| 2 | * $Id: Return_Address_Stack_allocation.cpp 88 2008-12-10 18:31:39Z 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); |
---|
| 93 | ALLOC1_SIGNAL_IN ( in_UPDATE_ADDRESS ,"address" ,Taddress_t,_param->_size_instruction_address); |
---|
| 94 | ALLOC1_SIGNAL_IN ( in_UPDATE_INDEX ,"index" ,Tptr_t ,_param->_size_index); |
---|
| 95 | ALLOC1_SIGNAL_IN ( in_UPDATE_MISS_PREDICTION ,"miss_prediction" ,Tcontrol_t,1); |
---|
[81] | 96 | ALLOC1_SIGNAL_IN ( in_UPDATE_PREDICTION_IFETCH,"prediction_ifetch",Tcontrol_t,1); |
---|
[78] | 97 | } |
---|
| 98 | |
---|
[88] | 99 | if (usage_is_set(_usage,USE_SYSTEMC)) |
---|
| 100 | { |
---|
[78] | 101 | // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 102 | |
---|
| 103 | reg_stack = new ras_entry_t * [_param->_nb_context]; |
---|
| 104 | for (uint32_t i=0; i<_param->_nb_context; i++) |
---|
| 105 | reg_stack [i] = new ras_entry_t [_param->_size_queue [i]]; |
---|
| 106 | |
---|
| 107 | reg_TOP = new Tptr_t [_param->_nb_context]; |
---|
| 108 | reg_BOTTOM = new Tptr_t [_param->_nb_context]; |
---|
[81] | 109 | reg_NB_ELT = new Tptr_t [_param->_nb_context]; |
---|
[78] | 110 | |
---|
| 111 | reg_PREDICT_TOP = new Tptr_t [_param->_nb_context]; |
---|
| 112 | reg_PREDICT_BOTTOM = new Tptr_t [_param->_nb_context]; |
---|
[81] | 113 | reg_PREDICT_NB_ELT = new Tptr_t [_param->_nb_context]; |
---|
[78] | 114 | |
---|
| 115 | internal_PREDICT_ACK = new Tcontrol_t [_param->_nb_inst_predict]; |
---|
| 116 | internal_PREDICT_HIT = new Tcontrol_t [_param->_nb_inst_predict]; |
---|
| 117 | internal_DECOD_ACK = new Tcontrol_t [_param->_nb_inst_decod ]; |
---|
| 118 | internal_DECOD_HIT = new Tcontrol_t [_param->_nb_inst_decod ]; |
---|
| 119 | internal_UPDATE_ACK = new Tcontrol_t [_param->_nb_inst_update ]; |
---|
[88] | 120 | } |
---|
[78] | 121 | |
---|
| 122 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 123 | |
---|
| 124 | #ifdef POSITION |
---|
[88] | 125 | if (usage_is_set(_usage,USE_POSITION)) |
---|
| 126 | _component->generate_file(); |
---|
[78] | 127 | #endif |
---|
| 128 | |
---|
| 129 | log_printf(FUNC,Return_Address_Stack,FUNCTION,"End"); |
---|
| 130 | }; |
---|
| 131 | |
---|
| 132 | }; // end namespace return_address_stack |
---|
| 133 | }; // end namespace prediction_unit |
---|
| 134 | }; // end namespace front_end |
---|
| 135 | }; // end namespace multi_front_end |
---|
| 136 | }; // end namespace core |
---|
| 137 | }; // end namespace behavioural |
---|
| 138 | }; // end namespace morpheo |
---|