18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci NetWinder Floating Point Emulator 48c2ecf20Sopenharmony_ci (c) Rebel.com, 1998-1999 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci Direct questions, comments to Scott Bambrough <scottb@netwinder.org> 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci*/ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#ifndef __FPSR_H__ 118c2ecf20Sopenharmony_ci#define __FPSR_H__ 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci/* 148c2ecf20Sopenharmony_ciThe FPSR is a 32 bit register consisting of 4 parts, each exactly 158c2ecf20Sopenharmony_cione byte. 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci SYSTEM ID 188c2ecf20Sopenharmony_ci EXCEPTION TRAP ENABLE BYTE 198c2ecf20Sopenharmony_ci SYSTEM CONTROL BYTE 208c2ecf20Sopenharmony_ci CUMULATIVE EXCEPTION FLAGS BYTE 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ciThe FPCR is a 32 bit register consisting of bit flags. 238c2ecf20Sopenharmony_ci*/ 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci/* SYSTEM ID 268c2ecf20Sopenharmony_ci------------ 278c2ecf20Sopenharmony_ciNote: the system id byte is read only */ 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_citypedef unsigned int FPSR; /* type for floating point status register */ 308c2ecf20Sopenharmony_citypedef unsigned int FPCR; /* type for floating point control register */ 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci#define MASK_SYSID 0xff000000 338c2ecf20Sopenharmony_ci#define BIT_HARDWARE 0x80000000 348c2ecf20Sopenharmony_ci#define FP_EMULATOR 0x01000000 /* System ID for emulator */ 358c2ecf20Sopenharmony_ci#define FP_ACCELERATOR 0x81000000 /* System ID for FPA11 */ 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci/* EXCEPTION TRAP ENABLE BYTE 388c2ecf20Sopenharmony_ci----------------------------- */ 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci#define MASK_TRAP_ENABLE 0x00ff0000 418c2ecf20Sopenharmony_ci#define MASK_TRAP_ENABLE_STRICT 0x001f0000 428c2ecf20Sopenharmony_ci#define BIT_IXE 0x00100000 /* inexact exception enable */ 438c2ecf20Sopenharmony_ci#define BIT_UFE 0x00080000 /* underflow exception enable */ 448c2ecf20Sopenharmony_ci#define BIT_OFE 0x00040000 /* overflow exception enable */ 458c2ecf20Sopenharmony_ci#define BIT_DZE 0x00020000 /* divide by zero exception enable */ 468c2ecf20Sopenharmony_ci#define BIT_IOE 0x00010000 /* invalid operation exception enable */ 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci/* SYSTEM CONTROL BYTE 498c2ecf20Sopenharmony_ci---------------------- */ 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci#define MASK_SYSTEM_CONTROL 0x0000ff00 528c2ecf20Sopenharmony_ci#define MASK_TRAP_STRICT 0x00001f00 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci#define BIT_AC 0x00001000 /* use alternative C-flag definition 558c2ecf20Sopenharmony_ci for compares */ 568c2ecf20Sopenharmony_ci#define BIT_EP 0x00000800 /* use expanded packed decimal format */ 578c2ecf20Sopenharmony_ci#define BIT_SO 0x00000400 /* select synchronous operation of FPA */ 588c2ecf20Sopenharmony_ci#define BIT_NE 0x00000200 /* NaN exception bit */ 598c2ecf20Sopenharmony_ci#define BIT_ND 0x00000100 /* no denormalized numbers bit */ 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ci/* CUMULATIVE EXCEPTION FLAGS BYTE 628c2ecf20Sopenharmony_ci---------------------------------- */ 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci#define MASK_EXCEPTION_FLAGS 0x000000ff 658c2ecf20Sopenharmony_ci#define MASK_EXCEPTION_FLAGS_STRICT 0x0000001f 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci#define BIT_IXC 0x00000010 /* inexact exception flag */ 688c2ecf20Sopenharmony_ci#define BIT_UFC 0x00000008 /* underflow exception flag */ 698c2ecf20Sopenharmony_ci#define BIT_OFC 0x00000004 /* overfloat exception flag */ 708c2ecf20Sopenharmony_ci#define BIT_DZC 0x00000002 /* divide by zero exception flag */ 718c2ecf20Sopenharmony_ci#define BIT_IOC 0x00000001 /* invalid operation exception flag */ 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci/* Floating Point Control Register 748c2ecf20Sopenharmony_ci----------------------------------*/ 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci#define BIT_RU 0x80000000 /* rounded up bit */ 778c2ecf20Sopenharmony_ci#define BIT_IE 0x10000000 /* inexact bit */ 788c2ecf20Sopenharmony_ci#define BIT_MO 0x08000000 /* mantissa overflow bit */ 798c2ecf20Sopenharmony_ci#define BIT_EO 0x04000000 /* exponent overflow bit */ 808c2ecf20Sopenharmony_ci#define BIT_SB 0x00000800 /* store bounce */ 818c2ecf20Sopenharmony_ci#define BIT_AB 0x00000400 /* arithmetic bounce */ 828c2ecf20Sopenharmony_ci#define BIT_RE 0x00000200 /* rounding exception */ 838c2ecf20Sopenharmony_ci#define BIT_DA 0x00000100 /* disable FPA */ 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ci#define MASK_OP 0x00f08010 /* AU operation code */ 868c2ecf20Sopenharmony_ci#define MASK_PR 0x00080080 /* AU precision */ 878c2ecf20Sopenharmony_ci#define MASK_S1 0x00070000 /* AU source register 1 */ 888c2ecf20Sopenharmony_ci#define MASK_S2 0x00000007 /* AU source register 2 */ 898c2ecf20Sopenharmony_ci#define MASK_DS 0x00007000 /* AU destination register */ 908c2ecf20Sopenharmony_ci#define MASK_RM 0x00000060 /* AU rounding mode */ 918c2ecf20Sopenharmony_ci#define MASK_ALU 0x9cfff2ff /* only ALU can write these bits */ 928c2ecf20Sopenharmony_ci#define MASK_RESET 0x00000d00 /* bits set on reset, all others cleared */ 938c2ecf20Sopenharmony_ci#define MASK_WFC MASK_RESET 948c2ecf20Sopenharmony_ci#define MASK_RFC ~MASK_RESET 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_ci#endif 97