162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci NetWinder Floating Point Emulator 462306a36Sopenharmony_ci (c) Rebel.com, 1998-1999 562306a36Sopenharmony_ci 662306a36Sopenharmony_ci Direct questions, comments to Scott Bambrough <scottb@netwinder.org> 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci*/ 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci#ifndef __FPSR_H__ 1162306a36Sopenharmony_ci#define __FPSR_H__ 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci/* 1462306a36Sopenharmony_ciThe FPSR is a 32 bit register consisting of 4 parts, each exactly 1562306a36Sopenharmony_cione byte. 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ci SYSTEM ID 1862306a36Sopenharmony_ci EXCEPTION TRAP ENABLE BYTE 1962306a36Sopenharmony_ci SYSTEM CONTROL BYTE 2062306a36Sopenharmony_ci CUMULATIVE EXCEPTION FLAGS BYTE 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ciThe FPCR is a 32 bit register consisting of bit flags. 2362306a36Sopenharmony_ci*/ 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci/* SYSTEM ID 2662306a36Sopenharmony_ci------------ 2762306a36Sopenharmony_ciNote: the system id byte is read only */ 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_citypedef unsigned int FPSR; /* type for floating point status register */ 3062306a36Sopenharmony_citypedef unsigned int FPCR; /* type for floating point control register */ 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ci#define MASK_SYSID 0xff000000 3362306a36Sopenharmony_ci#define BIT_HARDWARE 0x80000000 3462306a36Sopenharmony_ci#define FP_EMULATOR 0x01000000 /* System ID for emulator */ 3562306a36Sopenharmony_ci#define FP_ACCELERATOR 0x81000000 /* System ID for FPA11 */ 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_ci/* EXCEPTION TRAP ENABLE BYTE 3862306a36Sopenharmony_ci----------------------------- */ 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_ci#define MASK_TRAP_ENABLE 0x00ff0000 4162306a36Sopenharmony_ci#define MASK_TRAP_ENABLE_STRICT 0x001f0000 4262306a36Sopenharmony_ci#define BIT_IXE 0x00100000 /* inexact exception enable */ 4362306a36Sopenharmony_ci#define BIT_UFE 0x00080000 /* underflow exception enable */ 4462306a36Sopenharmony_ci#define BIT_OFE 0x00040000 /* overflow exception enable */ 4562306a36Sopenharmony_ci#define BIT_DZE 0x00020000 /* divide by zero exception enable */ 4662306a36Sopenharmony_ci#define BIT_IOE 0x00010000 /* invalid operation exception enable */ 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ci/* SYSTEM CONTROL BYTE 4962306a36Sopenharmony_ci---------------------- */ 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_ci#define MASK_SYSTEM_CONTROL 0x0000ff00 5262306a36Sopenharmony_ci#define MASK_TRAP_STRICT 0x00001f00 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ci#define BIT_AC 0x00001000 /* use alternative C-flag definition 5562306a36Sopenharmony_ci for compares */ 5662306a36Sopenharmony_ci#define BIT_EP 0x00000800 /* use expanded packed decimal format */ 5762306a36Sopenharmony_ci#define BIT_SO 0x00000400 /* select synchronous operation of FPA */ 5862306a36Sopenharmony_ci#define BIT_NE 0x00000200 /* NaN exception bit */ 5962306a36Sopenharmony_ci#define BIT_ND 0x00000100 /* no denormalized numbers bit */ 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ci/* CUMULATIVE EXCEPTION FLAGS BYTE 6262306a36Sopenharmony_ci---------------------------------- */ 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ci#define MASK_EXCEPTION_FLAGS 0x000000ff 6562306a36Sopenharmony_ci#define MASK_EXCEPTION_FLAGS_STRICT 0x0000001f 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_ci#define BIT_IXC 0x00000010 /* inexact exception flag */ 6862306a36Sopenharmony_ci#define BIT_UFC 0x00000008 /* underflow exception flag */ 6962306a36Sopenharmony_ci#define BIT_OFC 0x00000004 /* overfloat exception flag */ 7062306a36Sopenharmony_ci#define BIT_DZC 0x00000002 /* divide by zero exception flag */ 7162306a36Sopenharmony_ci#define BIT_IOC 0x00000001 /* invalid operation exception flag */ 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ci/* Floating Point Control Register 7462306a36Sopenharmony_ci----------------------------------*/ 7562306a36Sopenharmony_ci 7662306a36Sopenharmony_ci#define BIT_RU 0x80000000 /* rounded up bit */ 7762306a36Sopenharmony_ci#define BIT_IE 0x10000000 /* inexact bit */ 7862306a36Sopenharmony_ci#define BIT_MO 0x08000000 /* mantissa overflow bit */ 7962306a36Sopenharmony_ci#define BIT_EO 0x04000000 /* exponent overflow bit */ 8062306a36Sopenharmony_ci#define BIT_SB 0x00000800 /* store bounce */ 8162306a36Sopenharmony_ci#define BIT_AB 0x00000400 /* arithmetic bounce */ 8262306a36Sopenharmony_ci#define BIT_RE 0x00000200 /* rounding exception */ 8362306a36Sopenharmony_ci#define BIT_DA 0x00000100 /* disable FPA */ 8462306a36Sopenharmony_ci 8562306a36Sopenharmony_ci#define MASK_OP 0x00f08010 /* AU operation code */ 8662306a36Sopenharmony_ci#define MASK_PR 0x00080080 /* AU precision */ 8762306a36Sopenharmony_ci#define MASK_S1 0x00070000 /* AU source register 1 */ 8862306a36Sopenharmony_ci#define MASK_S2 0x00000007 /* AU source register 2 */ 8962306a36Sopenharmony_ci#define MASK_DS 0x00007000 /* AU destination register */ 9062306a36Sopenharmony_ci#define MASK_RM 0x00000060 /* AU rounding mode */ 9162306a36Sopenharmony_ci#define MASK_ALU 0x9cfff2ff /* only ALU can write these bits */ 9262306a36Sopenharmony_ci#define MASK_RESET 0x00000d00 /* bits set on reset, all others cleared */ 9362306a36Sopenharmony_ci#define MASK_WFC MASK_RESET 9462306a36Sopenharmony_ci#define MASK_RFC ~MASK_RESET 9562306a36Sopenharmony_ci 9662306a36Sopenharmony_ci#endif 97