eTPU_C

eTPU_C

What registers are available for inline assembly?

The DIOB, A, P in all of its forms (p31_0, p31_16, and so on) are all available for inline assembly essentially without any issues.

The B register is used as a temporary location in expression processing. It is usually freed by the end of a C statement, allowing inline assembly.

eTPU_C

How do I perform a read_mer or read_mer12 operation?

Use the read_match() intrinsic function.

eTPU_C

How should the host communicate with the eTPU?

There are a few ways:

  • You can pass information through static locals. The host sets these itself, during initialization.

    Use the ::ETPUlocation macro to identify the offset of the static in the function frame. Rather than assigning the value in ::ETPUstaticinit which comes from the eTPU_C program, simply set your own initial value.

eTPU_C

What other ways can I signal the host?

There are two other exception types: channel interrupts and data transfer interrupts. In those devices without DMA hardware, the two are indistinguishable. Assign values 0 or 1 to channel.CIRC, or use these macros from eTPUC_common.h.

// Channel control macros
#define SetChannelInterrupt()       (channel.CIRC = 0)
#define SetDataTransferInterrupt()  (channel.CIRC = 1)
eTPU_C

How do I cause a global exception?

The eTPU requires a value of 0x02 in the CIRC instruction field.

In C, CIRC is part of the channel structure:

channel.CIRC = 0x02

Alternatively, use a macro from eTPUC_common.h.

#define SetGlobalException()        (channel.CIRC = 2)
eTPU_C

The simulator warns about an MDU paired with a CCS subinstruction. It calls the choice "puzzling". What's wrong?

This is effectively a "don't care" operation. The MDU flags are always preserved. The compiler uses CCS for all math operations, except where explicitly disabled by optimization.

eTPU_C

How are structure bit fields dealt with?

As efficiently as possible. Bit fields are packed within 32-bit boundaries. Packed bit fields can have a dramatic impact on the amount of code generated.

Bit Fields

This example declares two structs, one with less than 32 bits of bit fields, and one with more.

eTPU_C

eTPU_C is giving "RAM allocated out of default RAM space" warnings. What's wrong?

This warning can occur when #pragma memory RAM or #pragma memory LOCAL directives declare RAM that doesn't start on a 4-byte boundary. Variable declarations will try to allocate locations partly outside of declared RAM space

eTPU_C

The compiler has optimized a local variable into a register. I'd prefer it take a memory location. How can I change this?

The compiler has correctly optimized the variable into a register because it could do so. Declare the variable as a static variable, and eTPU_C will be forced to allocate a location.

eTPU_C

An expression that uses division isn't working properly. What's wrong?

Due to implementation limitations, signed divides are not available.

Syndicate content