Floating-Point Instruction - Hitachi SH7750 Programming Manual

High-performance risc engine superh (sh) 32-bit risc mcu/mpu series
Hide thumbs Also See for SH7750:
Table of Contents

Advertisement

10.46
FTRC
Conversion
to Integer
PR
Format
0
FTRC FRm,FPUL
1
FTRC DRm,FPUL
Description
When FPSCR.PR = 0: Converts the single-precision floating-point number in FRm to a 32-bit
integer, and stores the result in FPUL.
When FPSCR.PR = 1: Converts the double-precision floating-point number in FRm to a 32-bit
integer, and stores the result in FPUL.
The rounding mode is always truncation.
Operation
#define N_INT_SINGLE_RANGE 0xcf000000 & 0x7fffffff
#define P_INT_SINGLE_RANGE 0x4effffff
#define N_INT_DOUBLE_RANGE 0xc1e0000000200000 & 0x7fffffffffffffff
#define P_INT_DOUBLE_RANGE 0x41e0000000000000
void FTRC(int m, int *FPUL)
{
pc += 2;
clear_cause();
if(FPSCR.PR==0){
case(ftrc_single_ type_of(m)){
NORM:
PINF:
NINF:
}
}
else{
case(ftrc_double_type_of(m)){
Floating-point TRuncate
and Convert to integer
Summary of Operation Instruction Code
(long)FRm → FPUL
(long)DRm → FPUL
*FPUL = FR[m];
ftrc_invalid(0);
ftrc_invalid(1);
/* case FPSCR.PR=1 */

Floating-Point Instruction

1111mmmm00111101 1
1111mmm000111101 2
/* -1.000000 * 2^31 */
/* 1.fffffe * 2^30 */
break;
break;
break;
Rev. 2.0, 03/99, page 289 of 396
Execution
States
T Bit

Advertisement

Table of Contents
loading

Table of Contents