[Avrora] MSP430 / TelosB support for Avrora
Urs Hunkeler
urs.hunkeler at epfl.ch
Fri Jan 21 03:23:10 PST 2011
Hi Daniel,
I just fixed the test suit. The only test currently failing is again
similar and I am unsure what the correct behavior should be. When adding
-1 to 4, I think there should be a carry (especially if the MCU ignores
the sign of operands) and in fact the interpreter (again, code not
written by me) sets the carry, but the tests expect the carry to be
cleared (could be wrong). Now, an equivalent operation would be to
subtract 1 from 4, but as we have seen, in this case the carry is a
borrow.NOT.Carry (according to the manual) and the carry would not be
set. So, is the behavior of the carry flag different between adding a
negative number and subtracting a positive number?
Well, anyway, I think the current version is correct, but I won't fix
the test so that if someone else ever is interested in the msp430
interpreter they see the issue and decide for themselves.
Cheers,
Urs
On 01/19/2011 10:29 AM, Daniel Minder wrote:
> Hi Urs,
>
> I'm not that familiar with the MSP430, but I guess if you just follow
> the arithmetics as described in the instruction set it should work:
>
> with r12=r13=0:
> sub #1025, r12 --> 0 + NOT #1024 + 1 = 0 + fbfeh + 1 = fbffh, no carry!
> sbc r13 --> 0 + ffffh + carry (0) = ffffh, no carry!
> jnc $+48 --> jump!
>
> I'm sure you'll figure out how to implement this in Avrora :)
>
>> I'll have to figure out whether additions with
>> negative numbers are affected...
>
> IMGO, the CPU is not aware of negative numbers in the ADD command. It
> just does pure bit arithmetics, at least to the command set description.
>
> Best,
> Daniel
>
More information about the Avrora
mailing list