An interface for a FPU compiled from VHDL
[ipdf/code.git] / src / vfpu.h
1 #ifndef _VFPU_H
2 #define _VFPU_H
3
4 /**
5  * Implements a terrible and hacky interface to use a virtual FPU to do floating point operations
6  */
7
8 namespace VFPU
9 {
10         extern int Start(); // Starts the VFPU
11         extern int Halt(); // Halts the VFPU
12
13 /**
14                 -- 000 = add, 
15                 -- 001 = substract, 
16                 -- 010 = multiply, 
17                 -- 011 = divide,
18                 -- 100 = square root
19                 -- 101 = unused
20                 -- 110 = unused
21                 -- 111 = unused
22  */
23         typedef enum {ADD=0x000, SUB=0x001, MULT=0x010, DIV=0x011, SQRT=0x100} Opcode;
24         typedef float Register;
25         
26         extern Register Exec(const Register & a, const Register & b, Opcode op);
27
28 }
29
30 #endif //_VFPU_H
31
32

UCC git Repository :: git.ucc.asn.au