md.h revision 1.1.4.2 1 /* $NetBSD: md.h,v 1.1.4.2 2002/07/14 17:47:45 gehenna Exp $ */
2
3 /* $OpenBSD: md.h,v 1.4 2001/03/29 03:58:18 mickey Exp $ */
4
5 /*
6 * Copyright 1996 1995 by Open Software Foundation, Inc.
7 * All Rights Reserved
8 *
9 * Permission to use, copy, modify, and distribute this software and
10 * its documentation for any purpose and without fee is hereby granted,
11 * provided that the above copyright notice appears in all copies and
12 * that both the copyright notice and this permission notice appear in
13 * supporting documentation.
14 *
15 * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
17 * FOR A PARTICULAR PURPOSE.
18 *
19 * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
20 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
21 * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
22 * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
23 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
24 *
25 */
26 /*
27 * pmk1.1
28 */
29 /*
30 * (c) Copyright 1986 HEWLETT-PACKARD COMPANY
31 *
32 * To anyone who acknowledges that this file is provided "AS IS"
33 * without any express or implied warranty:
34 * permission to use, copy, modify, and distribute this file
35 * for any purpose is hereby granted without fee, provided that
36 * the above copyright notice and this notice appears in all
37 * copies, and that the name of Hewlett-Packard Company not be
38 * used in advertising or publicity pertaining to distribution
39 * of the software without specific, written prior permission.
40 * Hewlett-Packard Company makes no representations about the
41 * suitability of this software for any purpose.
42 */
43
44 #include <sys/cdefs.h>
45
46 /*****************************************************************
47 * Muliply/Divide SFU Internal State *
48 *****************************************************************/
49 struct mdsfu_register {
50 int rslt_hi,
51 rslt_lo,
52 ovflow;
53 };
54
55 #define result_hi result->rslt_hi
56 #define result_lo result->rslt_lo
57 #define overflow result->ovflow
58
59 /*
60 * Constants
61 */
62
63 #undef FALSE
64 #define FALSE 0
65
66 #undef TRUE
67 #define TRUE (!FALSE)
68
69 #undef NIL
70 #define NIL 0
71
72 #define WORD_LEN 32
73 #define BIT0 1<<31
74 #define BIT28 0x8
75 #define BIT29 0x4
76 #define BIT30 0x2
77 #define BIT31 0x1
78
79 /* Simply copy the arguments to the emulated copies of the registers */
80 #define mdrr(reg1,reg2,result) {result_hi = reg1;result_lo = reg2;}
81
82 /*
83 * Structures
84 */
85
86 struct md_state {
87 int resulthi, /* high word of result */
88 resultlo; /* low word of result */
89 };
90
91 void divsfm __P((int, int, struct mdsfu_register *));
92 void divsfr __P((int, int, struct mdsfu_register *));
93 void divsim __P((int, int, struct mdsfu_register *));
94 void divsir __P((int, int, struct mdsfu_register *));
95
96 void divu __P((int, int, int, struct mdsfu_register *));
97 void divufr __P((unsigned int, unsigned int, struct mdsfu_register *));
98 void divuir __P((unsigned int, unsigned int, struct mdsfu_register *));
99
100 void mpyaccs __P((int, int, struct mdsfu_register *));
101 void mpyaccu __P((unsigned int, unsigned int, struct mdsfu_register *));
102 void mpys __P((int, int, struct mdsfu_register *));
103 void mpyscv __P((int, int, struct mdsfu_register *));
104 void mpyu __P((unsigned int, unsigned int, struct mdsfu_register *));
105 void mpyucv __P((unsigned int, unsigned int, struct mdsfu_register *));
106
107 int impys __P((int *, int *, struct mdsfu_register *));
108 int impyu __P((int *, int *, struct mdsfu_register *));
109