- Timestamp:
- Jan 17, 2014, 11:49:27 PM (11 years ago)
- Location:
- soft/giet_vm
- Files:
-
- 1 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/dhrystone/dhry.h
r258 r271 363 363 #include <string.h> 364 364 #include <malloc.h> 365 #include <stdlib.h> 365 366 366 367 typedef int One_Thirty; -
soft/giet_vm/giet_drivers/xcu_driver.c
r263 r271 170 170 //////////////////////////////////////////////////////////////////////////////// 171 171 unsigned int _xcu_timer_start( unsigned int cluster_xy, 172 unsigned int p roc_id,172 unsigned int pti_index, 173 173 unsigned int period ) 174 174 { … … 178 178 if (x >= X_SIZE) return 1; 179 179 if (y >= Y_SIZE) return 1; 180 if (proc_id >= NB_PROCS_MAX) return 1;181 180 182 181 #if USE_XICU 183 182 unsigned int* xcu_address = (unsigned int *) ((unsigned int)&seg_xcu_base + 184 183 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 185 xcu_address[XICU_REG(XICU_PTI_PER, p roc_id)] = period;184 xcu_address[XICU_REG(XICU_PTI_PER, pti_index)] = period; 186 185 return 0; 187 186 #else … … 200 199 ////////////////////////////////////////////////////////////////////////////// 201 200 unsigned int _xcu_timer_stop( unsigned int cluster_xy, 202 unsigned int proc_id) 203 { 204 // parameters checking 205 unsigned int x = cluster_xy >> Y_WIDTH; 206 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 207 if (x >= X_SIZE) return 1; 208 if (y >= Y_SIZE) return 1; 209 if (proc_id >= NB_PROCS_MAX) return 1; 201 unsigned int pti_index) 202 { 203 // parameters checking 204 unsigned int x = cluster_xy >> Y_WIDTH; 205 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 206 if (x >= X_SIZE) return 1; 207 if (y >= Y_SIZE) return 1; 210 208 211 209 #if USE_XICU 212 210 unsigned int * xcu_address = (unsigned int *) ((unsigned int)&seg_xcu_base + 213 211 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 214 xcu_address[XICU_REG(XICU_PTI_PER, p roc_id)] = 0;212 xcu_address[XICU_REG(XICU_PTI_PER, pti_index)] = 0; 215 213 return 0; 216 214 #else … … 231 229 ////////////////////////////////////////////////////////////////////////////// 232 230 unsigned int _xcu_timer_reset_irq( unsigned int cluster_xy, 233 unsigned int proc_id ) 234 { 235 // parameters checking 236 unsigned int x = cluster_xy >> Y_WIDTH; 237 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 238 if (x >= X_SIZE) return 1; 239 if (y >= Y_SIZE) return 1; 240 if (proc_id >= NB_PROCS_MAX) return 1; 241 242 #if USE_XICU 243 unsigned int * xcu_address = (unsigned int *) ((unsigned int)&seg_xcu_base + 244 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 245 246 unsigned int bloup = xcu_address[XICU_REG(XICU_PTI_ACK, proc_id)]; 247 bloup++; // to avoid a warning 231 unsigned int pti_index ) 232 { 233 // parameters checking 234 unsigned int x = cluster_xy >> Y_WIDTH; 235 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 236 if (x >= X_SIZE) return 1; 237 if (y >= Y_SIZE) return 1; 238 239 #if USE_XICU 240 volatile unsigned int * xcu_address = 241 (unsigned int *) ((unsigned int)&seg_xcu_base + 242 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 243 244 xcu_address[XICU_REG(XICU_PTI_ACK, pti_index)]; 248 245 return 0; 249 246 #else … … 265 262 ///////////////////////////////////////////////////////////////////////////// 266 263 unsigned int _xcu_timer_reset_cpt( unsigned int cluster_xy, 267 unsigned int proc_id ) 268 { 269 // parameters checking 270 unsigned int x = cluster_xy >> Y_WIDTH; 271 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 272 if (x >= X_SIZE) return 1; 273 if (y >= Y_SIZE) return 1; 274 if (proc_id >= NB_PROCS_MAX) return 1; 264 unsigned int pti_index ) 265 { 266 // parameters checking 267 unsigned int x = cluster_xy >> Y_WIDTH; 268 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 269 if (x >= X_SIZE) return 1; 270 if (y >= Y_SIZE) return 1; 275 271 276 272 #if USE_XICU … … 278 274 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 279 275 280 unsigned int period = xcu_address[XICU_REG(XICU_PTI_PER, p roc_id)];276 unsigned int period = xcu_address[XICU_REG(XICU_PTI_PER, pti_index)]; 281 277 282 278 // we write 0 first because if the timer is currently running, 283 279 // the corresponding timer counter is not reset 284 xcu_address[XICU_REG(XICU_PTI_PER, p roc_id)] = 0;285 xcu_address[XICU_REG(XICU_PTI_PER, p roc_id)] = period;280 xcu_address[XICU_REG(XICU_PTI_PER, pti_index)] = 0; 281 xcu_address[XICU_REG(XICU_PTI_PER, pti_index)] = period; 286 282 return 0; 287 283 #else -
soft/giet_vm/giet_kernel/ctx_handler.c
r267 r271 119 119 // reset timer counter 120 120 #if USE_XICU 121 _xcu_timer_reset_cpt(cluster_id, local_id);121 _xcu_timer_reset_cpt(cluster_id, NB_PROCS_MAX + local_id); 122 122 #else 123 _timer_reset_cpt(cluster_id, local_id);123 _timer_reset_cpt(cluster_id, NB_PROCS_MAX + local_id); 124 124 #endif 125 125 -
soft/giet_vm/giet_kernel/kernel_init.c
r263 r271 290 290 } 291 291 292 // the ISR_SWITCH irq index must be NB_PROCS_MAX + local_pid because 293 // the first NB_PROCS_MAX irqs are used by the WAKEUP ones 294 if (isr_switch_index != (NB_PROCS_MAX + local_pid)) 295 { 296 _tty_get_lock( 0 ); 297 _puts("\n[GIET ERROR] ISR_SWITCH wrong index for processor "); 298 _putx(global_pid); 299 _puts("\n. It should be NB_PROCS_MAX + local_pid ="); 300 _putd(NB_PROCS_MAX + local_pid); 301 _puts("\n"); 302 _tty_release_lock( 0 ); 303 _exit(); 304 } 305 292 306 // start system timer 293 307 unsigned int ko; 294 308 #if USE_XICU 295 ko = _xcu_timer_start( cluster_xy, local_pid, GIET_TICK_VALUE );309 ko = _xcu_timer_start( cluster_xy, isr_switch_index, GIET_TICK_VALUE ); 296 310 #else 297 ko = _timer_start( cluster_xy, local_pid, GIET_TICK_VALUE );311 ko = _timer_start( cluster_xy, isr_switch_index, GIET_TICK_VALUE ); 298 312 #endif 299 313 if ( ko ) -
soft/giet_vm/giet_libs/srl.h
r258 r271 10 10 #include "mapping_info.h" 11 11 #include "stdio.h" 12 #include " utils.h"12 #include "stdlib.h" 13 13 14 14 #include "libsrl/srl_public_types.h" -
soft/giet_vm/giet_libs/stdio.c
r267 r271 13 13 #include <stdio.h> 14 14 #include <giet_config.h> 15 16 15 17 16 //////////////////////////////////////////////////////////////////////////////////// … … 823 822 } 824 823 } 825 ///////////////////////////////////////////////////////////////////////////////////826 // memcpy()827 ///////////////////////////////////////////////////////////////////////////////////828 inline void* memcpy( void* dest,829 const void* source,830 unsigned int size )831 {832 unsigned int* dst = dest;833 const unsigned int* src = source;834 835 // word-by-word copy836 if (!((unsigned int) dst & 3) && !((unsigned int) src & 3))837 {838 while (size > 3)839 {840 *dst++ = *src++;841 size -= 4;842 }843 }844 845 unsigned char * cdst = (unsigned char *) dst;846 unsigned char * csrc = (unsigned char *) src;847 848 /* byte-by-byte copy */849 while (size--)850 {851 *cdst++ = *csrc++;852 }853 return dest;854 }855 824 856 825 // Local Variables: -
soft/giet_vm/giet_libs/stdlib.c
r259 r271 5 5 // Copyright (c) UPMC-LIP6 6 6 /////////////////////////////////////////////////////////////////////////////////// 7 8 #include <stdlib.h> 7 9 8 10 /////////////////////////////////////////////////////////////////////////////////// … … 31 33 } 32 34 35 //////////////////////////////////////////////////////////////////////////////////////// 36 // mempcy() 37 // GCC requires this function. Taken from MutekH. 38 //////////////////////////////////////////////////////////////////////////////////////// 39 void * memcpy(void *_dst, const void * _src, unsigned int size) { 40 unsigned int * dst = _dst; 41 const unsigned int * src = _src; 42 if (!((unsigned int) dst & 3) && !((unsigned int) src & 3) ) 43 while (size > 3) { 44 *dst++ = *src++; 45 size -= 4; 46 } 47 48 unsigned char *cdst = (unsigned char*)dst; 49 unsigned char *csrc = (unsigned char*)src; 50 51 while (size--) { 52 *cdst++ = *csrc++; 53 } 54 return _dst; 55 } 56 57 58 //////////////////////////////////////////////////////////////////////////////////////// 59 // mempcy() 60 // GCC requires this function. Taken from MutekH. 61 //////////////////////////////////////////////////////////////////////////////////////// 62 inline void * memset(void * dst, int s, unsigned int count) { 63 char * a = (char *) dst; 64 while (count--){ 65 *a++ = (char)s; 66 } 67 return dst; 68 } 69 33 70 // Local Variables: 34 71 // tab-width: 4 -
soft/giet_vm/giet_libs/stdlib.h
r259 r271 10 10 11 11 int atoi (char * str); 12 13 //////////////////////////////////////////////////////////////////////////////////////// 14 // mempcy() 15 // GCC requires this function. Taken from MutekH. 16 //////////////////////////////////////////////////////////////////////////////////////// 17 void * memcpy(void *_dst, const void * _src, unsigned int size); 18 19 //////////////////////////////////////////////////////////////////////////////////////// 20 // mempcy() 21 // GCC requires this function. Taken from MutekH. 22 //////////////////////////////////////////////////////////////////////////////////////// 23 inline void * memset(void * dst, int s, unsigned int count); 12 24 #endif 13 25 -
soft/giet_vm/mappings/4c_1p_iob_sort.xml
r265 r271 281 281 <vseg name = "seg_sort_stack0" vbase = "0x00800000" mode = "C_WU" x = "0" y = "0" psegname = "PSEG_RAM" > 282 282 <vobj name = "sort_stack0" type = "BUFFER" length = "0x00010000" /> 283 <vobj name = "sort_stack1" type = "BUFFER" length = "0x00010000" /> 283 284 <vobj name = "sort_heap0" type = "BUFFER" length = "0x00010000" /> 284 285 </vseg> 285 286 <vseg name = "seg_sort_stack1" vbase = "0x00A00000" mode = "C_WU" x = "0" y = "1" psegname = "PSEG_RAM" > 286 <vobj name = "sort_stack1" type = "BUFFER" length = "0x00010000" /> 287 <vobj name = "sort_stack2" type = "BUFFER" length = "0x00010000" /> 288 <vobj name = "sort_stack3" type = "BUFFER" length = "0x00010000" /> 287 289 <vobj name = "sort_heap1" type = "BUFFER" length = "0x00010000" /> 288 290 </vseg> 289 291 <vseg name = "seg_sort_stack2" vbase = "0x00C00000" mode = "C_WU" x = "1" y = "0" psegname = "PSEG_RAM" > 290 <vobj name = "sort_stack2" type = "BUFFER" length = "0x00010000" /> 292 <vobj name = "sort_stack4" type = "BUFFER" length = "0x00010000" /> 293 <vobj name = "sort_stack5" type = "BUFFER" length = "0x00010000" /> 291 294 <vobj name = "sort_heap2" type = "BUFFER" length = "0x00010000" /> 292 295 </vseg> 293 296 <vseg name = "seg_sort_stack3" vbase = "0x00E00000" mode = "C_WU" x = "1" y = "1" psegname = "PSEG_RAM" > 294 <vobj name = "sort_stack3" type = "BUFFER" length = "0x00010000" /> 297 <vobj name = "sort_stack6" type = "BUFFER" length = "0x00010000" /> 298 <vobj name = "sort_stack7" type = "BUFFER" length = "0x00010000" /> 295 299 <vobj name = "sort_heap3" type = "BUFFER" length = "0x00010000" /> 296 300 </vseg> 297 301 298 <task name = "sort_0" x = "0" y = "0" proclocid = "0" stackname = "sort_stack0" heapname = "sort_heap3" startid = "0" usetty = "1" /> 299 <task name = "sort_1" x = "0" y = "1" proclocid = "0" stackname = "sort_stack1" heapname = "sort_heap3" startid = "0" usetty = "1" /> 300 <task name = "sort_2" x = "1" y = "0" proclocid = "0" stackname = "sort_stack2" heapname = "sort_heap3" startid = "0" usetty = "1" /> 301 <task name = "sort_3" x = "1" y = "1" proclocid = "0" stackname = "sort_stack3" heapname = "sort_heap3" startid = "0" usetty = "1" /> 302 <task name = "sort_0" trdid = "0" x = "0" y = "0" proclocid = "0" stackname = "sort_stack0" heapname = "sort_heap0" startid = "0" usetty = "1" /> 303 <task name = "sort_1" trdid = "1" x = "0" y = "0" proclocid = "0" stackname = "sort_stack1" heapname = "sort_heap0" startid = "0" usetty = "1" /> 304 <task name = "sort_2" trdid = "2" x = "0" y = "1" proclocid = "0" stackname = "sort_stack2" heapname = "sort_heap1" startid = "0" usetty = "1" /> 305 <task name = "sort_3" trdid = "3" x = "0" y = "1" proclocid = "0" stackname = "sort_stack3" heapname = "sort_heap1" startid = "0" usetty = "1" /> 306 <task name = "sort_4" trdid = "4" x = "1" y = "0" proclocid = "0" stackname = "sort_stack4" heapname = "sort_heap2" startid = "0" usetty = "1" /> 307 <task name = "sort_5" trdid = "5" x = "1" y = "0" proclocid = "0" stackname = "sort_stack5" heapname = "sort_heap2" startid = "0" usetty = "1" /> 308 <task name = "sort_6" trdid = "6" x = "1" y = "1" proclocid = "0" stackname = "sort_stack6" heapname = "sort_heap3" startid = "0" usetty = "1" /> 309 <task name = "sort_7" trdid = "7" x = "1" y = "1" proclocid = "0" stackname = "sort_stack7" heapname = "sort_heap3" startid = "0" usetty = "1" /> 302 310 </vspace> 303 311 </vspaceset> -
soft/giet_vm/mappings/4c_1p_sort.xml
r270 r271 59 59 60 60 <cluster x = "0" y = "1" > 61 <pseg name = "PSEG_RAM" type = "RAM" base = "0x0100000000" length = "0x0001000000" /> 62 <pseg name = "PSEG_XCU" type = "PERI" base = "0x01B0000000" length = "0x0000002000" /> 63 <pseg name = "PSEG_DMA" type = "PERI" base = "0x01B1000000" length = "0x0000008000" /> 64 <pseg name = "PSEG_MMC" type = "PERI" base = "0x01B8000000" length = "0x0000001000" /> 65 66 <proc index = "0" > 67 <irq type = "SOFT" icuid = "0" isr = "ISR_WAKUP" /> 68 <irq type = "TIME" icuid = "1" isr = "ISR_SWITCH" /> 69 </proc> 70 71 <periph type = "DMA" psegname = "PSEG_DMA" channels = "1" /> 72 <periph type = "XCU" psegname = "PSEG_XCU" channels = "1" /> 73 <periph type = "MMC" psegname = "PSEG_MMC" channels = "1" /> 74 </cluster> 75 76 <cluster x = "1" y = "0" > 61 77 <pseg name = "PSEG_RAM" type = "RAM" base = "0x1000000000" length = "0x0001000000" /> 62 78 <pseg name = "PSEG_XCU" type = "PERI" base = "0x10B0000000" length = "0x0000002000" /> 63 79 <pseg name = "PSEG_DMA" type = "PERI" base = "0x10B1000000" length = "0x0000008000" /> 64 80 <pseg name = "PSEG_MMC" type = "PERI" base = "0x10B8000000" length = "0x0000001000" /> 65 66 <proc index = "0" >67 <irq type = "SOFT" icuid = "0" isr = "ISR_WAKUP" />68 <irq type = "TIME" icuid = "1" isr = "ISR_SWITCH" />69 </proc>70 71 <periph type = "DMA" psegname = "PSEG_DMA" channels = "1" />72 <periph type = "XCU" psegname = "PSEG_XCU" channels = "1" />73 <periph type = "MMC" psegname = "PSEG_MMC" channels = "1" />74 </cluster>75 76 <cluster x = "1" y = "0" >77 <pseg name = "PSEG_RAM" type = "RAM" base = "0x0100000000" length = "0x0001000000" />78 <pseg name = "PSEG_XCU" type = "PERI" base = "0x01B0000000" length = "0x0000002000" />79 <pseg name = "PSEG_DMA" type = "PERI" base = "0x01B1000000" length = "0x0000008000" />80 <pseg name = "PSEG_MMC" type = "PERI" base = "0x01B8000000" length = "0x0000001000" />81 81 82 82 <proc index = "0" > … … 255 255 <vseg name = "seg_sort_stack0" vbase = "0x00800000" mode = "C_WU" x = "0" y = "0" psegname = "PSEG_RAM" > 256 256 <vobj name = "sort_stack0" type = "BUFFER" length = "0x00010000" /> 257 <vobj name = "sort_stack1" type = "BUFFER" length = "0x00010000" /> 257 258 <vobj name = "sort_heap0" type = "BUFFER" length = "0x00010000" /> 258 259 </vseg> 259 260 <vseg name = "seg_sort_stack1" vbase = "0x00A00000" mode = "C_WU" x = "0" y = "1" psegname = "PSEG_RAM" > 260 <vobj name = "sort_stack1" type = "BUFFER" length = "0x00010000" /> 261 <vobj name = "sort_stack2" type = "BUFFER" length = "0x00010000" /> 262 <vobj name = "sort_stack3" type = "BUFFER" length = "0x00010000" /> 261 263 <vobj name = "sort_heap1" type = "BUFFER" length = "0x00010000" /> 262 264 </vseg> 263 265 <vseg name = "seg_sort_stack2" vbase = "0x00C00000" mode = "C_WU" x = "1" y = "0" psegname = "PSEG_RAM" > 264 <vobj name = "sort_stack2" type = "BUFFER" length = "0x00010000" /> 266 <vobj name = "sort_stack4" type = "BUFFER" length = "0x00010000" /> 267 <vobj name = "sort_stack5" type = "BUFFER" length = "0x00010000" /> 265 268 <vobj name = "sort_heap2" type = "BUFFER" length = "0x00010000" /> 266 269 </vseg> 267 270 <vseg name = "seg_sort_stack3" vbase = "0x00E00000" mode = "C_WU" x = "1" y = "1" psegname = "PSEG_RAM" > 268 <vobj name = "sort_stack3" type = "BUFFER" length = "0x00010000" /> 271 <vobj name = "sort_stack6" type = "BUFFER" length = "0x00010000" /> 272 <vobj name = "sort_stack7" type = "BUFFER" length = "0x00010000" /> 269 273 <vobj name = "sort_heap3" type = "BUFFER" length = "0x00010000" /> 270 274 </vseg> 271 275 272 <task name = "sort_0" trdid = "0" x = "0" y = "0" proclocid = "0" stackname = "sort_stack0" heapname = "sort_heap3" startid = "0" usetty = "1" /> 273 <task name = "sort_1" trdid = "1" x = "0" y = "1" proclocid = "0" stackname = "sort_stack1" heapname = "sort_heap3" startid = "0" usetty = "1" /> 274 <task name = "sort_2" trdid = "2" x = "1" y = "0" proclocid = "0" stackname = "sort_stack2" heapname = "sort_heap3" startid = "0" usetty = "1" /> 275 <task name = "sort_3" trdid = "3" x = "1" y = "1" proclocid = "0" stackname = "sort_stack3" heapname = "sort_heap3" startid = "0" usetty = "1" /> 276 <task name = "sort_0" trdid = "0" x = "0" y = "0" proclocid = "0" stackname = "sort_stack0" heapname = "sort_heap0" startid = "0" usetty = "1" /> 277 <task name = "sort_1" trdid = "1" x = "0" y = "0" proclocid = "0" stackname = "sort_stack1" heapname = "sort_heap0" startid = "0" usetty = "1" /> 278 <task name = "sort_2" trdid = "2" x = "0" y = "1" proclocid = "0" stackname = "sort_stack2" heapname = "sort_heap1" startid = "0" usetty = "1" /> 279 <task name = "sort_3" trdid = "3" x = "0" y = "1" proclocid = "0" stackname = "sort_stack3" heapname = "sort_heap1" startid = "0" usetty = "1" /> 280 <task name = "sort_4" trdid = "4" x = "1" y = "0" proclocid = "0" stackname = "sort_stack4" heapname = "sort_heap2" startid = "0" usetty = "1" /> 281 <task name = "sort_5" trdid = "5" x = "1" y = "0" proclocid = "0" stackname = "sort_stack5" heapname = "sort_heap2" startid = "0" usetty = "1" /> 282 <task name = "sort_6" trdid = "6" x = "1" y = "1" proclocid = "0" stackname = "sort_stack6" heapname = "sort_heap3" startid = "0" usetty = "1" /> 283 <task name = "sort_7" trdid = "7" x = "1" y = "1" proclocid = "0" stackname = "sort_stack7" heapname = "sort_heap3" startid = "0" usetty = "1" /> 276 284 </vspace> 277 285 </vspaceset> -
soft/giet_vm/mappings/4c_1p_sort_chiplet.xml
r270 r271 32 32 <irq type = "SOFT" icuid = "0" isr = "ISR_WAKUP" /> 33 33 <irq type = "TIME" icuid = "1" isr = "ISR_SWITCH" /> 34 <irq type = "HARD" icuid = " 2"isr = "ISR_IOC" />34 <irq type = "HARD" icuid = "31" isr = "ISR_IOC" /> 35 35 </proc> 36 36 … … 208 208 <vseg name = "seg_sort_stack0" vbase = "0x00800000" mode = "C_WU" x = "0" y = "0" psegname = "PSEG_RAM" > 209 209 <vobj name = "sort_stack0" type = "BUFFER" length = "0x00010000" /> 210 <vobj name = "sort_stack1" type = "BUFFER" length = "0x00010000" /> 210 211 <vobj name = "sort_heap0" type = "BUFFER" length = "0x00010000" /> 211 212 </vseg> 212 213 <vseg name = "seg_sort_stack1" vbase = "0x00A00000" mode = "C_WU" x = "0" y = "1" psegname = "PSEG_RAM" > 213 <vobj name = "sort_stack1" type = "BUFFER" length = "0x00010000" /> 214 <vobj name = "sort_stack2" type = "BUFFER" length = "0x00010000" /> 215 <vobj name = "sort_stack3" type = "BUFFER" length = "0x00010000" /> 214 216 <vobj name = "sort_heap1" type = "BUFFER" length = "0x00010000" /> 215 217 </vseg> 216 218 <vseg name = "seg_sort_stack2" vbase = "0x00C00000" mode = "C_WU" x = "1" y = "0" psegname = "PSEG_RAM" > 217 <vobj name = "sort_stack2" type = "BUFFER" length = "0x00010000" /> 219 <vobj name = "sort_stack4" type = "BUFFER" length = "0x00010000" /> 220 <vobj name = "sort_stack5" type = "BUFFER" length = "0x00010000" /> 218 221 <vobj name = "sort_heap2" type = "BUFFER" length = "0x00010000" /> 219 222 </vseg> 220 223 <vseg name = "seg_sort_stack3" vbase = "0x00E00000" mode = "C_WU" x = "1" y = "1" psegname = "PSEG_RAM" > 221 <vobj name = "sort_stack3" type = "BUFFER" length = "0x00010000" /> 224 <vobj name = "sort_stack6" type = "BUFFER" length = "0x00010000" /> 225 <vobj name = "sort_stack7" type = "BUFFER" length = "0x00010000" /> 222 226 <vobj name = "sort_heap3" type = "BUFFER" length = "0x00010000" /> 223 227 </vseg> 224 228 225 <task name = "sort_0" x = "0" y = "0" proclocid = "0" stackname = "sort_stack0" heapname = "sort_heap3" startid = "0" usetty = "1" /> 226 <task name = "sort_1" x = "0" y = "1" proclocid = "0" stackname = "sort_stack1" heapname = "sort_heap3" startid = "0" usetty = "1" /> 227 <task name = "sort_2" x = "1" y = "0" proclocid = "0" stackname = "sort_stack2" heapname = "sort_heap3" startid = "0" usetty = "1" /> 228 <task name = "sort_3" x = "1" y = "1" proclocid = "0" stackname = "sort_stack3" heapname = "sort_heap3" startid = "0" usetty = "1" /> 229 <task name = "sort_0" trdid = "0" x = "0" y = "0" proclocid = "0" stackname = "sort_stack0" heapname = "sort_heap0" startid = "0" usetty = "1" /> 230 <task name = "sort_1" trdid = "1" x = "0" y = "0" proclocid = "0" stackname = "sort_stack1" heapname = "sort_heap0" startid = "0" usetty = "1" /> 231 <task name = "sort_2" trdid = "2" x = "0" y = "1" proclocid = "0" stackname = "sort_stack2" heapname = "sort_heap1" startid = "0" usetty = "1" /> 232 <task name = "sort_3" trdid = "3" x = "0" y = "1" proclocid = "0" stackname = "sort_stack3" heapname = "sort_heap1" startid = "0" usetty = "1" /> 233 <task name = "sort_4" trdid = "4" x = "1" y = "0" proclocid = "0" stackname = "sort_stack4" heapname = "sort_heap2" startid = "0" usetty = "1" /> 234 <task name = "sort_5" trdid = "5" x = "1" y = "0" proclocid = "0" stackname = "sort_stack5" heapname = "sort_heap2" startid = "0" usetty = "1" /> 235 <task name = "sort_6" trdid = "6" x = "1" y = "1" proclocid = "0" stackname = "sort_stack6" heapname = "sort_heap3" startid = "0" usetty = "1" /> 236 <task name = "sort_7" trdid = "7" x = "1" y = "1" proclocid = "0" stackname = "sort_stack7" heapname = "sort_heap3" startid = "0" usetty = "1" /> 229 237 </vspace> 230 238 </vspaceset> -
soft/giet_vm/sort/main.c
r269 r271 38 38 39 39 ////////////////////////////////////////////////////////////////////////// 40 // The N PROCS constant must be modified depending on the desired number of40 // The NTHREADS constant must be modified depending on the desired number of 41 41 // threads 42 42 43 #define N PROCS 444 #define ARRAY_LENGTH (N PROCS * 128)45 #define IP P (ARRAY_LENGTH / NPROCS) // ITEMS PER PROCESSOR43 #define NTHREADS 8 44 #define ARRAY_LENGTH (NTHREADS * 128) 45 #define IPT (ARRAY_LENGTH / NTHREADS) // ITEMS PER THREAD 46 46 47 47 //////////////////////////////////////////////////////////////////////////////// … … 89 89 /////////////////////////////////////////////////// 90 90 // This application support at most 256 processors 91 // Number of barriers = log2(N PROCS)91 // Number of barriers = log2(NTHREADS) 92 92 93 93 giet_barrier_t barrier[8]; … … 101 101 int i; 102 102 103 task0_printf("[ Thread 0 ] Starting SORT application\n");103 printf("[ Thread %d ] Initializing vector and barriers...\n\r", thread_id); 104 104 105 105 /////////////////////////// 106 106 // Barriers Initialization 107 107 108 for (i = 0; i < __builtin_ctz(N PROCS); i++)109 { 110 barrier_init(&barrier[i], N PROCS >> i);108 for (i = 0; i < __builtin_ctz(NTHREADS); i++) 109 { 110 barrier_init(&barrier[i], NTHREADS >> i); 111 111 } 112 112 … … 114 114 // Array Initialization 115 115 116 for (i = IP P * thread_id; i < IPP* (thread_id + 1); i++)116 for (i = IPT * thread_id; i < IPT * (thread_id + 1); i++) 117 117 { 118 118 array0[i] = rand(); … … 124 124 printf("[ Thread %d ] Stage 0: Processor Sorting...\n\r", thread_id); 125 125 126 bubbleSort(array0, IP P, IPP* thread_id);126 bubbleSort(array0, IPT, IPT * thread_id); 127 127 128 128 printf("[ Thread %d ] Finishing Stage 0\n\r", thread_id); 129 129 130 for (i = 0; i < __builtin_ctz(N PROCS); i++)130 for (i = 0; i < __builtin_ctz(NTHREADS); i++) 131 131 { 132 132 asm volatile ("sync"); … … 153 153 154 154 merge(src_array, dst_array 155 , IP P<< i156 , IP P* thread_id157 , IP P* (thread_id + (1 << i))158 , IP P* thread_id155 , IPT << i 156 , IPT * thread_id 157 , IPT * (thread_id + (1 << i)) 158 , IPT * thread_id 159 159 ); 160 160
Note: See TracChangeset
for help on using the changeset viewer.