Page 1 of 1

Understanding movts

PostPosted: Sun Jul 12, 2015 11:26 pm
by snim2
The objdump here: https://gist.github.com/snim2/d65ca70e9be3a2a7fa67#file-gistfile1-asm-L440 shows a movts instruction which loads a value from r0 and writes it to IRET:

Code: Select all
  f2:   010f 0402    movts iret,r0


The binary representation for this instruction is:

Code: Select all
dddnnnxxxxmm0010dddnnn0100001111
00000100000000100000000100001111


So, rd is 0, rn is 8 and the value of mm means we are using the core register group.

I cannot reconcile this with the reference manual, which says that the operation of movts is:

Code: Select all
MOVTS <SPECIAL>, <RN>
<SPECIAL> Special Register to copy value into
<RN> General-purpose source register for move operation
Operation: SPECIAL = RN


So, I would have thought that movts iret,r0 would be compiled to an instruction where rn is 0 and rd is 75 (guessing that value from the list of registers in Appendix B).

What have I missed?

Thanks,

Sarah

Re: Understanding movts

PostPosted: Mon Jul 13, 2015 6:08 am
by tnt
Core registers are those in the range 0xF04??
IRET is at 0xF0420 which is the 8th register in that group = ( 0xF0420 - 0xF0400 ) / sizeof(uint32_t) = 8

Re: Understanding movts

PostPosted: Mon Jul 13, 2015 6:31 am
by snim2
tnt wrote:Core registers are those in the range 0xF04??
IRET is at 0xF0420 which is the 8th register in that group = ( 0xF0420 - 0xF0400 ) / sizeof(uint32_t) = 8


That makes sense, but the "special" register is the one we are copying to in a MOVTS, so I would have expected the rd to hold the 8, since IRET is the destination register, and rn to hold 0?

Re: Understanding movts

PostPosted: Mon Jul 13, 2015 6:49 am
by tnt
Heh ... I guess cut & paste error in the manual ...

Re: Understanding movts

PostPosted: Mon Jul 13, 2015 7:04 am
by snim2
Argh!

Re: Understanding movts

PostPosted: Mon Jul 13, 2015 7:17 am
by tnt
Well the assembler works ... so between the real running code and the manual ... always trust the code !

You can report the arch manual error, there is a dedicated topic for this (can't remember on which sub forum, but it's pinned at the top IIRC)

Re: Understanding movts

PostPosted: Mon Jul 13, 2015 7:23 am
by snim2
Thanks. I have a long list of these and I'll add them to the topic soon. I dearly wish the manual was on Github and I could just make a pull request.

Re: Understanding movts

PostPosted: Mon Jul 13, 2015 12:14 pm
by aolofsson
Please do send any other issues you have. I would have thought they would all have been fixed by now, there were quite a few mistakes identified and fixed when the manual was released.

viewtopic.php?f=8&t=43

I am really surprised that there are that many, but look forward to seeing them. I'll fix them quickly.

Thanks!
Andreas

Re: Understanding movts

PostPosted: Sun Jul 19, 2015 10:42 pm
by snim2
aolofsson wrote:Please do send any other issues you have. I would have thought they would all have been fixed by now, there were quite a few mistakes identified and fixed when the manual was released.

viewtopic.php?f=8&t=43

I am really surprised that there are that many, but look forward to seeing them. I'll fix them quickly.



Thanks, I'll post more on that topic. I think with most of these issues you would only really notice them if you were writing something like a simulator, so a lot of these things will only matter to a few people. The problem is that it's very hard to tell sometimes what issues are caused by bugs I have introduced in my code, and what problems come from misunderstanding the manual :(

Thanks,

Sarah