Changeset 295 for soft/giet_vm/router/main.c
- Timestamp:
- Mar 26, 2014, 6:44:44 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/router/main.c
r264 r295 2 2 #include "mwmr_channel.h" 3 3 #include "mapping_info.h" 4 #include "hard_config.h" 4 5 5 #define NMAX 2006 #define NMAX 50 6 7 7 8 ///////////////////////////////////////////// … … 13 14 mwmr_channel_t* mwmr; 14 15 15 giet_tty_printf( "*** Starting task producer on processor %d", giet_procid() ); 16 giet_tty_printf( " at cycle %d ***\n\n", giet_proctime() ); 16 unsigned int procid = giet_procid(); 17 unsigned int cluster_xy = procid/NB_PROCS_MAX; 18 unsigned int lpid = procid%NB_PROCS_MAX; 19 unsigned int x = cluster_xy >> Y_WIDTH; 20 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 17 21 18 if( giet_vobj_get_vbase( "router" , 19 "mwmr_in", 20 VOBJ_TYPE_MWMR, 21 (void*)&mwmr ) ) 22 { 23 giet_tty_printf( "\n[ERROR] in producer task :\n"); 24 giet_tty_printf( " undefined <mwmr_in> channel: %d\n", mwmr); 25 giet_tty_printf( "*** &mwmr_in = %x\n\n", (unsigned int)mwmr ); 26 giet_exit(); 27 } 22 giet_tty_printf( "*** Starting task producer on processor[%d,%d,%d] at cycle %d\n\n", 23 x, y, lpid, giet_proctime() ); 24 25 giet_vobj_get_vbase( "router" , 26 "mwmr_in", 27 (void*)&mwmr ); 28 28 29 29 // main loop : display token value = source index … … 35 35 } 36 36 37 giet_tty_printf( "\n*** Completing producer task at cycle %d ***\n", giet_proctime()); 38 giet_exit(); 37 giet_exit( "Producer task completed"); 39 38 40 39 } // end producer() … … 47 46 mwmr_channel_t* mwmr; 48 47 49 giet_tty_printf( "*** Starting task consumer on processor %d", giet_procid() ); 50 giet_tty_printf( " at cycle %d ***\n\n", giet_proctime() ); 48 unsigned int procid = giet_procid(); 49 unsigned int cluster_xy = procid/NB_PROCS_MAX; 50 unsigned int lpid = procid%NB_PROCS_MAX; 51 unsigned int x = cluster_xy >> Y_WIDTH; 52 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 51 53 52 if ( giet_vobj_get_vbase( "router" , 53 "mwmr_out", 54 VOBJ_TYPE_MWMR, 55 (void*)&mwmr ) ) 56 { 57 giet_tty_printf( "\n[ERROR] in consumer task :\n"); 58 giet_tty_printf( " undefined <mwmr_out> channel\n"); 59 giet_exit(); 60 } 54 giet_tty_printf( "*** Starting task consumer on processor[%d,%d,%d] at cycle %d\n\n", 55 x, y, lpid, giet_proctime() ); 56 57 giet_vobj_get_vbase( "router" , 58 "mwmr_out", 59 (void*)&mwmr ); 61 60 62 61 // main loop : display token arrival index and value … … 67 66 } 68 67 69 giet_tty_printf( "\n*** Completing consumer task at cycle %d ***\n", giet_proctime()); 70 giet_exit(); 68 giet_exit( "Consumer task completed"); 71 69 72 70 } // end consumer() … … 76 74 { 77 75 unsigned int buf; 78 unsigned int x;76 unsigned int n; 79 77 unsigned int tempo; 80 78 mwmr_channel_t* mwmr_in ; 81 79 mwmr_channel_t* mwmr_out ; 82 80 83 84 giet_tty_printf( "*** Starting task router on processor %d", giet_procid() ); 85 giet_tty_printf( " at cycle %d ***\n\n", giet_proctime() ); 81 unsigned int procid = giet_procid(); 82 unsigned int cluster_xy = procid/NB_PROCS_MAX; 83 unsigned int lpid = procid%NB_PROCS_MAX; 84 unsigned int x = cluster_xy >> Y_WIDTH; 85 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 86 86 87 if ( giet_vobj_get_vbase( "router" , 88 "mwmr_out", 89 VOBJ_TYPE_MWMR, 90 (void*)&mwmr_out ) ) 91 { 92 giet_tty_printf( "\n[ERROR] in router task :\n"); 93 giet_tty_printf( " undefined <mwmr_in> channel\n"); 94 giet_exit(); 95 } 87 giet_tty_printf( "*** Starting task router on processor[%d,%d,%d] at cycle %d\n\n", 88 x, y, lpid, giet_proctime() ); 96 89 97 if ( giet_vobj_get_vbase( "router" , 98 "mwmr_in", 99 VOBJ_TYPE_MWMR, 100 (void*)&mwmr_in ) ) 101 { 102 giet_tty_printf( "\n[ERROR] in router task :\n"); 103 giet_tty_printf( " undefined <mwmr_out> channel\n"); 104 giet_exit(); 105 } 90 giet_vobj_get_vbase( "router" , 91 "mwmr_out", 92 (void*)&mwmr_out ); 106 93 94 giet_vobj_get_vbase( "router" , 95 "mwmr_in", 96 (void*)&mwmr_in ); 107 97 // main loop 108 98 while(1) … … 110 100 mwmr_read( mwmr_in , &buf , 1 ); 111 101 tempo = giet_rand() >> 6; 112 for ( x = 0 ; x < tempo ; x++ ) asm volatile ("");102 for ( n = 0 ; n < tempo ; n++ ) asm volatile (""); 113 103 giet_tty_printf( "token value : %d / temporisation = %d\n", buf, tempo); 114 104 mwmr_write( mwmr_out, &buf , 1 );
Note: See TracChangeset
for help on using the changeset viewer.