Changeset 822 for soft/giet_vm/applications/rosenfeld/nrc2/src/nrio1x.c
- Timestamp:
- Jun 1, 2016, 10:25:43 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/applications/rosenfeld/nrc2/src/nrio1x.c
r772 r822 21 21 #include "nrio1x.h" 22 22 23 /* ---------------------------------------------------------------------------------------------------------- */ 24 IMAGE_EXPORT(void) display_bvector_circular(byte *v,long nl,long nh, long c0, long c1, char *format, char *name) 25 /* ---------------------------------------------------------------------------------------------------------- */ 26 { 27 long i, n=nh-nl+1; 28 29 if(name != NULL) puts(name); 30 31 for(i=c0; i<=c1; i++) { printf(format, v[i%n+nl]);} putchar('\n'); 32 } 33 /* ----------------------------------------------------------------------------------------------------------- */ 34 IMAGE_EXPORT(void) display_si16vector_circular(sint16 *v,long nl,long nh, long c0, long c1, char *format, char *name) 35 /* ----------------------------------------------------------------------------------------------------------- */ 36 { 37 long i, n=nh-nl+1; 38 39 if(name != NULL) puts(name); 40 41 for(i=c0; i<=c1; i++) { printf(format, v[i%n+nl]);} putchar('\n'); 42 } 43 /* --------------------------------------------------------------------------------------------------------- */ 44 IMAGE_EXPORT(void) display_ui32vector_circular(uint32 *v,long nl,long nh, long c0, long c1, char *format, char *name) 45 /* --------------------------------------------------------------------------------------------------------- */ 46 { 47 long i, n=nh-nl+1; 48 49 if(name != NULL) puts(name); 50 51 for(i=c0; i<=c1; i++) { printf(format, v[i%n+nl]);} putchar('\n'); 52 } 53 /* ---------------------------------------------------------------------------------------------------------- */ 54 IMAGE_EXPORT(void) display_f32vector_circular(float32 *v,long nl,long nh, long c0, long c1, char *format, char *name) 55 /* ---------------------------------------------------------------------------------------------------------- */ 56 { 57 long i, n=nh-nl+1; 58 59 if(name != NULL) puts(name); 60 61 for(i=c0; i<=c1; i++) { printf(format, v[i%n+nl]);} putchar('\n'); 62 } 63 /* ------------------------------------------------------------------------------------------------------------ */ 64 IMAGE_EXPORT(void) display_f64vector_circular(float64 *v,long nl,long nh, long c0, long c1, char *format, char *name) 65 /* ------------------------------------------------------------------------------------------------------------ */ 66 { 67 long i, n=nh-nl+1; 68 69 if(name != NULL) puts(name); 70 71 for(i=c0; i<=c1; i++) { printf(format, v[i%n+nl]);} putchar('\n'); 72 } 73 /* ----------------------------------------------------------------------------------------------------------------- */ 74 IMAGE_EXPORT(void) display_bvector_circular_number(byte *v,long nl,long nh, long c0, long c1, char *format, char *name) 75 /* ----------------------------------------------------------------------------------------------------------------- */ 76 { 77 long i, n=nh-nl+1; 78 79 if(name != NULL) puts(name); 80 81 putchar('#'); 82 for(i=c0; i<=c1; i++) { 83 printf(format, i%n+nl); 84 } 85 putchar('\n'); 86 putchar(' '); 87 for(i=c0; i<=c1; i++) { 88 printf(format, v[i%n+nl]); 89 } 90 putchar('\n'); 91 } 92 /* ------------------------------------------------------------------------------------------------------------------ */ 93 IMAGE_EXPORT(void) display_si16vector_circular_number(sint16 *v,long nl,long nh, long c0, long c1, char *format, char *name) 94 /* ------------------------------------------------------------------------------------------------------------------ */ 95 { 96 long i, n=nh-nl+1; 97 98 if(name != NULL) puts(name); 99 100 putchar('#'); for(i=c0; i<=c1; i++) { printf(format, i%n+nl); } putchar('\n'); 101 putchar(' '); for(i=c0; i<=c1; i++) { printf(format, v[i%n+nl]);} putchar('\n'); 102 } 103 /* ---------------------------------------------------------------------------------------------------------------- */ 104 IMAGE_EXPORT(void) display_ui32vector_circular_number(uint32 *v,long nl,long nh, long c0, long c1, char *format, char *name) 105 /* ---------------------------------------------------------------------------------------------------------------- */ 106 { 107 long i, n=nh-nl+1; 108 109 if(name != NULL) puts(name); 110 111 putchar('#'); for(i=c0; i<=c1; i++) { printf(format, i%n+nl); } putchar('\n'); 112 putchar(' '); for(i=c0; i<=c1; i++) { printf(format, v[i%n+nl]);} putchar('\n'); 113 } 114 /* ----------------------------------------------------------------------------------------------------------------- */ 115 IMAGE_EXPORT(void) display_f32vector_circular_number(float32 *v,long nl,long nh, long c0, long c1, char *format, char *name) 116 /* ----------------------------------------------------------------------------------------------------------------- */ 117 { 118 long i, n=nh-nl+1; 119 120 if(name != NULL) puts(name); 121 122 putchar('#'); for(i=c0; i<=c1; i++) { printf(format, i%n+nl); } putchar('\n'); 123 putchar(' '); for(i=c0; i<=c1; i++) { printf(format, v[i%n+nl]);} putchar('\n'); 124 } 125 /* ------------------------------------------------------------------------------------------------------------------- */ 126 IMAGE_EXPORT(void) display_dvector_circular_number(float64 *v,long nl,long nh, long c0, long c1, char *format, char *name) 127 /* ------------------------------------------------------------------------------------------------------------------- */ 128 { 129 long i, n=nh-nl+1; 130 131 if(name != NULL) puts(name); 132 133 putchar('#'); for(i=c0; i<=c1; i++) { printf(format, i%n+nl); } putchar('\n'); 134 putchar(' '); for(i=c0; i<=c1; i++) { printf(format, v[i%n+nl]);} putchar('\n'); 23 #undef display_type_vector_circular 24 #define display_type_vector_circular(t) \ 25 void short_name(t,display_,vector_circular)(t * v, int32_t nl, int32_t nh, int32_t c0, int32_t c1, char * format, char * name) \ 26 { \ 27 int32_t n = nh - nl + 1; \ 28 if (name != NULL) { \ 29 printf("%s\n", name); \ 30 } \ 31 for (int32_t i = c0; i <= c1; i++) { \ 32 printf(format, v[i % n + nl]); \ 33 } \ 34 printf("\n"); \ 135 35 } 136 36 137 /* ------------------------------------------------------------------------------------- */138 IMAGE_EXPORT(void) display_bvector_cycle(byte *v,long nl,long nh, char *format, char *name)139 /* ------------------------------------------------------------------------------------- */140 {141 long i;142 uint8 first, next;143 uint8 *displayed;144 37 145 if(name != NULL) printf("%s", name); 38 display_type_vector_circular(int8_t); 39 display_type_vector_circular(uint8_t); 40 display_type_vector_circular(int16_t); 41 display_type_vector_circular(uint16_t); 42 display_type_vector_circular(int32_t); 43 display_type_vector_circular(uint32_t); 44 display_type_vector_circular(int64_t); 45 display_type_vector_circular(uint64_t); 46 display_type_vector_circular(float); 47 display_type_vector_circular(double); 146 48 147 displayed = ui8vector0(nl, nh); 148 149 for(i=nl; i<=nh; i++) { 150 if(!displayed[i]) { 151 displayed[i] = 1; 152 printf(format, i); 153 first = (byte) i; 154 next = v[i]; 155 while(first != next) { 156 displayed[next] = 1; 157 printf(format, next); 158 next = v[next]; 159 } 160 putchar('\n'); 161 } 162 } 163 putchar('\n'); 164 free_ui8vector(displayed, nl, nh); 49 50 51 #undef display_type_vector_circular_number 52 #define display_type_vector_circular_number(t) \ 53 void short_name(t,display_,vector_circular_number)(t * v, int32_t nl, int32_t nh, int32_t c0, int32_t c1, char * format, char * name) \ 54 { \ 55 int32_t n = nh - nl + 1; \ 56 if (name != NULL) { \ 57 printf("%s", name); \ 58 } \ 59 printf("#"); \ 60 for (int32_t i = c0; i <= c1; i++) { \ 61 printf(format, i % n + nl); \ 62 } \ 63 printf("\n "); \ 64 for (int32_t i = c0; i <= c1; i++) { \ 65 printf(format, v[i % n + nl]); \ 66 } \ 67 printf("\n"); \ 165 68 } 166 /* -------------------------------------------------------------------------------------- */167 IMAGE_EXPORT(void) display_si16vector_cycle(sint16 *v,long nl,long nh, char *format, char *name)168 /* -------------------------------------------------------------------------------------- */169 {170 long i;171 uint16 first, next;172 uint8 *displayed;173 69 174 if(name != NULL) printf("%s", name);175 70 176 displayed = ui8vector0(nl, nh); 177 178 for(i=nl; i<=nh; i++) { 179 if(!displayed[i]) { 180 displayed[i] = 1; 181 printf(format, i); 182 first = (sint16) i; 183 next = v[i]; 184 while(first != next) { 185 displayed[next] = 1; 186 printf(format, next); 187 next = v[next]; 188 } 189 putchar('\n'); 190 } 191 } 192 putchar('\n'); 193 free_ui8vector(displayed, nl, nh); 71 display_type_vector_circular_number(int8_t); 72 display_type_vector_circular_number(uint8_t); 73 display_type_vector_circular_number(int16_t); 74 display_type_vector_circular_number(uint16_t); 75 display_type_vector_circular_number(int32_t); 76 display_type_vector_circular_number(uint32_t); 77 display_type_vector_circular_number(int64_t); 78 display_type_vector_circular_number(uint64_t); 79 display_type_vector_circular_number(float); 80 display_type_vector_circular_number(double); 81 82 83 84 #undef display_type_vector_cycle 85 #define display_type_vector_cycle(t) \ 86 void short_name(t,display_,vector_cycle)(t * v, int32_t nl, int32_t nh, char * format, char * name) \ 87 { \ 88 uint8_t first; \ 89 uint8_t next; \ 90 uint8_t * displayed; \ 91 \ 92 if (name != NULL) { \ 93 printf("%s", name); \ 94 } \ 95 displayed = ui8vector0(nl, nh); \ 96 for (int32_t i = nl; i <= nh; i++) { \ 97 if (!displayed[i]) { \ 98 displayed[i] = 1; \ 99 printf(format, i); \ 100 first = (t) i; \ 101 next = v[i]; \ 102 while (first != next) { \ 103 displayed[next] = 1; \ 104 printf(format, next); \ 105 next = v[next]; \ 106 } \ 107 printf("\n"); \ 108 } \ 109 } \ 110 printf("\n"); \ 111 free_ui8vector(displayed, nl, nh); \ 194 112 } 195 /* ---------------------------------------------------------------------------------------- */196 IMAGE_EXPORT(void) display_ui16vector_cycle(uint16 *v,long nl,long nh, char *format, char *name)197 /* ---------------------------------------------------------------------------------------- */198 {199 long i;200 uint16 first, next;201 uint8 *displayed;202 113 203 if(name != NULL) printf("%s", name);204 114 205 displayed = ui8vector0(nl, nh); 206 207 for(i=nl; i<=nh; i++) { 208 if(!displayed[i]) { 209 displayed[i] = 1; 210 printf(format, i); 211 first = (uint16) i; 212 next = v[i]; 213 while(first != next) { 214 displayed[next] = 1; 215 printf(format, next); 216 next = v[next]; 217 } 218 putchar('\n'); 219 } 220 } 221 putchar('\n'); 222 free_ui8vector(displayed, nl, nh); 223 } 115 display_type_vector_cycle(int8_t); 116 display_type_vector_cycle(uint8_t); 117 display_type_vector_cycle(int16_t); 118 display_type_vector_cycle(uint16_t); 119 display_type_vector_cycle(int32_t); 120 display_type_vector_cycle(uint32_t); 121 display_type_vector_cycle(int64_t); 122 display_type_vector_cycle(uint64_t); 123 display_type_vector_cycle(float); 124 display_type_vector_cycle(double); 125 126 127 // Local Variables: 128 // tab-width: 4 129 // c-basic-offset: 4 130 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 131 // indent-tabs-mode: nil 132 // End: 133 134 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 135
Note: See TracChangeset
for help on using the changeset viewer.