For Coldfire, what is the correct result of the following mov3q instruction with data register direct effective address mode? Remember that the 3-bit immediate data value of "0" represents -1. I'm thinking it is #2 because the 2's complement 3-bit value of -1 is 0x7.
mov3q.l #0x0,d2
//(1) d2=0xfffffff8 (suspect is wrong)
//(2) d2=0xffffffff (suspect is correct)
I assume the below instruction of immediate value=+7 yields the following answer. Agree?
mov3q.l #0x7,d2
//d2=0x00000007
Solved! Go to Solution.
No confirmation but suspect the value in the comment is correct due to 2's complement of -1.
mov3q.l #-1,d2 //(2) d2=0xffffffff
Tim
Assembler should resist to compile this
mov3q.l #0x0,d2
and/or emit error or warning, illegal operand, not in range or something. Valid left side arguments are -1, 1,2,3,4,5,6,7 only. Like Coldfire programmer's reference manual says, data range is -1 to 7, excluding 0.
Thank-you. I misunderstood the following statement in the Coldfire programmer's reference manual for the MOV3Q instruction.
"Immediate data field—3 bits of data having a range {-1,1-7} where a data value of 0 represents -1.
Apparently, the assembler sees -1, puts a 0 in the immediate data field, and the hardware knows to interpret it as -1.
With the assembler instruction corrected below, is #2 the correct value in d2 based on the 3-bit 2's complement of -1 being 0x7?
mov3q.l #-1,d2
//(1) d2=0xfffffff8 (suspect is wrong)
//(2) d2=0xffffffff (suspect is correct)
Tim
No confirmation but suspect the value in the comment is correct due to 2's complement of -1.
mov3q.l #-1,d2 //(2) d2=0xffffffff
Tim