fsr.h revision 1.1
11.1Seeh/*	$NetBSD: fsr.h,v 1.1 1998/06/20 04:58:51 eeh Exp $ */
21.1Seeh
31.1Seeh/*
41.1Seeh * Copyright (c) 1992, 1993
51.1Seeh *	The Regents of the University of California.  All rights reserved.
61.1Seeh *
71.1Seeh * This software was developed by the Computer Systems Engineering group
81.1Seeh * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
91.1Seeh * contributed to Berkeley.
101.1Seeh *
111.1Seeh * All advertising materials mentioning features or use of this software
121.1Seeh * must display the following acknowledgement:
131.1Seeh *	This product includes software developed by the University of
141.1Seeh *	California, Lawrence Berkeley Laboratory.
151.1Seeh *
161.1Seeh * Redistribution and use in source and binary forms, with or without
171.1Seeh * modification, are permitted provided that the following conditions
181.1Seeh * are met:
191.1Seeh * 1. Redistributions of source code must retain the above copyright
201.1Seeh *    notice, this list of conditions and the following disclaimer.
211.1Seeh * 2. Redistributions in binary form must reproduce the above copyright
221.1Seeh *    notice, this list of conditions and the following disclaimer in the
231.1Seeh *    documentation and/or other materials provided with the distribution.
241.1Seeh * 3. All advertising materials mentioning features or use of this software
251.1Seeh *    must display the following acknowledgement:
261.1Seeh *	This product includes software developed by the University of
271.1Seeh *	California, Berkeley and its contributors.
281.1Seeh * 4. Neither the name of the University nor the names of its contributors
291.1Seeh *    may be used to endorse or promote products derived from this software
301.1Seeh *    without specific prior written permission.
311.1Seeh *
321.1Seeh * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
331.1Seeh * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
341.1Seeh * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
351.1Seeh * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
361.1Seeh * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
371.1Seeh * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
381.1Seeh * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
391.1Seeh * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
401.1Seeh * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
411.1Seeh * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
421.1Seeh * SUCH DAMAGE.
431.1Seeh *
441.1Seeh *	@(#)fsr.h	8.1 (Berkeley) 6/11/93
451.1Seeh */
461.1Seeh
471.1Seeh#ifndef _MACHINE_FSR_H_
481.1Seeh#define	_MACHINE_FSR_H_
491.1Seeh
501.1Seeh/*
511.1Seeh * Bits in FPRS
521.1Seeh */
531.1Seeh#define FPRS_FEF	0x04		/* Enable FP -- must be set to enable FP regs */
541.1Seeh#define FPRS_DU		0x02		/* Dirty upper -- upper fp regs are dirty */
551.1Seeh#define FPRS_DL		0x01		/* Dirty lower -- lower fp regs are dirty */
561.1Seeh
571.1Seeh/*
581.1Seeh * Bits in FSR.
591.1Seeh */
601.1Seeh
611.1Seeh#define	FSR_RD		0xc0000000	/* rounding direction */
621.1Seeh#define	  FSR_RD_RN	0		/* round to nearest */
631.1Seeh#define	  FSR_RD_RZ	1		/* round towards 0 */
641.1Seeh#define	  FSR_RD_RP	2		/* round towards +inf */
651.1Seeh#define	  FSR_RD_RM	3		/* round towards -inf */
661.1Seeh#define	FSR_RD_SHIFT	30
671.1Seeh#define	FSR_RD_MASK	0x03
681.1Seeh
691.1Seeh#define	FSR_RP		0x30000000	/* extended rounding precision */
701.1Seeh#define	  FSR_RP_X	0		/* extended stays extended */
711.1Seeh#define	  FSR_RP_S	1		/* extended => single */
721.1Seeh#define	  FSR_RP_D	2		/* extended => double */
731.1Seeh#define	  FSR_RP_80	3		/* extended => 80-bit */
741.1Seeh#define	FSR_RP_SHIFT	28
751.1Seeh#define	FSR_RP_MASK	0x03
761.1Seeh
771.1Seeh#define	FSR_TEM		0x0f800000	/* trap enable mask */
781.1Seeh#define	FSR_TEM_SHIFT	23
791.1Seeh#define	FSR_TEM_MASK	0x1f
801.1Seeh
811.1Seeh#define	FSR_NS		0x00400000	/* ``nonstandard mode'' */
821.1Seeh#define	FSR_AU		0x00400000	/* aka abrupt underflow mode */
831.1Seeh#define	FSR_MBZ		0x00300000	/* reserved; must be zero */
841.1Seeh
851.1Seeh#define	FSR_VER		0x000e0000	/* version bits */
861.1Seeh#define	FSR_VER_SHIFT	17
871.1Seeh#define	FSR_VER_MASK	0x07
881.1Seeh
891.1Seeh#define	FSR_FTT		0x0001c000	/* FP trap type */
901.1Seeh#define	  FSR_TT_NONE	0		/* no trap */
911.1Seeh#define	  FSR_TT_IEEE	1		/* IEEE exception */
921.1Seeh#define	  FSR_TT_UNFIN	2		/* unfinished operation */
931.1Seeh#define	  FSR_TT_UNIMP	3		/* unimplemented operation */
941.1Seeh#define	  FSR_TT_SEQ	4		/* sequence error */
951.1Seeh#define	  FSR_TT_HWERR	5		/* hardware error (unrecoverable) */
961.1Seeh#define	FSR_FTT_SHIFT	14
971.1Seeh#define	FSR_FTT_MASK	0x03
981.1Seeh
991.1Seeh#define	FSR_QNE		0x00002000	/* queue not empty */
1001.1Seeh#define	FSR_PR		0x00001000	/* partial result */
1011.1Seeh
1021.1Seeh#define	FSR_FCC		0x00000c00	/* FP condition codes */
1031.1Seeh#define	  FSR_CC_EQ	0		/* f1 = f2 */
1041.1Seeh#define	  FSR_CC_LT	1		/* f1 < f2 */
1051.1Seeh#define	  FSR_CC_GT	2		/* f1 > f2 */
1061.1Seeh#define	  FSR_CC_UO	3		/* (f1,f2) unordered */
1071.1Seeh#define	FSR_FCC_SHIFT	10
1081.1Seeh#define	FSR_FCC_MASK	0x03
1091.1Seeh
1101.1Seeh#define	FSR_AX	0x000003e0		/* accrued exceptions */
1111.1Seeh#define	  FSR_AX_SHIFT	5
1121.1Seeh#define	  FSR_AX_MASK	0x1f
1131.1Seeh#define	FSR_CX	0x0000001f		/* current exceptions */
1141.1Seeh#define	  FSR_CX_SHIFT	0
1151.1Seeh#define	  FSR_CX_MASK	0x1f
1161.1Seeh
1171.1Seeh/* These are the 3 new v9 fcc's */
1181.1Seeh#define	FSR_FCC3	0x06000000000	/* FP condition codes */
1191.1Seeh#define	FSR_FCC3_SHIFT	36
1201.1Seeh
1211.1Seeh#define	FSR_FCC2	0x0c00000000	/* FP condition codes */
1221.1Seeh#define	FSR_FCC2_SHIFT	34
1231.1Seeh
1241.1Seeh#define	FSR_FCC1	0x0600000000	/* FP condition codes */
1251.1Seeh#define	FSR_FCC1_SHIFT	32
1261.1Seeh
1271.1Seeh
1281.1Seeh/* The following exceptions apply to TEM, AX, and CX. */
1291.1Seeh#define	FSR_NV	0x10			/* invalid operand */
1301.1Seeh#define	FSR_OF	0x08			/* overflow */
1311.1Seeh#define	FSR_UF	0x04			/* underflow */
1321.1Seeh#define	FSR_DZ	0x02			/* division by zero */
1331.1Seeh#define	FSR_NX	0x01			/* inexact result */
1341.1Seeh
1351.1Seeh#endif /* _MACHINE_FSR_H_ */
136