AnsweredAssumed Answered

DSMC swap instruction does not work as expected on MPC574xG

Question asked by Martin Schultheiss on Apr 11, 2017
Latest reply on Apr 12, 2017 by Martin Schultheiss

Dear NXP Support,

 

we're trying to implement a swap routine by using the DSMC Module.
Therefore we want to use the lwdcbx asm instruction.
We're using the following code to do this (Greenhills Assembler Macro):

 

__asm uint32 Hal_Swap(uint32 Addr, uint32 Value)
{
%reg Addr %con Value
  /* prepare the decoration for the SWAP instruction */
  se_li    r6, Value           /* load value in r6 */
  e_lis    r5, 0x5000          /* r5 = 0x50000000 */
  se_or    r6, r5              /* Value = Value | r5 */
  /* lwdcbx -> Load Word Decorated with Cache Bypass */
  lwdcbx   r3, r6, Addr        /* SWAP Addr with r3 */
%error
}

 

We expect the following behavior (as described in MPC5748GRM Rev. 4, 07/2015 - Chapter 18.4.1.2.2):
1. The "old" value of Addr is stored in r3
2. The value of r5 (WD28 in r6) is stored at Addr.

 

What we get is only the old value in r3, but no storage operation is performed at Addr.

 

We are using the following Micro:
PPC5748GSK0MMJ6
0N65H
CTZGS1329A

 

Thanks in advance and best regards,
Martin Schultheiß

Outcomes