[53] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: RegisterFile_allocation.cpp 146 2011-02-01 20:57:54Z rosiere $ |
---|
| 4 | * |
---|
[131] | 5 | * [ Description ] |
---|
[53] | 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/Generic/RegisterFile/include/RegisterFile.h" |
---|
[131] | 10 | #include "Behavioural/include/Allocation.h" |
---|
[53] | 11 | |
---|
| 12 | namespace morpheo { |
---|
| 13 | namespace behavioural { |
---|
| 14 | namespace generic { |
---|
| 15 | namespace registerfile { |
---|
| 16 | |
---|
[146] | 17 | void RegisterFile::allocation |
---|
| 18 | ( |
---|
[75] | 19 | #ifdef STATISTICS |
---|
[146] | 20 | morpheo::behavioural::Parameters_Statistics * param_statistics |
---|
[75] | 21 | #else |
---|
[146] | 22 | void |
---|
[75] | 23 | #endif |
---|
[146] | 24 | ) |
---|
[53] | 25 | { |
---|
[75] | 26 | std::string rename; |
---|
[53] | 27 | |
---|
| 28 | log_printf(FUNC,RegisterFile,"allocation","Begin"); |
---|
| 29 | |
---|
[131] | 30 | #ifdef SYSTEMCASS_SPECIFIC |
---|
| 31 | // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
[53] | 32 | { |
---|
[131] | 33 | __ALLOC0_SIGNAL(in_CLOCK ,"in_CLOCK" ,SC_CLOCK ); |
---|
| 34 | __ALLOC0_SIGNAL(in_NRESET,"in_NRESET",SC_IN (Tcontrol_t)); |
---|
[53] | 35 | } |
---|
[131] | 36 | // ~~~~~[ Interface : "read" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 37 | { |
---|
| 38 | __ALLOC1_INTERFACE_BEGIN("READ",_param->_nb_port_read); |
---|
[53] | 39 | |
---|
[131] | 40 | __ALLOC1_SIGNAL_IN ( in_READ_VAL ,"VAL" ,Tcontrol_t); |
---|
| 41 | __ALLOC1_SIGNAL_OUT(out_READ_ACK ,"ACK" ,Tcontrol_t); |
---|
| 42 | if (_param->_have_port_address) |
---|
| 43 | __ALLOC1_SIGNAL_IN ( in_READ_ADDRESS,"ADDRESS",Taddress_t); |
---|
| 44 | __ALLOC1_SIGNAL_OUT(out_READ_DATA ,"DATA" ,Tdata_t ); |
---|
[53] | 45 | |
---|
[131] | 46 | __ALLOC1_INTERFACE_END(_param->_nb_port_read); |
---|
| 47 | } |
---|
[53] | 48 | |
---|
[131] | 49 | // ~~~~~[ Interface : "write" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 50 | { |
---|
| 51 | __ALLOC1_INTERFACE_BEGIN("WRITE",_param->_nb_port_write); |
---|
[53] | 52 | |
---|
[131] | 53 | __ALLOC1_SIGNAL_IN ( in_WRITE_VAL ,"VAL" ,Tcontrol_t); |
---|
| 54 | __ALLOC1_SIGNAL_OUT(out_WRITE_ACK ,"ACK" ,Tcontrol_t); |
---|
| 55 | if (_param->_have_port_address) |
---|
| 56 | __ALLOC1_SIGNAL_IN ( in_WRITE_ADDRESS,"ADDRESS",Taddress_t); |
---|
| 57 | __ALLOC1_SIGNAL_IN ( in_WRITE_DATA ,"DATA" ,Tdata_t ); |
---|
[53] | 58 | |
---|
[131] | 59 | __ALLOC1_INTERFACE_END(_param->_nb_port_write); |
---|
| 60 | } |
---|
| 61 | #endif |
---|
| 62 | |
---|
[146] | 63 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 64 | |
---|
[62] | 65 | if (_param->_instance == instance_RegisterFile_Monolithic) |
---|
[53] | 66 | // =====[ component_RegisterFile_Monolithic ]========================= |
---|
| 67 | { |
---|
[146] | 68 | component_RegisterFile_Monolithic = new morpheo::behavioural::generic::registerfile::registerfile_monolithic ::RegisterFile_Monolithic ::RegisterFile_Monolithic |
---|
| 69 | (_name.c_str() |
---|
[53] | 70 | #ifdef STATISTICS |
---|
[146] | 71 | ,param_statistics |
---|
[53] | 72 | #endif |
---|
[146] | 73 | ,_param->_param_registerfile_monolithic |
---|
| 74 | ,_usage); |
---|
[53] | 75 | } |
---|
| 76 | else |
---|
| 77 | { |
---|
[146] | 78 | if (_param->_instance == instance_RegisterFile_Internal_Banked) |
---|
| 79 | // =====[ component_RegisterFile_Internal_Banked ]========================= |
---|
| 80 | { |
---|
| 81 | component_RegisterFile_Internal_Banked = new morpheo::behavioural::generic::registerfile::registerfile_internal_banked ::RegisterFile_Internal_Banked ::RegisterFile_Internal_Banked |
---|
| 82 | (_name.c_str() |
---|
[53] | 83 | #ifdef STATISTICS |
---|
[146] | 84 | ,param_statistics |
---|
[53] | 85 | #endif |
---|
[146] | 86 | ,_param->_param_registerfile_internal_banked |
---|
| 87 | ,_usage); |
---|
| 88 | } |
---|
| 89 | else |
---|
| 90 | { |
---|
| 91 | // =====[ component_RegisterFile_Multi_Banked ]======================= |
---|
| 92 | component_RegisterFile_Multi_Banked = new morpheo::behavioural::generic::registerfile::registerfile_multi_banked::RegisterFile_Multi_Banked::RegisterFile_Multi_Banked |
---|
| 93 | (_name.c_str() |
---|
| 94 | #ifdef STATISTICS |
---|
| 95 | ,param_statistics |
---|
| 96 | #endif |
---|
| 97 | ,_param->_param_registerfile_multi_banked |
---|
| 98 | ,_usage); |
---|
| 99 | } |
---|
[53] | 100 | } |
---|
| 101 | // ~~~~~[ Component - Instanciation ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 102 | |
---|
[62] | 103 | if (_param->_instance == instance_RegisterFile_Monolithic) |
---|
[53] | 104 | // =====[ Component_RegisterFile_Monolithic - Instanciation ]========= |
---|
| 105 | { |
---|
[131] | 106 | #ifdef SYSTEMCASS_SPECIFIC |
---|
| 107 | (*(component_RegisterFile_Monolithic ->in_CLOCK )) (*(in_CLOCK )); |
---|
[53] | 108 | (*(component_RegisterFile_Monolithic ->in_NRESET)) (*(in_NRESET)); |
---|
| 109 | |
---|
[62] | 110 | for (uint32_t i=0; i<_param->_nb_port_read; i++) |
---|
[53] | 111 | { |
---|
| 112 | (*(component_RegisterFile_Monolithic -> in_READ_VAL [i])) (*( in_READ_VAL [i])); |
---|
| 113 | (*(component_RegisterFile_Monolithic ->out_READ_ACK [i])) (*(out_READ_ACK [i])); |
---|
[62] | 114 | if (_param->_have_port_address == true) |
---|
[53] | 115 | (*(component_RegisterFile_Monolithic -> in_READ_ADDRESS [i])) (*( in_READ_ADDRESS [i])); |
---|
| 116 | (*(component_RegisterFile_Monolithic ->out_READ_DATA [i])) (*(out_READ_DATA [i])); |
---|
| 117 | } |
---|
| 118 | |
---|
[62] | 119 | for (uint32_t i=0; i<_param->_nb_port_write; i++) |
---|
[53] | 120 | { |
---|
| 121 | (*(component_RegisterFile_Monolithic -> in_WRITE_VAL [i])) (*( in_WRITE_VAL [i])); |
---|
| 122 | (*(component_RegisterFile_Monolithic ->out_WRITE_ACK [i])) (*(out_WRITE_ACK [i])); |
---|
[62] | 123 | if (_param->_have_port_address == true) |
---|
[53] | 124 | (*(component_RegisterFile_Monolithic -> in_WRITE_ADDRESS [i])) (*( in_WRITE_ADDRESS [i])); |
---|
| 125 | (*(component_RegisterFile_Monolithic -> in_WRITE_DATA [i])) (*( in_WRITE_DATA [i])); |
---|
| 126 | } |
---|
[131] | 127 | #else |
---|
| 128 | in_CLOCK = component_RegisterFile_Monolithic-> in_CLOCK ; |
---|
| 129 | in_NRESET = component_RegisterFile_Monolithic-> in_NRESET ; |
---|
| 130 | |
---|
| 131 | in_READ_VAL = component_RegisterFile_Monolithic-> in_READ_VAL ; |
---|
| 132 | out_READ_ACK = component_RegisterFile_Monolithic->out_READ_ACK ; |
---|
| 133 | in_READ_ADDRESS = component_RegisterFile_Monolithic-> in_READ_ADDRESS ; |
---|
| 134 | out_READ_DATA = component_RegisterFile_Monolithic->out_READ_DATA ; |
---|
| 135 | |
---|
| 136 | in_WRITE_VAL = component_RegisterFile_Monolithic-> in_WRITE_VAL ; |
---|
| 137 | out_WRITE_ACK = component_RegisterFile_Monolithic->out_WRITE_ACK ; |
---|
| 138 | in_WRITE_ADDRESS = component_RegisterFile_Monolithic-> in_WRITE_ADDRESS; |
---|
| 139 | in_WRITE_DATA = component_RegisterFile_Monolithic-> in_WRITE_DATA ; |
---|
| 140 | #endif |
---|
[53] | 141 | } |
---|
| 142 | else |
---|
| 143 | { |
---|
[146] | 144 | if (_param->_instance == instance_RegisterFile_Internal_Banked) |
---|
| 145 | // =====[ Component_RegisterFile_Internal_Banked - Instanciation ]========= |
---|
| 146 | { |
---|
[131] | 147 | #ifdef SYSTEMCASS_SPECIFIC |
---|
[146] | 148 | (*(component_RegisterFile_Internal_Banked ->in_CLOCK )) (*(in_CLOCK )); |
---|
| 149 | (*(component_RegisterFile_Internal_Banked ->in_NRESET)) (*(in_NRESET)); |
---|
| 150 | |
---|
| 151 | for (uint32_t i=0; i<_param->_nb_port_read; i++) |
---|
| 152 | { |
---|
| 153 | (*(component_RegisterFile_Internal_Banked -> in_READ_VAL [i])) (*( in_READ_VAL [i])); |
---|
| 154 | (*(component_RegisterFile_Internal_Banked ->out_READ_ACK [i])) (*(out_READ_ACK [i])); |
---|
| 155 | if (_param->_have_port_address == true) |
---|
| 156 | (*(component_RegisterFile_Internal_Banked -> in_READ_ADDRESS [i])) (*( in_READ_ADDRESS [i])); |
---|
| 157 | (*(component_RegisterFile_Internal_Banked ->out_READ_DATA [i])) (*(out_READ_DATA [i])); |
---|
| 158 | } |
---|
| 159 | |
---|
| 160 | for (uint32_t i=0; i<_param->_nb_port_write; i++) |
---|
| 161 | { |
---|
| 162 | (*(component_RegisterFile_Internal_Banked -> in_WRITE_VAL [i])) (*( in_WRITE_VAL [i])); |
---|
| 163 | (*(component_RegisterFile_Internal_Banked ->out_WRITE_ACK [i])) (*(out_WRITE_ACK [i])); |
---|
| 164 | if (_param->_have_port_address == true) |
---|
| 165 | (*(component_RegisterFile_Internal_Banked -> in_WRITE_ADDRESS [i])) (*( in_WRITE_ADDRESS [i])); |
---|
| 166 | (*(component_RegisterFile_Internal_Banked -> in_WRITE_DATA [i])) (*( in_WRITE_DATA [i])); |
---|
| 167 | } |
---|
| 168 | #else |
---|
| 169 | in_CLOCK = component_RegisterFile_Internal_Banked-> in_CLOCK ; |
---|
| 170 | in_NRESET = component_RegisterFile_Internal_Banked-> in_NRESET ; |
---|
| 171 | |
---|
| 172 | in_READ_VAL = component_RegisterFile_Internal_Banked-> in_READ_VAL ; |
---|
| 173 | out_READ_ACK = component_RegisterFile_Internal_Banked->out_READ_ACK ; |
---|
| 174 | in_READ_ADDRESS = component_RegisterFile_Internal_Banked-> in_READ_ADDRESS ; |
---|
| 175 | out_READ_DATA = component_RegisterFile_Internal_Banked->out_READ_DATA ; |
---|
| 176 | |
---|
| 177 | in_WRITE_VAL = component_RegisterFile_Internal_Banked-> in_WRITE_VAL ; |
---|
| 178 | out_WRITE_ACK = component_RegisterFile_Internal_Banked->out_WRITE_ACK ; |
---|
| 179 | in_WRITE_ADDRESS = component_RegisterFile_Internal_Banked-> in_WRITE_ADDRESS; |
---|
| 180 | in_WRITE_DATA = component_RegisterFile_Internal_Banked-> in_WRITE_DATA ; |
---|
| 181 | #endif |
---|
[53] | 182 | } |
---|
[146] | 183 | else |
---|
| 184 | // =====[ Component_RegisterFile_Multi_Banked - Instanciation ]======= |
---|
[53] | 185 | { |
---|
[146] | 186 | #ifdef SYSTEMCASS_SPECIFIC |
---|
| 187 | (*(component_RegisterFile_Multi_Banked->in_CLOCK )) (*(in_CLOCK )); |
---|
| 188 | (*(component_RegisterFile_Multi_Banked->in_NRESET)) (*(in_NRESET)); |
---|
| 189 | |
---|
| 190 | for (uint32_t i=0; i<_param->_nb_port_read; i++) |
---|
| 191 | { |
---|
| 192 | (*(component_RegisterFile_Multi_Banked-> in_READ_VAL [i])) (*( in_READ_VAL [i])); |
---|
| 193 | (*(component_RegisterFile_Multi_Banked->out_READ_ACK [i])) (*(out_READ_ACK [i])); |
---|
| 194 | if (_param->_have_port_address == true) |
---|
| 195 | (*(component_RegisterFile_Multi_Banked-> in_READ_ADDRESS [i])) (*( in_READ_ADDRESS [i])); |
---|
| 196 | (*(component_RegisterFile_Multi_Banked->out_READ_DATA [i])) (*(out_READ_DATA [i])); |
---|
| 197 | } |
---|
| 198 | |
---|
| 199 | for (uint32_t i=0; i<_param->_nb_port_write; i++) |
---|
| 200 | { |
---|
| 201 | (*(component_RegisterFile_Multi_Banked-> in_WRITE_VAL [i])) (*( in_WRITE_VAL [i])); |
---|
| 202 | (*(component_RegisterFile_Multi_Banked->out_WRITE_ACK [i])) (*(out_WRITE_ACK [i])); |
---|
| 203 | if (_param->_have_port_address == true) |
---|
| 204 | (*(component_RegisterFile_Multi_Banked-> in_WRITE_ADDRESS [i])) (*( in_WRITE_ADDRESS [i])); |
---|
| 205 | (*(component_RegisterFile_Multi_Banked-> in_WRITE_DATA [i])) (*( in_WRITE_DATA [i])); |
---|
| 206 | } |
---|
[131] | 207 | #else |
---|
[146] | 208 | in_CLOCK = component_RegisterFile_Multi_Banked-> in_CLOCK ; |
---|
| 209 | in_NRESET = component_RegisterFile_Multi_Banked-> in_NRESET ; |
---|
| 210 | |
---|
| 211 | in_READ_VAL = component_RegisterFile_Multi_Banked-> in_READ_VAL ; |
---|
| 212 | out_READ_ACK = component_RegisterFile_Multi_Banked->out_READ_ACK ; |
---|
| 213 | in_READ_ADDRESS = component_RegisterFile_Multi_Banked-> in_READ_ADDRESS ; |
---|
| 214 | out_READ_DATA = component_RegisterFile_Multi_Banked->out_READ_DATA ; |
---|
| 215 | |
---|
| 216 | in_WRITE_VAL = component_RegisterFile_Multi_Banked-> in_WRITE_VAL ; |
---|
| 217 | out_WRITE_ACK = component_RegisterFile_Multi_Banked->out_WRITE_ACK ; |
---|
| 218 | in_WRITE_ADDRESS = component_RegisterFile_Multi_Banked-> in_WRITE_ADDRESS; |
---|
| 219 | in_WRITE_DATA = component_RegisterFile_Multi_Banked-> in_WRITE_DATA ; |
---|
[131] | 220 | #endif |
---|
[146] | 221 | } |
---|
[53] | 222 | } |
---|
| 223 | |
---|
[62] | 224 | if (_param->_instance == instance_RegisterFile_Monolithic) |
---|
[146] | 225 | _component = component_RegisterFile_Monolithic->_component; |
---|
[53] | 226 | else |
---|
[146] | 227 | { |
---|
| 228 | if (_param->_instance == instance_RegisterFile_Internal_Banked) |
---|
| 229 | _component = component_RegisterFile_Internal_Banked->_component; |
---|
| 230 | else |
---|
| 231 | _component = component_RegisterFile_Multi_Banked->_component; |
---|
| 232 | } |
---|
[53] | 233 | log_printf(FUNC,RegisterFile,"allocation","End"); |
---|
| 234 | }; |
---|
| 235 | |
---|
| 236 | }; // end namespace registerfile |
---|
| 237 | }; // end namespace generic |
---|
| 238 | |
---|
| 239 | }; // end namespace behavioural |
---|
| 240 | }; // end namespace morpheo |
---|
| 241 | #endif |
---|