AnsweredAssumed Answered

SIMD question

Question asked by Cedrikos on Nov 21, 2017
Latest reply on Dec 7, 2017 by Cedrikos

Hi there.

 

I'm using a SHARC 21489 on a EZ Kit.

 

I was wondering whether it is possible to let just PEX move data whilst in SIMD mode (and not PEY).

E.g: Suppose I have a buffer containing N interleaved samples (L/R with N even). I want to extract the N/2 samples of the left channel and I need to remain in SIMD mode. If I try to do so, I end up writing one sample in excess beyond the buffer's end.

 

Here's a sample code illustrating my problem.

Check the commented line.

 

/////////////////////////////////////////////////////////////////////////////////

constexpr size_t SAMPLES = 64;

__dm float gInterleaved[SAMPLES];

__dm float gLeft[SAMPLES >> 1];

 

asm("#include <def21489.h>\n\t"
        "M0 = 2; M1 = 1;\n\t"
        "R14 = MODE1;\n\t"
        "BIT SET MODE1 PEYEN; NOP;\n\t"
        "LCNTR = %2, DO (PC, 2) UNTIL LCE;\n\t"
        " F0 = DM(%0, M0);\n\t"
        " DM(%1, M1) = F0;\n\t"   // <- Conditional if or something else here ???
        "MODE1 = R14; NOP;\n\t"
        :
        : "w"(gInterleaved),
          "w"(gLeft)
          "d"(static_cast<int>(SAMPLES))
        : "F0", "R14", "M0"
);

/////////////////////////////////////////////////////////////////////////////////

 

 

Of course SIMD mode should not be used in such a case, but in an assembly routine I am currently coding I've got a similar problem, and I need Mode1 to be set in SIMD mode. I cannot afford unsetting SIMD mode before storing and setting it again afterwards. And extending the destination buffer (gLeft in the sample code) by one sample is out of question

 

My intuition tells me there must be a way to do it, but I can't seem to figure it out. 

Can any of you guys on EngineerZone help me out?

 

Thanks a lot.

 

C.

Outcomes