mov3q with -1 value

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

mov3q with -1 value

Jump to solution
1,650 Views
tupdegrove
Contributor III

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

Labels (1)
0 Kudos
1 Solution
584 Views
tupdegrove
Contributor III

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

View solution in original post

0 Kudos
3 Replies
584 Views
kef
Specialist I

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.

0 Kudos
584 Views
tupdegrove
Contributor III

 

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

Message Edited by tupdegrove on 2009-07-09 08:40 AM
0 Kudos
585 Views
tupdegrove
Contributor III

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

0 Kudos