X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Fvfpu.h;h=12ac9bc389ffc0126ea668fc15c296a32d62a40f;hp=da130a4de174cf8b92b4a35bd82d9ebedf3dd967;hb=eff96d65bd1101083e04cb3ff2468b3feea3ff9e;hpb=1bab8e093f47967dc28a5a10030972407d7d0675 diff --git a/src/vfpu.h b/src/vfpu.h index da130a4..12ac9bc 100644 --- a/src/vfpu.h +++ b/src/vfpu.h @@ -5,9 +5,11 @@ * Implements a terrible and hacky interface to use a virtual FPU to do floating point operations */ +#include + namespace VFPU { - extern int Start(); // Starts the VFPU + extern int Start(const char * vcd_output = NULL); // Starts the VFPU extern int Halt(); // Halts the VFPU /** @@ -21,10 +23,11 @@ namespace VFPU -- 111 = unused */ typedef enum {ADD=0x000, SUB=0x001, MULT=0x010, DIV=0x011, SQRT=0x100} Opcode; - typedef float Register; + typedef enum {EVEN=0x00, ZERO=0x01, UP=0x10, DOWN=0x11} Rmode; + typedef std::bitset<32> Register; - extern Register Exec(const Register & a, const Register & b, Opcode op); - + extern Register Exec(const Register & a, const Register & b, Opcode op, Rmode rmode = EVEN); // operate with registers + extern float Exec(float a, float b, Opcode op, Rmode rmode = EVEN); //converts floats into registers and back } #endif //_VFPU_H