mov3q with -1 value

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
2,521件の閲覧回数
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

ラベル(1)
0 件の賞賛
返信
1 解決策
1,455件の閲覧回数
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 件の賞賛
返信
3 返答(返信)
1,455件の閲覧回数
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 件の賞賛
返信
1,455件の閲覧回数
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 件の賞賛
返信
1,456件の閲覧回数
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 件の賞賛
返信