We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I need some indications to begin writing a program.
Write a compare routine to compare 64-bits values , using only two instructions.
Thanks for your indications !
Hello.
how about using the conditional execution?
Best regards,
Yasuhiko Koumoto.
> Write a compare routine to compare 64-bits values , using only two instructions.
This sounds a lot like a homework question =)
What ideas do you have? What have you tried so far?
Pete
Fortunately, the answer to this question is the same for all Cortex-M microcontrollers.
The answer can also be applied to the ARM7/ARM9.
Because it can be solved on a Cortex-M0 just as easily as Cortex-M4 and ARM7, I recommend that you look at Cortex-M0, since the Cortex-M0 have fewer instructions than the others.
Try taking a look at the ARM Information Center: Cortex-M0 General data processing instructions.
All these instructions operate on 32-bit values only; there are no 64-bit instructions, as you probably already know.
However, it is possible using two instructions, to accomplish the goal.
...Now the help does not end with my answer, it only begins here.
How much do you know about the ARM instruction set(s) already - how would you for instance compare two 32-bit values ?
Hello jensbauer,
I think it might be impossible to make 64-bit compare routine witch Cortex-M.
In Cortex-M4 case, it would take at least four instructions even if IT instruction was used.
In Cortex-M0 case, more instructions would be needed, Please give me hint.
It is possible, because the assignment is to "compare" - the assignment is not to act on the result of the comparison.
I'll send you the solution. There is one small sacrifice, though, but I think that will be acceptable.
Besides: Yasuhiko is right. It will be best to attempt doing this on the 32-bit ARM architecture, because you can't use conditional execution without adding an IT instruction to your code, that would make it 3 instructions.
My solution is still available, though, however, it will change the contents of one register (which you can freely choose).
Hello jensbauer.
you are so smart!
I should have a more flexible brain.
I only have a few good hints and tips.
I'm happy to admit that I've learned a lot of things from reading your discussions and posts.
Me too ! Thanks