[78] | 1 | /* |
---|
| 2 | * $Id: Direction_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/Direction/include/Direction.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 direction { |
---|
| 18 | |
---|
| 19 | |
---|
| 20 | |
---|
| 21 | #undef FUNCTION |
---|
| 22 | #define FUNCTION "Direction::allocation" |
---|
[82] | 23 | void Direction::allocation |
---|
| 24 | ( |
---|
[78] | 25 | #ifdef STATISTICS |
---|
[82] | 26 | morpheo::behavioural::Parameters_Statistics * param_statistics |
---|
[78] | 27 | #else |
---|
[82] | 28 | void |
---|
[78] | 29 | #endif |
---|
[82] | 30 | ) |
---|
[78] | 31 | { |
---|
| 32 | log_printf(FUNC,Direction,FUNCTION,"Begin"); |
---|
| 33 | |
---|
| 34 | _component = new Component (_usage); |
---|
| 35 | |
---|
| 36 | Entity * entity = _component->set_entity (_name |
---|
| 37 | ,"Direction" |
---|
| 38 | #ifdef POSITION |
---|
| 39 | ,COMBINATORY |
---|
| 40 | #endif |
---|
| 41 | ); |
---|
| 42 | |
---|
| 43 | _interfaces = entity->set_interfaces(); |
---|
| 44 | |
---|
| 45 | // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 46 | { |
---|
| 47 | Interface * interface = _interfaces->set_interface("" |
---|
| 48 | #ifdef POSITION |
---|
| 49 | ,IN |
---|
| 50 | ,SOUTH, |
---|
| 51 | "Generalist interface" |
---|
| 52 | #endif |
---|
| 53 | ); |
---|
| 54 | |
---|
| 55 | in_CLOCK = interface->set_signal_clk ("clock" ,1, CLOCK_VHDL_YES); |
---|
| 56 | in_NRESET = interface->set_signal_in <Tcontrol_t> ("nreset",1, RESET_VHDL_YES); |
---|
| 57 | } |
---|
| 58 | |
---|
| 59 | // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 60 | { |
---|
| 61 | ALLOC1_INTERFACE("predict", IN, SOUTH, "Interface predict",_param->_nb_inst_predict); |
---|
| 62 | |
---|
| 63 | ALLOC1_VALACK_IN ( in_PREDICT_VAL ,VAL); |
---|
| 64 | ALLOC1_VALACK_OUT(out_PREDICT_ACK ,ACK); |
---|
[88] | 65 | ALLOC1_SIGNAL_IN ( in_PREDICT_ADDRESS_SRC,"address_src",Taddress_t,_param->_size_instruction_address); |
---|
[78] | 66 | ALLOC1_SIGNAL_IN ( in_PREDICT_STATIC ,"static" ,Tcontrol_t,1); |
---|
| 67 | ALLOC1_SIGNAL_IN ( in_PREDICT_LAST_TAKE ,"last_take" ,Tcontrol_t,1); |
---|
| 68 | ALLOC1_SIGNAL_OUT(out_PREDICT_HISTORY ,"history" ,Thistory_t,_param->_size_history); |
---|
| 69 | ALLOC1_SIGNAL_OUT(out_PREDICT_DIRECTION ,"direction" ,Tcontrol_t,1); |
---|
| 70 | } |
---|
| 71 | |
---|
| 72 | // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 73 | { |
---|
| 74 | ALLOC1_INTERFACE("update", IN, SOUTH, "Interface update",_param->_nb_inst_update); |
---|
| 75 | |
---|
| 76 | ALLOC1_VALACK_IN ( in_UPDATE_VAL ,VAL); |
---|
| 77 | ALLOC1_VALACK_OUT(out_UPDATE_ACK ,ACK); |
---|
[88] | 78 | ALLOC1_SIGNAL_IN ( in_UPDATE_ADDRESS ,"address" ,Taddress_t,_param->_size_instruction_address); |
---|
[78] | 79 | ALLOC1_SIGNAL_IN ( in_UPDATE_HISTORY ,"history" ,Thistory_t,_param->_size_history); |
---|
| 80 | ALLOC1_SIGNAL_IN ( in_UPDATE_DIRECTION,"direction",Tcontrol_t,1); |
---|
| 81 | } |
---|
| 82 | |
---|
| 83 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 84 | std::string name; |
---|
| 85 | |
---|
| 86 | { |
---|
| 87 | name = _name+"_glue"; |
---|
[82] | 88 | log_printf(INFO,Prediction_unit,FUNCTION,_("Create : %s"),name.c_str()); |
---|
[78] | 89 | |
---|
| 90 | _component_glue = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::direction_glue::Direction_Glue |
---|
| 91 | (name.c_str() |
---|
| 92 | #ifdef STATISTICS |
---|
| 93 | ,param_statistics |
---|
| 94 | #endif |
---|
[82] | 95 | ,_param->_param_glue |
---|
| 96 | ,_usage); |
---|
[78] | 97 | |
---|
| 98 | _component->set_component (_component_glue->_component |
---|
| 99 | #ifdef POSITION |
---|
| 100 | , 50, 50, 10, 10 |
---|
| 101 | #endif |
---|
| 102 | ); |
---|
| 103 | } |
---|
| 104 | |
---|
| 105 | // ~~~~~[ Instanciation ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 106 | std::string src,dest; |
---|
| 107 | |
---|
| 108 | { |
---|
| 109 | src = _name+"_glue"; |
---|
[82] | 110 | log_printf(INFO,Prediction_unit,FUNCTION,_("Instance : %s"),src.c_str()); |
---|
[78] | 111 | |
---|
| 112 | { |
---|
| 113 | dest = _name; |
---|
| 114 | #ifdef POSITION |
---|
| 115 | _component->interface_map (src ,"", |
---|
| 116 | dest,""); |
---|
| 117 | #endif |
---|
| 118 | |
---|
| 119 | PORT_MAP(_component,src , "in_CLOCK" ,dest, "in_CLOCK"); |
---|
| 120 | PORT_MAP(_component,src , "in_NRESET",dest, "in_NRESET"); |
---|
| 121 | } |
---|
| 122 | |
---|
| 123 | for (uint32_t i=0; i<_param->_nb_inst_predict; i++) |
---|
| 124 | { |
---|
| 125 | dest = _name; |
---|
| 126 | #ifdef POSITION |
---|
| 127 | _component->interface_map (src ,"predict_"+toString(i), |
---|
| 128 | dest,"predict_"+toString(i)); |
---|
| 129 | #endif |
---|
| 130 | |
---|
| 131 | PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_VAL" , |
---|
| 132 | dest, "in_PREDICT_"+toString(i)+"_VAL" ); |
---|
| 133 | PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_ACK" , |
---|
| 134 | dest,"out_PREDICT_"+toString(i)+"_ACK" ); |
---|
| 135 | PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_ADDRESS_SRC", |
---|
| 136 | dest, "in_PREDICT_"+toString(i)+"_ADDRESS_SRC"); |
---|
| 137 | PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_STATIC" , |
---|
| 138 | dest, "in_PREDICT_"+toString(i)+"_STATIC" ); |
---|
| 139 | PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_LAST_TAKE" , |
---|
| 140 | dest, "in_PREDICT_"+toString(i)+"_LAST_TAKE" ); |
---|
| 141 | if (_param->_have_port_history) |
---|
| 142 | PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_HISTORY" , |
---|
| 143 | dest,"out_PREDICT_"+toString(i)+"_HISTORY" ); |
---|
| 144 | PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_DIRECTION" , |
---|
| 145 | dest,"out_PREDICT_"+toString(i)+"_DIRECTION" ); |
---|
| 146 | |
---|
| 147 | // PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_PREDICTOR_VAL" ,dest,"out_PREDICT_"+toString(i)+"_PREDICTOR_VAL" ); |
---|
| 148 | // PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_PREDICTOR_ACK" ,dest, "in_PREDICT_"+toString(i)+"_PREDICTOR_ACK" ); |
---|
| 149 | // PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_PREDICTOR_ADDRESS_SRC",dest,"out_PREDICT_"+toString(i)+"_PREDICTOR_ADDRESS_SRC"); |
---|
| 150 | // PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_PREDICTOR_HISTORY" ,dest, "in_PREDICT_"+toString(i)+"_PREDICTOR_HISTORY" ); |
---|
| 151 | // PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_PREDICTOR_DIRECTION" ,dest, "in_PREDICT_"+toString(i)+"_PREDICTOR_DIRECTION" ); |
---|
| 152 | } |
---|
| 153 | |
---|
| 154 | for (uint32_t i=0; i<_param->_nb_inst_update; i++) |
---|
| 155 | { |
---|
| 156 | dest = _name; |
---|
| 157 | #ifdef POSITION |
---|
| 158 | _component->interface_map (src ,"update_"+toString(i), |
---|
| 159 | dest,"update_"+toString(i)); |
---|
| 160 | #endif |
---|
| 161 | |
---|
| 162 | PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_VAL" , |
---|
| 163 | dest, "in_UPDATE_"+toString(i)+"_VAL" ); |
---|
| 164 | PORT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_ACK" , |
---|
| 165 | dest,"out_UPDATE_"+toString(i)+"_ACK" ); |
---|
| 166 | PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_ADDRESS" , |
---|
| 167 | dest, "in_UPDATE_"+toString(i)+"_ADDRESS" ); |
---|
| 168 | if (_param->_have_port_history) |
---|
| 169 | PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_HISTORY" , |
---|
| 170 | dest, "in_UPDATE_"+toString(i)+"_HISTORY" ); |
---|
| 171 | PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_DIRECTION", |
---|
| 172 | dest, "in_UPDATE_"+toString(i)+"_DIRECTION"); |
---|
| 173 | // PORT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_PREDICTOR_VAL" ,dest,"out_UPDATE_"+toString(i)+"_PREDICTOR_VAL" ); |
---|
| 174 | // PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_PREDICTOR_ACK" ,dest, "in_UPDATE_"+toString(i)+"_PREDICTOR_ACK" ); |
---|
| 175 | // PORT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_PREDICTOR_ADDRESS" ,dest,"out_UPDATE_"+toString(i)+"_PREDICTOR_ADDRESS" ); |
---|
| 176 | // PORT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_PREDICTOR_HISTORY" ,dest,"out_UPDATE_"+toString(i)+"_PREDICTOR_HISTORY" ); |
---|
| 177 | // PORT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_PREDICTOR_DIRECTION",dest,"out_UPDATE_"+toString(i)+"_PREDICTOR_DIRECTION"); |
---|
| 178 | } |
---|
| 179 | } |
---|
| 180 | // ~~~~~[ Others ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
[82] | 181 | // _component->test_map(); |
---|
[78] | 182 | |
---|
| 183 | #ifdef POSITION |
---|
[88] | 184 | if (usage_is_set(_usage,USE_POSITION)) |
---|
| 185 | _component->generate_file(); |
---|
[78] | 186 | #endif |
---|
| 187 | |
---|
| 188 | log_printf(FUNC,Direction,FUNCTION,"End"); |
---|
| 189 | }; |
---|
| 190 | |
---|
| 191 | }; // end namespace direction |
---|
| 192 | }; // end namespace prediction_unit |
---|
| 193 | }; // end namespace front_end |
---|
| 194 | }; // end namespace multi_front_end |
---|
| 195 | }; // end namespace core |
---|
| 196 | |
---|
| 197 | }; // end namespace behavioural |
---|
| 198 | }; // end namespace morpheo |
---|