SPRUIG6K January   2018  – March 2024

 

  1.   1
  2.   C7000 Host Emulation
  3. About This Document
    1. 1.1 Related Documentation
    2. 1.2 Disclaimer
    3. 1.3 Trademarks
  4. Getting Started with Host Emulation
    1. 2.1 System Requirements
    2. 2.2 Installation Instructions
    3. 2.3 Summary of Differences: Host Emulation Coding vs. Native C7000 Coding
  5. General Coding Requirements
    1. 3.1 Required Header Files
    2. 3.2 Package Dependencies
    3. 3.3 Example Program
  6. Intrinsics
    1. 4.1 OpenCL-Like Intrinsics
    2. 4.2 Streaming Address Generator Intrinsics
    3. 4.3 C6000 Legacy Intrinsics
    4. 4.4 Memory System Intrinsics
  7. TI Vector Types
    1. 5.1 Constructors
    2. 5.2 Accessors
    3. 5.3 Vector Operators
    4. 5.4 Print Debug Function
  8. Streaming Engine and Streaming Address Generator
  9. Lookup Table and Histogram Interface
    1. 7.1 Lookup Table and Histogram Data
  10. C6000 Migration
    1. 8.1 __float2_t Legacy Data Type
  11. Matrix Multiply Accelerator (MMA) Interface
  12. 10Compiler Errors and Warnings
    1. 10.1 Key Terms Found in Compiler Errors and Warnings
    2. 10.2 Host Emulation Specific Syntax
  13. 11Revision History
  14.   35

Print Debug Function

A print function is provided with C7000 Host Emulation that can be used on any TI vector type. This function prints out a formatted list of the contents of the vector. This function is specific to C7000 Host Emulation and is not supported by the C7000 compiler. As a result, references to this function must be omitted or protected by checks of the __C7X_HOSTEM__ preprocessor symbol in order to be compiled using the C7000 compiler. The following example shows how the print function can be used at different accessor levels of a vector.

/* Print function usage */
#ifndef __C7X_HOSTEM__
void print(int* ptr, int length)
{
    // Loop over elements and print
}
#endif

int8 example = int8(int4(0), int4(1));

#ifdef __C7X_HOSTEM__
example.print();                 // Prints: (0,0,0,0,1,1,1,1)
example.lo().print();            // Prints: (0,0,0,0)
example.hi().lo().print();       // Prints: (1,1)
example.even().print();          // Prints: (0,0,1,1)
example.even().hi().print();     // Prints: (1,1)
//example.s0().print();          // Illegal, member .s0 is a scalar value

__vload_dup(&example).print();   // Prints (0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1)

#else
// Target implementation

// NOTE: Output depends on print() implementation
print((int*)(&example), 8);      // 0,0,0,0,1,1,1,1

// Error, can't take the address of a swizzle
//print((int*)(&example.hi()), 4);

// Option 1, preferred
int4 result_int4 = example.hi();
print((int*)(&result_int4), 4);  // 1,1,1,1

// Option 2
print((((int *)&example)+2), 4); // 0,0,1,1

int16 result_int16 = __vload_dup(&example);
print((int*)&result_int16, 16);  // 0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1
#endif