Changeset 736 for soft/giet_vm/applications/coproc
- Timestamp:
- Dec 3, 2015, 4:40:49 PM (9 years ago)
- Location:
- soft/giet_vm/applications/coproc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/applications/coproc/coproc.c
r708 r736 1 ///////////////////////////////////////////////////////////////////////////////////// //1 ///////////////////////////////////////////////////////////////////////////////////// 2 2 // file : coproc.c 3 3 // date : avril 2015 4 4 // author : Alain Greiner 5 ///////////////////////////////////////////////////////////////////////////////////// //5 ///////////////////////////////////////////////////////////////////////////////////// 6 6 // This file describes the single thread "coproc" application. 7 7 // It uses the GCD (Greater Common Divider) hardware coprocessor 8 8 // to make the GCD computation between two vectors of 32 bits integers. 9 // It supports two coprocessor operating modes: MODE_DMA_IRQ or MODE_DMA_NO_IRQ. 9 10 // The vectors size is defined by the VECTOR_SIZE parameter. 10 ///////////////////////////////////////////////////////////////////////////////////// //11 ///////////////////////////////////////////////////////////////////////////////////// 11 12 12 13 … … 41 42 x, y, lpid, giet_proctime() ); 42 43 44 // check coprocessor operating mode 45 giet_pthread_assert( (DMA_MODE == MODE_DMA_IRQ) || (DMA_MODE == MODE_DMA_NO_IRQ), 46 "\n[COPROC ERROR] only MODE_DMA_IRQ and MODE_DMA_NO_IRQ modes are supported"); 47 43 48 // initializes opa & opb buffers 44 49 unsigned int word; … … 50 55 51 56 unsigned int coproc_info; 57 unsigned int cluster_xy = (x << 4) + y; 58 unsigned int coproc_type = MWR_SUBTYPE_GCD; 52 59 53 /////////////////////// request a GCD coprocessor 54 giet_coproc_alloc( MWR_SUBTYPE_GCD, &coproc_info ); 60 // get a GCD coprocessor in local cluster 61 giet_coproc_alloc( cluster_xy, 62 coproc_type, 63 &coproc_info ); 55 64 56 65 // check coprocessor ports … … 69 78 #endif 70 79 71 // ////////////////////// initializes channel for OPA80 // initializes OPA channel 72 81 giet_coproc_channel_t opa_desc; 73 82 opa_desc.channel_mode = DMA_MODE; 74 83 opa_desc.buffer_size = VECTOR_SIZE<<2; 75 84 opa_desc.buffer_vaddr = (unsigned int)opa; 76 giet_coproc_channel_init( 0 , &opa_desc ); 85 giet_coproc_channel_init( cluster_xy, 86 coproc_type, 87 0, 88 &opa_desc ); 77 89 78 // ////////////////////// initializes channel for OPB90 // initializes OPB channel 79 91 giet_coproc_channel_t opb_desc; 80 92 opb_desc.channel_mode = DMA_MODE; 81 93 opb_desc.buffer_size = VECTOR_SIZE<<2; 82 94 opb_desc.buffer_vaddr = (unsigned int)opb; 83 giet_coproc_channel_init( 1 , &opb_desc ); 95 giet_coproc_channel_init( cluster_xy, 96 coproc_type, 97 1, 98 &opb_desc ); 84 99 85 // ////////////////////// initializes channel for RES100 // initializes RES channel 86 101 giet_coproc_channel_t res_desc; 87 102 res_desc.channel_mode = DMA_MODE; 88 103 res_desc.buffer_size = VECTOR_SIZE<<2; 89 104 res_desc.buffer_vaddr = (unsigned int)res; 90 giet_coproc_channel_init( 2 , &res_desc ); 105 giet_coproc_channel_init( cluster_xy, 106 coproc_type, 107 2, 108 &res_desc ); 91 109 92 110 #if VERBOSE … … 94 112 #endif 95 113 96 /////////////////////// starts communication channels 97 giet_coproc_run( 0 ); 114 // starts coprocessor 115 giet_coproc_run( cluster_xy, 116 coproc_type ); 98 117 99 118 #if VERBOSE … … 101 120 #endif 102 121 103 // /////////////////////wait coprocessor completion122 // wait coprocessor completion 104 123 if ( DMA_MODE == MODE_DMA_NO_IRQ ) 105 124 { 106 giet_coproc_completed( ); 125 giet_coproc_completed( cluster_xy, 126 coproc_type ); 107 127 } 108 128 … … 118 138 } 119 139 120 ////////////////////// release GCD coprocessor 121 giet_coproc_release( 0 ); 140 // release GCD coprocessor 141 giet_coproc_release( cluster_xy, 142 coproc_type ); 122 143 123 144 giet_pthread_exit("completed"); -
soft/giet_vm/applications/coproc/coproc.py
r708 r736 33 33 x = 0 34 34 y = 0 35 p = 135 p = 0 36 36 37 37 assert( (x < x_size) and (y < y_size) ) … … 50 50 51 51 # create vspace 52 vspace = mapping.addVspace( name = 'coproc', startname = 'coproc_data', active = False )52 vspace = mapping.addVspace( name = 'coproc', startname = 'coproc_data', active = True ) 53 53 54 54 # data vseg in cluster[x,y]
Note: See TracChangeset
for help on using the changeset viewer.