Changeset 709 for soft/giet_vm/giet_xml
- Timestamp:
- Oct 1, 2015, 4:20:46 PM (9 years ago)
- Location:
- soft/giet_vm/giet_xml
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_xml/mapping_info.h
r645 r709 14 14 // 15 15 // 2/ a description of the applications (called vspaces) to be - statically - 16 // launched on the platform. The number of parallel tasks per application is16 // mapped on the platform. The number of parallel threads per application is 17 17 // variable (can be one). Each vspace contains a variable number 18 18 // of virtual segments (called vsegs). 19 19 // 20 // 3/ the mapping directives: both t asks on processors, and software objects21 // (vsegs) on thephysical memory banks (psegs).20 // 3/ the mapping directives: both threads on processors, and software objects 21 // (vsegs) on physical memory banks (psegs). 22 22 // 23 23 // The mapping_info data structure is organised as the concatenation of … … 28 28 // - mapping_vspace_t vspace[] 29 29 // - mapping_vseg_t vseg[] 30 // - mapping_t ask_t task[]30 // - mapping_thread_t thread[] 31 31 // - mapping_proc_t proc[] 32 32 // - mapping_irq_t irq[] … … 44 44 #define MAPPING_VSEG_SIZE sizeof(mapping_vseg_t) 45 45 #define MAPPING_PSEG_SIZE sizeof(mapping_pseg_t) 46 #define MAPPING_T ASK_SIZE sizeof(mapping_task_t)46 #define MAPPING_THREAD_SIZE sizeof(mapping_thread_t) 47 47 #define MAPPING_PROC_SIZE sizeof(mapping_proc_t) 48 48 #define MAPPING_IRQ_SIZE sizeof(mapping_irq_t) … … 152 152 unsigned int psegs; // total number of physical segments 153 153 unsigned int vsegs; // total number of virtual segments 154 unsigned int t asks; // total number of tasks154 unsigned int threads; // total number of threads 155 155 unsigned int procs; // total number of processors 156 156 unsigned int irqs; // total number of irqs 157 157 unsigned int periphs; // total number of peripherals 158 char name[ 64];// mapping name158 char name[256]; // mapping name 159 159 } mapping_header_t; 160 160 … … 183 183 unsigned int start_vseg_id; // vseg containing start vector index 184 184 unsigned int vsegs; // number of vsegs in vspace 185 unsigned int t asks; // number of tasks in vspace185 unsigned int threads; // number of threads in vspace 186 186 unsigned int vseg_offset; // global index of first vseg in vspace 187 unsigned int t ask_offset; // global index of first taskin vspace187 unsigned int thread_offset; // global index of first thread in vspace 188 188 unsigned int active; // always active if non zero 189 189 } mapping_vspace_t; … … 220 220 221 221 222 ////////////////////////////////////////////////////// 223 typedef struct __attribute__((packed)) mapping_t ask_s224 { 225 char name[32]; // t askname (unique in vspace)222 //////////////////////////////////////////////////////// 223 typedef struct __attribute__((packed)) mapping_thread_s 224 { 225 char name[32]; // thread name (unique in vspace) 226 226 unsigned int clusterid; // global index in clusters set 227 227 unsigned int proclocid; // processor local index (inside cluster) 228 unsigned int trdid; // thread index in vspace228 unsigned int is_main; // this thread is the application entry point 229 229 unsigned int stack_vseg_id; // global index for vseg containing stack 230 230 unsigned int heap_vseg_id; // global index for vseg containing heap 231 231 unsigned int startid; // index in start_vector 232 unsigned int ltid; // t askindex in scheduler (dynamically defined)233 } mapping_t ask_t;232 unsigned int ltid; // thread index in scheduler (dynamically defined) 233 } mapping_thread_t; 234 234 235 235 -
soft/giet_vm/giet_xml/xml_driver.c
r645 r709 126 126 unsigned int pseg_id; 127 127 unsigned int vseg_id; 128 unsigned int t ask_id;128 unsigned int thread_id; 129 129 unsigned int proc_id; 130 130 unsigned int irq_id; … … 135 135 mapping_vspace_t * vspace; 136 136 mapping_vseg_t * vseg; 137 mapping_t ask_t * task;137 mapping_thread_t * thread; 138 138 mapping_irq_t * irq; 139 139 mapping_periph_t * periph; … … 161 161 MAPPING_VSPACE_SIZE * header->vspaces); 162 162 163 // computes the base address for t asks array164 t ask = (mapping_task_t *) ((char *) header +163 // computes the base address for threads array 164 thread = (mapping_thread_t *) ((char *) header + 165 165 MAPPING_HEADER_SIZE + 166 166 MAPPING_CLUSTER_SIZE * header->x_size * header->y_size + … … 176 176 MAPPING_VSPACE_SIZE * header->vspaces + 177 177 MAPPING_VSEG_SIZE * header->vsegs + 178 MAPPING_T ASK_SIZE * header->tasks +178 MAPPING_THREAD_SIZE * header->threads + 179 179 MAPPING_PROC_SIZE * header->procs); 180 180 … … 186 186 MAPPING_VSPACE_SIZE * header->vspaces + 187 187 MAPPING_VSEG_SIZE * header->vsegs + 188 MAPPING_T ASK_SIZE * header->tasks +188 MAPPING_THREAD_SIZE * header->threads + 189 189 MAPPING_PROC_SIZE * header->procs + 190 190 MAPPING_IRQ_SIZE * header->irqs); … … 342 342 } 343 343 344 //////////////////// t asks //////////////////////////////////////////////345 346 for (t ask_id = vspace[vspace_id].task_offset;347 t ask_id < (vspace[vspace_id].task_offset + vspace[vspace_id].tasks);348 t ask_id++)344 //////////////////// threads ////////////////////////////////////////////// 345 346 for (thread_id = vspace[vspace_id].thread_offset; 347 thread_id < (vspace[vspace_id].thread_offset + vspace[vspace_id].threads); 348 thread_id++) 349 349 { 350 unsigned int stack_vseg_id = t ask[task_id].stack_vseg_id;351 unsigned int heap_vseg_id = t ask[task_id].heap_vseg_id;352 unsigned int cluster_id = t ask[task_id].clusterid;353 354 fprintf(fpout, " <t ask name=\"%s\"", task[task_id].name);355 fprintf(fpout, " trdid=\"%d\"", t ask[task_id].trdid);350 unsigned int stack_vseg_id = thread[thread_id].stack_vseg_id; 351 unsigned int heap_vseg_id = thread[thread_id].heap_vseg_id; 352 unsigned int cluster_id = thread[thread_id].clusterid; 353 354 fprintf(fpout, " <thread name=\"%s\"", thread[thread_id].name); 355 fprintf(fpout, " trdid=\"%d\"", thread[thread_id].trdid); 356 356 fprintf(fpout, " x=\"%d\"", cluster[cluster_id].x); 357 357 fprintf(fpout, " y=\"%d\"", cluster[cluster_id].y); 358 fprintf(fpout, " p=\"%d\"", t ask[task_id].proclocid);358 fprintf(fpout, " p=\"%d\"", thread[thread_id].proclocid); 359 359 fprintf(fpout, "\n "); 360 360 fprintf(fpout, " stackname=\"%s\"", vseg[stack_vseg_id].name); 361 361 if (heap_vseg_id != -1) 362 362 fprintf(fpout, " heapname=\"%s\"", vseg[heap_vseg_id].name); 363 fprintf(fpout, " startid = \"%d\"", t ask[task_id].startid);363 fprintf(fpout, " startid = \"%d\"", thread[thread_id].startid); 364 364 fprintf(fpout, " />\n"); 365 365 } -
soft/giet_vm/giet_xml/xml_parser.c
r645 r709 11 11 // 1) the multi-cluster/multi-processors hardware architecture description 12 12 // 2) the various multi-threaded software applications 13 // 3) the mapping directives bor both the t asks and the virtual segments.13 // 3) the mapping directives bor both the threads and the virtual segments. 14 14 // The corresponding C structures are defined in the "mapping_info.h" file. 15 15 /////////////////////////////////////////////////////////////////////////////////////// … … 31 31 #define MAX_PSEGS 4096 32 32 #define MAX_VSPACES 1024 33 #define MAX_T ASKS 409633 #define MAX_THREADS 4096 34 34 #define MAX_VSEGS 4096 35 35 #define MAX_PROCS 1024 … … 48 48 mapping_vspace_t * vspace[MAX_VSPACES]; // vspace array 49 49 mapping_vseg_t * vseg[MAX_VSEGS]; // vseg array 50 mapping_t ask_t * task[MAX_TASKS]; // taskarray50 mapping_thread_t * thread[MAX_THREADS]; // thread array 51 51 mapping_proc_t * proc[MAX_PROCS]; // proc array 52 52 mapping_irq_t * irq[MAX_IRQS]; // irq array … … 72 72 unsigned int vseg_loc_index = 0; 73 73 74 unsigned int t ask_index = 0;75 unsigned int t ask_loc_index = 0;74 unsigned int thread_index = 0; 75 unsigned int thread_loc_index = 0; 76 76 77 77 … … 275 275 276 276 277 ////////////////////////////////////// 278 void t askNode(xmlTextReaderPtr reader)277 //////////////////////////////////////// 278 void threadNode(xmlTextReaderPtr reader) 279 279 { 280 280 unsigned int ok; … … 285 285 if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) return; 286 286 287 if (t ask_index >= MAX_TASKS)288 { 289 printf("[XML ERROR] The number of t asks is larger than %d\n", MAX_TASKS);290 exit(1); 291 } 292 293 #if XML_PARSER_DEBUG 294 printf(" t ask %d\n", task_loc_index);295 #endif 296 297 t ask[task_index] = (mapping_task_t *) malloc(sizeof(mapping_task_t));287 if (thread_index >= MAX_THREADS) 288 { 289 printf("[XML ERROR] The number of threads is larger than %d\n", MAX_THREADS); 290 exit(1); 291 } 292 293 #if XML_PARSER_DEBUG 294 printf(" thread %d\n", thread_loc_index); 295 #endif 296 297 thread[thread_index] = (mapping_thread_t *) malloc(sizeof(mapping_thread_t)); 298 298 299 299 ////////// get name attribute … … 304 304 printf(" name = %s\n", str); 305 305 #endif 306 strncpy( task[task_index]->name, str, 31 ); 307 } 308 else 309 { 310 printf("[XML ERROR] illegal or missing <name> attribute for task (%d,%d)\n", 311 vspace_index, task_loc_index); 312 exit(1); 313 } 314 315 ///////// get trdid attribute (optional) 316 value = getIntValue(reader, "trdid", &ok); 317 #if XML_PARSER_DEBUG 318 printf(" trdid = %d\n", value ); 319 #endif 320 if ( ok ) task[task_index]->trdid = value; 321 else task[task_index]->trdid = task_loc_index; 306 strncpy( thread[thread_index]->name, str, 31 ); 307 } 308 else 309 { 310 printf("[XML ERROR] illegal or missing <name> for thread %d in vspace %d\n", 311 thread_loc_index, vspace_index); 312 exit(1); 313 } 314 315 ///////// get is_main attribute 316 value = getIntValue(reader, "is_main", &ok); 317 if ( ok ) 318 { 319 #if XML_PARSER_DEBUG 320 printf(" is_main = %d\n", value ); 321 #endif 322 thread[thread_index]->is_main = value; 323 } 324 else 325 { 326 printf("[XML ERROR] illegal or missing <is_main> for thread %d in vspace %d\n", 327 thread_loc_index, vspace_index); 328 } 322 329 323 330 ///////// get x coordinate … … 328 335 if ( !(ok && (x < header->x_size)) ) 329 336 { 330 printf("[XML ERROR] illegal or missing < x > attribute for task (%d,%d)\n",331 vspace_index, task_loc_index);337 printf("[XML ERROR] illegal or missing < x > for thread %d in vspace %d)\n", 338 thread_loc_index, vspace_index); 332 339 exit(1); 333 340 } … … 340 347 if ( !(ok && (y < header->y_size)) ) 341 348 { 342 printf("[XML ERROR] illegal or missing < y > attribute for task (%d,%d)\n",343 vspace_index, task_loc_index);349 printf("[XML ERROR] illegal or missing < y > for thread %d in vspace %d)\n", 350 thread_loc_index, vspace_index); 344 351 exit(1); 345 352 } … … 352 359 if( index >= 0 ) 353 360 { 354 t ask[task_index]->clusterid = index;361 thread[thread_index]->clusterid = index; 355 362 } 356 363 else 357 364 { 358 printf("[XML ERROR] <clusterid> not found for t ask (%d,%d)\n",359 vspace_index, task_loc_index);365 printf("[XML ERROR] <clusterid> not found for thread %d in vspace %d)\n", 366 thread_loc_index, vspace_index); 360 367 exit(1); 361 368 } … … 368 375 printf(" proclocid = %x\n", value); 369 376 #endif 370 if (value >= cluster[t ask[task_index]->clusterid]->procs)371 { 372 printf("[XML ERROR] <proclocid> too large for t ask (%d,%d)\n",373 vspace_index, task_loc_index);377 if (value >= cluster[thread[thread_index]->clusterid]->procs) 378 { 379 printf("[XML ERROR] <proclocid> too large for thread %d in vspace %d\n", 380 thread_loc_index, vspace_index); 374 381 exit(1); 375 382 } 376 t ask[task_index]->proclocid = value;383 thread[thread_index]->proclocid = value; 377 384 } 378 385 else 379 386 { 380 printf("[XML ERROR] illegal or missing < p> attribute for task (%d,%d)\n",381 vspace_index, task_loc_index);387 printf("[XML ERROR] illegal or missing < p > for thread %d in vspace %d)\n", 388 thread_loc_index, vspace_index); 382 389 exit(1); 383 390 } … … 396 403 printf(" stack_id = %d\n", index); 397 404 #endif 398 t ask[task_index]->stack_vseg_id = index;405 thread[thread_index]->stack_vseg_id = index; 399 406 } 400 407 else 401 408 { 402 printf("[XML ERROR] illegal or missing <stackname> for t ask (%d,%d)\n",403 vspace_index, task_loc_index);409 printf("[XML ERROR] illegal or missing <stackname> for thread %d in vspace %d)\n", 410 thread_loc_index, vspace_index); 404 411 exit(1); 405 412 } … … 407 414 else 408 415 { 409 printf("[XML ERROR] illegal or missing <stackname> for t ask (%d,%d)\n",410 vspace_index, task_loc_index);416 printf("[XML ERROR] illegal or missing <stackname> for thread %d in vspace %d)\n", 417 thread_loc_index, vspace_index); 411 418 exit(1); 412 419 } … … 425 432 printf(" heap_id = %d\n", index ); 426 433 #endif 427 t ask[task_index]->heap_vseg_id = index;434 thread[thread_index]->heap_vseg_id = index; 428 435 } 429 436 else 430 437 { 431 printf("[XML ERROR] illegal or missing <heapname> for t ask (%d,%d)\n",432 vspace_index, task_loc_index);438 printf("[XML ERROR] illegal or missing <heapname> for thread %d in vspace %d)\n", 439 thread_loc_index, vspace_index); 433 440 exit(1); 434 441 } … … 436 443 else 437 444 { 438 t ask[task_index]->heap_vseg_id = -1;445 thread[thread_index]->heap_vseg_id = -1; 439 446 } 440 447 … … 446 453 printf(" startid = %x\n", value); 447 454 #endif 448 t ask[task_index]->startid = value;455 thread[thread_index]->startid = value; 449 456 } 450 457 else 451 458 { 452 printf("[XML ERROR] illegal or missing <startid> attribute for task (%d,%d)\n",453 vspace_index, task_loc_index);454 exit(1); 455 } 456 457 t ask_index++;458 t ask_loc_index++;459 } // end t askNode()459 printf("[XML ERROR] illegal or missing <startid> for thread %d in vspace %d\n", 460 thread_loc_index, vspace_index); 461 exit(1); 462 } 463 464 thread_index++; 465 thread_loc_index++; 466 } // end threadNode() 460 467 461 468 … … 698 705 unsigned int ok; 699 706 700 vseg_loc_index = 0;701 t ask_loc_index = 0;707 vseg_loc_index = 0; 708 thread_loc_index = 0; 702 709 703 710 if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) return; … … 727 734 else vspace[vspace_index]->active = 0; 728 735 729 ////////// set vseg_offset and t ask_offset attributes736 ////////// set vseg_offset and thread_offset attributes 730 737 vspace[vspace_index]->vseg_offset = vseg_index; 731 vspace[vspace_index]->t ask_offset = task_index;732 733 ////////// initialise vsegs and t asks attributes738 vspace[vspace_index]->thread_offset = thread_index; 739 740 ////////// initialise vsegs and threads attributes 734 741 vspace[vspace_index]->vsegs = 0; 735 vspace[vspace_index]->t asks = 0;742 vspace[vspace_index]->threads = 0; 736 743 737 744 ////////// get startname attribute … … 754 761 vspace[vspace_index]->vsegs += 1; 755 762 } 756 else if (strcmp(tag, "t ask") == 0)757 { 758 t askNode(reader);759 vspace[vspace_index]->t asks += 1;763 else if (strcmp(tag, "thread") == 0) 764 { 765 threadNode(reader); 766 vspace[vspace_index]->threads += 1; 760 767 } 761 768 else if (strcmp(tag, "#text") == 0) { } … … 777 784 778 785 #if XML_PARSER_DEBUG 779 printf(" vsegs = %d\n", vspace[vspace_index]->vsegs );780 printf(" t asks = %d\n", vspace[vspace_index]->tasks );781 printf(" vseg_offset = %d\n", vspace[vspace_index]->vseg_offset );782 printf(" t ask_offset = %d\n", vspace[vspace_index]->task_offset );783 printf(" start_id = %d\n", vspace[vspace_index]->start_vseg_id );784 printf(" active = %x\n", vspace[vspace_index]->active );786 printf(" vsegs = %d\n", vspace[vspace_index]->vsegs ); 787 printf(" threads = %d\n", vspace[vspace_index]->threads ); 788 printf(" vseg_offset = %d\n", vspace[vspace_index]->vseg_offset ); 789 printf(" thread_offset = %d\n", vspace[vspace_index]->thread_offset ); 790 printf(" start_id = %d\n", vspace[vspace_index]->start_vseg_id ); 791 printf(" active = %x\n", vspace[vspace_index]->active ); 785 792 printf(" end vspace %d\n\n", vspace_index); 786 793 #endif … … 1488 1495 { 1489 1496 header->vsegs = vseg_index; 1490 header->t asks = task_index;1497 header->threads = thread_index; 1491 1498 return; 1492 1499 } … … 1668 1675 header->psegs = 0; 1669 1676 header->vsegs = 0; 1670 header->t asks= 0;1677 header->threads = 0; 1671 1678 header->procs = 0; 1672 1679 header->irqs = 0; … … 1765 1772 printf("psegs = %d\n", header->psegs); 1766 1773 printf("vsegs = %d\n", header->vsegs); 1767 printf("t asks = %d\n", header->tasks);1774 printf("threads = %d\n", header->threads); 1768 1775 printf("procs = %d\n", header->procs); 1769 1776 printf("irqs = %d\n", header->irqs); … … 1787 1794 // write vsegs 1788 1795 BuildTable(fdout, "vseg", vseg_index, sizeof(mapping_vseg_t), (char **) vseg); 1789 // write t asks array1790 BuildTable(fdout, "t ask", task_index, sizeof(mapping_task_t), (char **) task);1796 // write threads array 1797 BuildTable(fdout, "thread", thread_index, sizeof(mapping_thread_t), (char **) thread); 1791 1798 //building procs array 1792 1799 BuildTable(fdout, "proc", proc_index, sizeof(mapping_proc_t), (char **) proc);
Note: See TracChangeset
for help on using the changeset viewer.