- Timestamp:
- Mar 27, 2008, 11:04:49 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Allocation.h
r76 r78 7 7 // -----[ NO ITERATION ]------------------------------------------------- 8 8 // ---------------------------------------------------------------------- 9 10 #define __ALLOC_SIGNAL(sig, name, type) \ 11 { \ 12 sig = new type (name); \ 13 } 9 14 10 15 #ifdef POSITION … … 16 21 #endif 17 22 18 #define ALLOC_VAL ACK_IN( sig, name, type) \23 #define ALLOC_VAL_ACK_IN( sig, name, type) \ 19 24 { \ 20 25 sig = interface->set_signal_valack_in (name, type); \ 21 26 } 22 #define ALLOC_VAL ACK_OUT( sig, name, type) \27 #define ALLOC_VAL_ACK_OUT( sig, name, type) \ 23 28 { \ 24 29 sig = interface->set_signal_valack_out(name, type); \ 25 30 } 26 #define ALLOC_VAL _IN( sig)\27 { \ 28 sig = interface->set_signal_valack_in ( VAL); \31 #define ALLOC_VALACK_IN( sig, type) \ 32 { \ 33 sig = interface->set_signal_valack_in (type); \ 29 34 } 30 #define ALLOC_VAL_OUT( sig) \ 31 { \ 32 sig = interface->set_signal_valack_out(VAL); \ 33 } 34 #define ALLOC_ACK_IN( sig) \ 35 { \ 36 sig = interface->set_signal_valack_in (ACK); \ 37 } 38 #define ALLOC_ACK_OUT( sig) \ 39 { \ 40 sig = interface->set_signal_valack_out(ACK); \ 35 #define ALLOC_VALACK_OUT( sig, type) \ 36 { \ 37 sig = interface->set_signal_valack_out(type); \ 41 38 } 42 39 #define ALLOC_SIGNAL_IN( sig, name, type, size) \ … … 60 57 // -----[ ITERATION 1 ]-------------------------------------------------- 61 58 // ---------------------------------------------------------------------- 59 60 #define __ALLOC1_INTERFACE(name, it1) \ 61 const std::string interface_name = name; \ 62 const uint32_t iterator_1 = it1; 63 64 #define __ALLOC1_SIGNAL_IN( sig, name, type) \ 65 { \ 66 sig = new SC_IN(type) * [iterator_1]; \ 67 std::string separator="_"; \ 68 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ 69 { \ 70 std::string str = "in_"+interface_name+separator+toString(alloc_signal_it1)+separator+name; \ 71 sig [alloc_signal_it1] = new SC_IN(type) (str.c_str()); \ 72 } \ 73 } 74 75 #define __ALLOC1_SIGNAL_OUT( sig, name, type) \ 76 { \ 77 sig = new SC_OUT(type) * [iterator_1]; \ 78 std::string separator="_"; \ 79 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ 80 { \ 81 std::string str = "out_"+interface_name+separator+toString(alloc_signal_it1)+separator+name; \ 82 sig [alloc_signal_it1] = new SC_OUT(type) (str.c_str()); \ 83 } \ 84 } 62 85 63 86 #ifdef POSITION … … 66 89 Interface_fifo * interface [iterator_1]; \ 67 90 { \ 68 std::string separator="_";\69 for (uint32_t i=0; i<iterator_1; i++)\70 { \ 71 interface [ i] = _interfaces->set_interface( name+separator+toString(i), direction, localisation, str); \91 std::string separator="_"; \ 92 for (uint32_t alloc_interface_it1=0; alloc_interface_it1<iterator_1; alloc_interface_it1++) \ 93 { \ 94 interface [alloc_interface_it1] = _interfaces->set_interface( name+separator+toString(alloc_interface_it1), direction, localisation, str); \ 72 95 } \ 73 96 } … … 77 100 Interface_fifo * interface [iterator_1]; \ 78 101 { \ 79 std::string separator="_";\80 for (uint32_t i=0; i<iterator_1; i++)\81 { \ 82 interface [ i] = _interfaces->set_interface( name+separator+toString(i)); \102 std::string separator="_"; \ 103 for (uint32_t alloc_interface_it1=0; alloc_interface_it1<iterator_1; alloc_interface_it1++) \ 104 { \ 105 interface [alloc_interface_it1] = _interfaces->set_interface( name+separator+toString(alloc_interface_it1)); \ 83 106 } \ 84 107 } 85 108 #endif 86 109 87 88 #define ALLOC1_VALACK_IN( sig, name, type) \ 110 #define ALLOC1_VAL_ACK_IN( sig, name, type) \ 89 111 { \ 90 112 sig = new SC_IN (Tcontrol_t) * [iterator_1]; \ 91 for (uint32_t i=0; i<iterator_1; i++)\92 { \ 93 sig [ i] = interface[i]->set_signal_valack_in (name, type);\94 } \ 95 } 96 #define ALLOC1_VAL ACK_OUT(sig, name, type) \113 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ 114 { \ 115 sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_valack_in (name, type); \ 116 } \ 117 } 118 #define ALLOC1_VAL_ACK_OUT(sig, name, type) \ 97 119 { \ 98 120 sig = new SC_OUT(Tcontrol_t) * [iterator_1]; \ 99 for (uint32_t i=0; i<iterator_1; i++)\100 { \ 101 sig [ i] = interface[i]->set_signal_valack_out(name, type);\102 } \ 103 } 104 #define ALLOC1_VAL _IN( sig)\121 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ 122 { \ 123 sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_valack_out(name, type); \ 124 } \ 125 } 126 #define ALLOC1_VALACK_IN( sig, type) \ 105 127 { \ 106 128 sig = new SC_IN (Tcontrol_t) * [iterator_1]; \ 107 for (uint32_t i=0; i<iterator_1; i++)\108 { \ 109 sig [ i] = interface[i]->set_signal_valack_in (VAL);\110 } \ 111 } 112 #define ALLOC1_VAL _OUT( sig)\129 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ 130 { \ 131 sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_valack_in (type); \ 132 } \ 133 } 134 #define ALLOC1_VALACK_OUT( sig, type) \ 113 135 { \ 114 136 sig = new SC_OUT(Tcontrol_t) * [iterator_1]; \ 115 for (uint32_t i=0; i<iterator_1; i++) \ 116 { \ 117 sig [i] = interface[i]->set_signal_valack_out(VAL); \ 118 } \ 119 } 120 #define ALLOC1_ACK_IN( sig) \ 121 { \ 122 sig = new SC_IN (Tcontrol_t) * [iterator_1]; \ 123 for (uint32_t i=0; i<iterator_1; i++) \ 124 { \ 125 sig [i] = interface[i]->set_signal_valack_in (ACK); \ 126 } \ 127 } 128 #define ALLOC1_ACK_OUT( sig) \ 129 { \ 130 sig = new SC_OUT(Tcontrol_t) * [iterator_1]; \ 131 for (uint32_t i=0; i<iterator_1; i++) \ 132 { \ 133 sig [i] = interface[i]->set_signal_valack_out(ACK); \ 137 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ 138 { \ 139 sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_valack_out(type); \ 134 140 } \ 135 141 } … … 138 144 { \ 139 145 sig = new SC_IN (type) * [iterator_1]; \ 140 for (uint32_t i=0; i<iterator_1; i++)\146 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ 141 147 { \ 142 sig [ i] = interface[i]->set_signal_in <type> (name, size);\148 sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_in <type> (name, size); \ 143 149 } \ 144 150 } … … 148 154 { \ 149 155 sig = new SC_OUT(type) * [iterator_1]; \ 150 for (uint32_t i=0; i<iterator_1; i++)\156 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ 151 157 { \ 152 sig [ i] = interface[i]->set_signal_out<type> (name, size);\158 sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_out<type> (name, size); \ 153 159 } \ 154 160 } … … 159 165 std::string separator="_"; \ 160 166 std::string str; \ 161 for (uint32_t i=0; i<it1; i++) \ 162 { \ 163 str = name+separator+toString(i); \ 164 sig [i] = new sc_signal<type> (str.c_str()); \ 165 } \ 166 } 167 168 #define INSTANCE1_SC_SIGNAL(component, sig, it1) \ 169 for (uint32_t i=0; i<it1; i++) \ 170 { \ 171 (*(component->sig[i])) (*(sig[i])); \ 172 } 173 167 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ 168 { \ 169 str = name+separator+toString(alloc_signal_it1); \ 170 sig [alloc_signal_it1] = new sc_signal<type> (str.c_str()); \ 171 } \ 172 } 173 174 #define INSTANCE1_SC_SIGNAL(component, sig, it1) \ 175 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ 176 { \ 177 (*(component->sig[alloc_signal_it1])) (*(sig[alloc_signal_it1])); \ 178 } 179 180 // ---------------------------------------------------------------------- 181 // -----[ ITERATION 2 ]-------------------------------------------------- 182 // ---------------------------------------------------------------------- 183 184 #ifdef POSITION 185 #define ALLOC2_INTERFACE( name, direction, localisation, str, it1, it2) \ 186 uint32_t iterator_1 = 0; \ 187 uint32_t iterator_2 = 0; \ 188 Interface_fifo *** interface; \ 189 { \ 190 std::string separator="_"; \ 191 iterator_1 = it1; \ 192 interface = new Interface_fifo ** [iterator_1]; \ 193 for (uint32_t alloc_interface_it1=0; alloc_interface_it1<iterator_1; alloc_interface_it1++) \ 194 { \ 195 iterator_2 = it2; \ 196 interface [alloc_interface_it1] = new Interface_fifo * [iterator_2]; \ 197 for (uint32_t alloc_interface_it2=0; alloc_interface_it2<iterator_2; alloc_interface_it2++) \ 198 { \ 199 interface [alloc_interface_it1][alloc_interface_it2] = _interfaces->set_interface( name+separator+toString(alloc_interface_it1)+separator+toString(alloc_interface_it2), direction, localisation, str); \ 200 } \ 201 } \ 202 } 203 #else 204 #define ALLOC2_INTERFACE( name, direction, localisation, str, it1, it2) \ 205 uint32_t iterator_1 = 0; \ 206 uint32_t iterator_2 = 0; \ 207 Interface_fifo *** interface; \ 208 { \ 209 std::string separator="_"; \ 210 iterator_1 = it1; \ 211 interface = new Interface_fifo ** [iterator_1]; \ 212 for (uint32_t alloc_interface_it1=0; alloc_interface_it1<iterator_1; alloc_interface_it1++) \ 213 { \ 214 iterator_2 = it2; \ 215 interface [alloc_interface_it1] = new Interface_fifo * [iterator_2]; \ 216 for (uint32_t alloc_interface_it2=0; alloc_interface_it2<iterator_2; alloc_interface_it2++) \ 217 { \ 218 interface [alloc_interface_it1][alloc_interface_it2] = _interfaces->set_interface( name+separator+toString(alloc_interface_it1)+separator+toString(alloc_interface_it2)); \ 219 } \ 220 } \ 221 } 174 222 #endif 223 224 #define _ALLOC2_VAL_ACK_IN( sig, name, type, it1, it2) \ 225 { \ 226 sig = new SC_IN (Tcontrol_t) ** [it1]; \ 227 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ 228 { \ 229 sig [alloc_signal_it1] = new SC_IN (Tcontrol_t) * [it2]; \ 230 for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \ 231 { \ 232 sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_valack_in (name, type); \ 233 } \ 234 } \ 235 } 236 237 #define _ALLOC2_VAL_ACK_OUT( sig, name, type, it1, it2) \ 238 { \ 239 sig = new SC_OUT (Tcontrol_t) ** [it1]; \ 240 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ 241 { \ 242 sig [alloc_signal_it1] = new SC_OUT (Tcontrol_t) * [it2]; \ 243 for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \ 244 { \ 245 sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_valack_out (name, type); \ 246 } \ 247 } \ 248 } 249 250 #define _ALLOC2_VALACK_IN( sig,type, it1, it2) \ 251 { \ 252 sig = new SC_IN (Tcontrol_t) ** [it1]; \ 253 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ 254 { \ 255 sig [alloc_signal_it1] = new SC_IN (Tcontrol_t) * [it2]; \ 256 for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \ 257 { \ 258 sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_valack_in (type); \ 259 } \ 260 } \ 261 } 262 263 #define _ALLOC2_VALACK_OUT( sig,type, it1, it2) \ 264 { \ 265 sig = new SC_OUT (Tcontrol_t) ** [it1]; \ 266 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ 267 { \ 268 sig [alloc_signal_it1] = new SC_OUT (Tcontrol_t) * [it2]; \ 269 for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \ 270 { \ 271 sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_valack_out (type); \ 272 } \ 273 } \ 274 } 275 276 #define _ALLOC2_SIGNAL_IN( sig, name, type, size, it1, it2) \ 277 if (size > 0) \ 278 { \ 279 sig = new SC_IN (type) ** [it1]; \ 280 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ 281 { \ 282 sig [alloc_signal_it1] = new SC_IN (type) * [it2]; \ 283 for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \ 284 { \ 285 sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_in <type> (name, size); \ 286 } \ 287 } \ 288 } 289 290 #define _ALLOC2_SIGNAL_OUT( sig, name, type, size, it1, it2) \ 291 if (size > 0) \ 292 { \ 293 sig = new SC_OUT (type) ** [it1]; \ 294 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ 295 { \ 296 sig [alloc_signal_it1] = new SC_OUT (type) * [it2]; \ 297 for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \ 298 { \ 299 sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_out <type> (name, size); \ 300 } \ 301 } \ 302 } 303 304 #define ALLOC2_VAL_ACK_IN( sig, name, type ) _ALLOC2_VAL_ACK_IN( sig, name, type , iterator_1, iterator_2) 305 #define ALLOC2_VAL_ACK_OUT(sig, name, type ) _ALLOC2_VAL_ACK_OUT(sig, name, type , iterator_1, iterator_2) 306 #define ALLOC2_VALACK_IN( sig, type ) _ALLOC2_VALACK_IN( sig, type , iterator_1, iterator_2) 307 #define ALLOC2_VALACK_OUT( sig, type ) _ALLOC2_VALACK_OUT( sig, type , iterator_1, iterator_2) 308 #define ALLOC2_SIGNAL_IN( sig, name, type, size) _ALLOC2_SIGNAL_IN( sig, name, type, size, iterator_1, iterator_2) 309 #define ALLOC2_SIGNAL_OUT( sig, name, type, size) _ALLOC2_SIGNAL_OUT( sig, name, type, size, iterator_1, iterator_2) 310 311 #define ALLOC2_SC_SIGNAL( sig, name, type, it1, it2) \ 312 sc_signal<type> *** sig = new sc_signal<type> ** [it1]; \ 313 { \ 314 std::string separator="_"; \ 315 std::string str; \ 316 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ 317 { \ 318 sig [alloc_signal_it1] = new sc_signal<type> * [it2]; \ 319 for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \ 320 { \ 321 str = name+separator+toString(alloc_signal_it1)+separator+toString(alloc_signal_it2); \ 322 sig [alloc_signal_it1][alloc_signal_it2] = new sc_signal<type> (str.c_str()); \ 323 } \ 324 } \ 325 } 326 327 #define INSTANCE2_SC_SIGNAL(component, sig, it1, it2) \ 328 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ 329 for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \ 330 { \ 331 (*(component->sig[alloc_signal_it1][alloc_signal_it2])) (*(sig[alloc_signal_it1][alloc_signal_it2])); \ 332 } 333 #endif
Note: See TracChangeset
for help on using the changeset viewer.