Understanding movts

Understanding movts

Postby snim2 » Sun Jul 12, 2015 11:26 pm

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
snim2
 
Posts: 53
Joined: Mon Feb 03, 2014 5:02 pm

Re: Understanding movts

Postby tnt » Mon Jul 13, 2015 6:08 am

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
tnt
 
Posts: 408
Joined: Mon Dec 17, 2012 3:21 am

Re: Understanding movts

Postby snim2 » Mon Jul 13, 2015 6:31 am

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?
snim2
 
Posts: 53
Joined: Mon Feb 03, 2014 5:02 pm

Re: Understanding movts

Postby tnt » Mon Jul 13, 2015 6:49 am

Heh ... I guess cut & paste error in the manual ...
tnt
 
Posts: 408
Joined: Mon Dec 17, 2012 3:21 am

Re: Understanding movts

Postby snim2 » Mon Jul 13, 2015 7:04 am

Argh!
snim2
 
Posts: 53
Joined: Mon Feb 03, 2014 5:02 pm

Re: Understanding movts

Postby tnt » Mon Jul 13, 2015 7:17 am

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)
tnt
 
Posts: 408
Joined: Mon Dec 17, 2012 3:21 am

Re: Understanding movts

Postby snim2 » Mon Jul 13, 2015 7:23 am

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.
snim2
 
Posts: 53
Joined: Mon Feb 03, 2014 5:02 pm

Re: Understanding movts

Postby aolofsson » Mon Jul 13, 2015 12:14 pm

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
User avatar
aolofsson
 
Posts: 1005
Joined: Tue Dec 11, 2012 6:59 pm
Location: Lexington, Massachusetts,USA

Re: Understanding movts

Postby snim2 » Sun Jul 19, 2015 10:42 pm

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
snim2
 
Posts: 53
Joined: Mon Feb 03, 2014 5:02 pm


Return to Assembly

Who is online

Users browsing this forum: No registered users and 1 guest