X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Fvfpu.h;h=d77c1e330383d2082118d8aed94256e2ebb8b9f3;hp=c489e89a05141896ad844f493e35da6bdc602b82;hb=6ad7fc3c833837713405b64a50e62dd128cb7a30;hpb=79d61ba24ac2d29cea6e7f1fee2f83705c5fb4ac diff --git a/src/vfpu.h b/src/vfpu.h index c489e89..d77c1e3 100644 --- a/src/vfpu.h +++ b/src/vfpu.h @@ -1,32 +1,21 @@ -#ifndef _VFPU_H -#define _VFPU_H - /** - * Implements a terrible and hacky interface to use a virtual FPU to do floating point operations + * @file vfpu.h + * @brief Implements a terrible and hacky interface to use a virtual FPU to do floating point operations */ -#include +#ifndef _VFPU_H +#define _VFPU_H +#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 - -/** - -- 000 = add, - -- 001 = substract, - -- 010 = multiply, - -- 011 = divide, - -- 100 = square root - -- 101 = unused - -- 110 = unused - -- 111 = unused - */ typedef enum {ADD=0x000, SUB=0x001, MULT=0x010, DIV=0x011, SQRT=0x100} Opcode; + typedef enum {EVEN=0x00, ZERO=0x01, UP=0x10, DOWN=0x11} Rmode; // Rounding mode; to even, towards zero, always up, always down typedef std::bitset<32> Register; - - extern Register Exec(const Register & a, const Register & b, Opcode op); // operate with registers - extern float Exec(float a, float b, Opcode op); //converts floats into registers and back + 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