Microchip
直播中

杨敏

7年用户 199经验值
私信 关注
[问答]

为什么XC16编译器里P1被传递给W3:W2而不是W1:W2?

下面是XC16编译器手册[DS5002071D页211 ]的摘录。这里P1被传递给W3:W2而不是W1:W2,为什么??

以上来自于百度翻译


      以下为原文

    The following is an excerpt from the xc16 compiler manual [DS50002071D-page 211].
params0(short p0, long p1, int p2, char p3, float p4, void *p5)
{
/*
** W0 p0
** W1 p2
** W3:W2 p1
** W4 p3
** W5 p5
** W7:W6 p4
*/
...
}

Here p1 is passed to w3:w2 instead of w1:w2, why??

回帖(7)

李维兴

2019-7-29 13:30:35
它与存储器中的数据对齐有关,其中双字数据存储在两个连续的工作寄存器中,而偶数编号的工作寄存器中的最小有效字存储在两个连续的工作寄存器中。

以上来自于百度翻译


      以下为原文

    It has to do with data alignment in memory, where double word data is stored in two successive working registers with the least significant word in an even numbered working register.
举报

王璨

2019-7-29 13:39:51
在这种情况下,我建议按大小递减的顺序进行排序——这将在w0:w1和w2:w3中传递longs。

以上来自于百度翻译


      以下为原文

    In such cases I recommend to sort in decending-size order - which would pass the longs in w0:w1 and w2:w3.
Which is quite predictible.
举报

石径

2019-7-29 13:46:43
MAC W4*W5,A,[W8] +=2,W4,[W10] +=2,W5W4,W5应该只有int的吗?难道它们不能成为交易的吗?我知道这完全是离题,但相信答案是肯定或否定的,所以把它贴在这里而不是一个新的帖子。

以上来自于百度翻译


      以下为原文

    mac w4*w5,a,[w8]+=2,w4,[w10]+=2,w5
Does w4,w5 should be only int's?Can't they be _Fract's? I understand this is completely off-topic, but believe the answer is yes or no, so posting it here instead of a new post.
举报

王璨

2019-7-29 13:56:36
“FrACT”只是对整数格式的另一种解释(无论是签名的还是未签名的、长的、短的或字节的)。因此,与整数格式一起工作的任何东西也适用于Fract。但您仍然需要知道签名/未签名,最终不同的FrACT解释…

以上来自于百度翻译


      以下为原文

    'Fract' is 'only' another interpretation of an integer format (whether signed or unsigned, long, short or byte).
Thus anything working with integer formats works with Fract as well.
 
But you still have to be aware about signed/unsigned and eventually different fract interpretations...
举报

更多回帖

发帖
×
20
完善资料,
赚取积分