Back
MASM : CONVERSION : FTOI
FTOI:

Syntax:

Description:

The FTOI (float to integer) instruction interprets the data stored on the two banks of register Rs0 as double precision (64-bits) floating point numbers, and yields the integral parts of these numbers in a 64-bit integer representation. The result is then written to register Rd3 according to the bank select Bs3. The data on Rs0 is accessed through Port0 of the register file, and the result is written via Port3 of the register file. It is to be noted that, in case of overflow, i.e., when the exact integral representation of a double precision floating point number requires more than 64 bits, the result returned is either 0x7FFFFFFFFFFFFFFF (the maximum 64-bit integer), or 0x800000000000000 (the minimum 64-bit integer), depending on the sign of the floating point number. This effect is shown in the following table, where the middle column refers to an infinite integer representation, and the last column refers to the result obtained with FTOI:

Double Integer (infinite bits) Integer (64-bits)
0x43DFFFFFFFFFFFFE 0x..007FFFFFFFFFFFF800 0x7FFFFFFFFFFFF800
0x43DFFFFFFFFFFFFF 0x..007FFFFFFFFFFFFC00 0x7FFFFFFFFFFFFC00
0x43E0000000000000 0x..008000000000000000 0x7FFFFFFFFFFFFFFF
0x43E0000000000001 0x..008000000000000800 0x7FFFFFFFFFFFFFFF
0x43E0000000000001 0x..008000000000000800 0x7FFFFFFFFFFFFFFF
0xC3DFFFFFFFFFFFFE 0x..FF8000000000000800 0x8000000000000800
0xC3DFFFFFFFFFFFFF 0x..FF8000000000000400 0x8000000000000400
0xC3E0000000000000 0x..FF8000000000000000 0x8000000000000000
0xC3E0000000000001 0x..FF7FFFFFFFFFFFF800 0x8000000000000000

Microcode Pattern:

Takes 6 cycles to execute.
    Example: FTOI 0xB 2 0xA

	  
MPC BS3 C3 P3 P2 P1 P0
----------------------
F2I  0   0 00 00 00 0a
 -   0   0 00 00 00 00
 -   0   0 00 00 00 00
 -   0   0 00 00 00 00
 -   0   0 00 00 00 00
 -   2   0 0b 00 00 00

	  
Exceptions :

Configuration Register: 0x30 (CrFiluExc)

[0] 00000000 00000001 AluBadOpL
[1] 00000000 00000002 AluBadOpH
[2] 00000000 00000004 AluDenInL
[3] 00000000 00000008 AluDenInH

Example :

FTOI 0xB 2 0xA
	!! writes the integer representation of the high 
	!! bank of register 0xa into the high bank of 
	!! register 0xb (Note: Bs3 = 2, high)

APE Group Zeuthen. 2003
$Id: ftoi_masm.php,v 1.2 2004/08/04 09:41:07 noe Exp $
$Id: syntax.php,v 1.8 2004/08/04 09:25:34 noe Exp $