Changeset 403 for trunk/lib


Ignore:
Timestamp:
May 26, 2010, 2:46:59 PM (9 years ago)
Author:
ksherdy
Message:

Add debug print function to the display register view of a value.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/lib_simd.h

    r389 r403  
    190190}
    191191
    192 #endif
    193 
     192void print_bit_block(char * var_name, SIMD_type v) {
     193  union {SIMD_type vec; unsigned char elems[8];} x;
     194  x.vec = v;
     195  unsigned char c, bit_reversed;
     196  int i;
     197  printf("%20s = ", var_name);
     198  for (i = 0; i < sizeof(SIMD_type); i++) {
     199    c = x.elems[i];
     200     printf("%02X ", c);
     201  }
     202  printf("\n");
     203}
     204
     205/* Prints the register representation of a 32 bit value. */
     206static void print_general_register_32(const char * var_name, uint32_t v) {
     207        unsigned char c;
     208        int i;
     209        printf("%30s = ", var_name);
     210        for(int i=sizeof(uint32_t)-1; i>=0; i--) {
     211                c = *(((unsigned char *)&v)+i);
     212                printf("%02X ", c);
     213        }
     214        printf("\n");
     215}
     216
     217/* Prints the register representation of a 64 bit value. */
     218static void print_general_register_64(const char * var_name, uint32_t v) {
     219        unsigned char c;
     220        int i;
     221        printf("%30s = ", var_name);
     222        for(int i=sizeof(uint32_t)-1; i>=0; i--) {
     223                c = *(((unsigned char *)&v)+i);
     224                printf("%02X ", c);
     225        }
     226        printf("\n");
     227}
     228
     229/* Prints the SIMD register representation of a SIMD value. */
     230static void print_simd_register(const char * var_name, SIMD_type v) {
     231  union {SIMD_type vec; unsigned char elems[8];} x;
     232  x.vec = v;
     233  unsigned char c, bit_reversed;
     234  int i;
     235  printf("%30s = ", var_name);
     236  for(int i=sizeof(SIMD_type)-1; i>=0; i--) {
     237    c = x.elems[i];
     238    printf("%02X ", c);
     239  }
     240  printf("\n");
     241}
     242
     243#endif
     244
Note: See TracChangeset for help on using the changeset viewer.