Changeset 345 for soft/giet_vm/sort
- Timestamp:
- Jun 25, 2014, 2:19:37 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/sort/main.c
r318 r345 58 58 int array1[ARRAY_LENGTH]; 59 59 60 int init_ok = 0;60 volatile int init_ok = 0; 61 61 62 62 void bubbleSort( … … 95 95 (unsigned int*)&nb_thread ); 96 96 97 task0_printf("\n[ Thread 0 ] Starting sort application with % dthreads "98 "at cycle % d\n", *nb_thread, time_start);97 task0_printf("\n[ Thread 0 ] Starting sort application with %u threads " 98 "at cycle %u\n", *nb_thread, time_start); 99 99 100 100 /////////////////////////// … … 134 134 for (i = 0; i < __builtin_ctz(*nb_thread); i++) 135 135 { 136 asm volatile ("sync");137 136 barrier_wait(&barrier[i]); 138 137 … … 171 170 ////////////////////////////// 172 171 // Verify the resulting array 173 174 if(thread_id == 0) 175 { 176 success = 1; 177 178 for(i=0; i<(ARRAY_LENGTH-1); i++) 179 { 180 if(dst_array[i] > dst_array[i+1]) 181 { 182 183 success = 0; 184 failure_index = i; 185 break; 186 } 187 } 188 189 time_end = giet_proctime(); 190 191 printf("[ Thread 0 ] Finishing sort application at cycle %d\n" 192 "[ Thread 0 ] Time elapsed = %d\n", 193 time_end, (time_end - time_start) ); 194 195 if (success) 196 { 197 exit("!!! Success !!!"); 198 } 199 else 200 { 201 printf("[ Thread 0 ] Failure!! Incorrect element: %d\n\r", 202 failure_index); 203 for(i=0; i<ARRAY_LENGTH; i++) 204 { 205 printf("array[%d] = %d\n", i, dst_array[i]); 206 } 207 exit("!!! Failure !!!"); 208 } 209 } 172 173 if(thread_id != 0) 174 { 175 exit("error: only thread 0 should get here"); 176 } 177 178 success = 1; 179 for(i=0; i<(ARRAY_LENGTH-1); i++) 180 { 181 if(dst_array[i] > dst_array[i+1]) 182 { 183 184 success = 0; 185 failure_index = i; 186 break; 187 } 188 } 189 190 time_end = giet_proctime(); 191 192 printf("[ Thread 0 ] Finishing sort application at cycle %d\n" 193 "[ Thread 0 ] Time elapsed = %d\n", 194 time_end, (time_end - time_start) ); 195 196 if (success) 197 { 198 exit("!!! Success !!!"); 199 } 200 else 201 { 202 printf("[ Thread 0 ] Failure!! Incorrect element: %d\n\r", 203 failure_index); 204 for(i=0; i<ARRAY_LENGTH; i++) 205 { 206 printf("array[%d] = %d\n", i, dst_array[i]); 207 } 208 exit("!!! Failure !!!"); 209 } 210 210 211 exit("Completed"); 211 212 }
Note: See TracChangeset
for help on using the changeset viewer.