c489e89a05141896ad844f493e35da6bdc602b82
[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 #include <bitset>
9
10 namespace VFPU
11 {
12         extern int Start(); // Starts the VFPU
13         extern int Halt(); // Halts the VFPU
14
15 /**
16                 -- 000 = add, 
17                 -- 001 = substract, 
18                 -- 010 = multiply, 
19                 -- 011 = divide,
20                 -- 100 = square root
21                 -- 101 = unused
22                 -- 110 = unused
23                 -- 111 = unused
24  */
25         typedef enum {ADD=0x000, SUB=0x001, MULT=0x010, DIV=0x011, SQRT=0x100} Opcode;
26         typedef std::bitset<32> Register;
27         
28         extern Register Exec(const Register & a, const Register & b, Opcode op); // operate with registers
29         extern float Exec(float a, float b, Opcode op); //converts floats into registers and back
30 }
31
32 #endif //_VFPU_H
33
34

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