1/*	$OpenBSD: md.h,v 1.7 2003/04/10 17:27:58 mickey Exp $	*/
2/*
3  (c) Copyright 1986 HEWLETT-PACKARD COMPANY
4  To anyone who acknowledges that this file is provided "AS IS"
5  without any express or implied warranty:
6      permission to use, copy, modify, and distribute this file
7  for any purpose is hereby granted without fee, provided that
8  the above copyright notice and this notice appears in all
9  copies, and that the name of Hewlett-Packard Company not be
10  used in advertising or publicity pertaining to distribution
11  of the software without specific, written prior permission.
12  Hewlett-Packard Company makes no representations about the
13  suitability of this software for any purpose.
14*/
15/* @(#)md.h: Revision: 1.8.88.1 Date: 93/12/07 15:06:33 */
16
17#include <sys/cdefs.h>
18
19/*****************************************************************
20 * Muliply/Divide SFU Internal State                             *
21 *****************************************************************/
22struct mdsfu_register {
23    int rslt_hi,
24	rslt_lo,
25	ovflow;
26    };
27
28#define result_hi result->rslt_hi
29#define result_lo result->rslt_lo
30#define overflow result->ovflow
31
32/*
33 *  Constants
34 */
35
36#undef FALSE
37#define FALSE 0
38
39#undef TRUE
40#define TRUE (!FALSE)
41
42#undef NIL
43#define NIL 0
44
45#define WORD_LEN 32
46#define BIT0 1<<31
47#define BIT28 0x8
48#define BIT29 0x4
49#define BIT30 0x2
50#define BIT31 0x1
51
52	/* Simply copy the arguments to the emulated copies of the registers */
53#define	mdrr(reg1,reg2,result)	{result_hi = reg1;result_lo = reg2;}
54
55/*
56 *  Structures
57 */
58
59struct md_state {
60	int resulthi,	/* high word of result */
61	    resultlo;	/* low word of result */
62};
63
64void divsfm(int, int, struct mdsfu_register *);
65void divsfr(int, int, struct mdsfu_register *);
66void divsim(int, int, struct mdsfu_register *);
67void divsir(int, int, struct mdsfu_register *);
68
69void divu(int, int, int, struct mdsfu_register *);
70void divufr(unsigned int, unsigned int, struct mdsfu_register *);
71void divuir(unsigned int, unsigned int, struct mdsfu_register *);
72
73void mpyaccs(int, int, struct mdsfu_register *);
74void mpyaccu(unsigned int, unsigned int, struct mdsfu_register *);
75void mpys(int, int, struct mdsfu_register *);
76void mpyscv(int, int, struct mdsfu_register *);
77void mpyu(unsigned int, unsigned int, struct mdsfu_register *);
78void mpyucv(unsigned int, unsigned int, struct mdsfu_register *);
79
80int s_xmpy(int *, int *, struct mdsfu_register *);
81int u_xmpy(int *, int *, struct mdsfu_register *);
82