UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

AR# 51984

EDK MicroBlaze: explanation of Store Halfword Reverse MicroBlaze Instruction

Description

当我使用 SHR 指令,它交换字节顺序并将结果存储在另外半字 (原半字旁)。


此为预期行为吗?

code snippet:


  typedef union
  {
    struct
   {
        unsigned short int16e;
        unsigned short int16f;
   } structure;
   unsigned int tab[1];
  } structTest_t;

    structTest_t lit2big;
 lit2big.structure.int16e= 0xf055;
 lit2big.structure.int16f= 0xf066;
shr(&lit2big.structure.int16e, 0xad0b);
// print it:
int16e = F055 <- wanted to swap and assign there but didn't
int16f = BAD <- this other got swapped
 

解决方案

根据 (UG081),此为预期行为:
------------------------
If the R bit is set, a halfword reversed memory location is used and the two bytes in the halfword are reversed, storing data with the opposite endianness of the endianness defined by C_ENDIANNESS and the E bit (if virtual protected mode is enabled).
----------
halfword reversed memory location is used " 属于预期之中。
 
确保在设置中使用 C_USE_REORDER_INSTR = 1 - 其为默认设置,所以应在默认情况下生效。
 
If = 0 ,则其属于普通存储,不包含字节倒置。
AR# 51984
创建日期 09/25/2012
Last Updated 10/02/2014
状态 Active
Type 综合文章
IP
  • Microblaze