byucc.jhdl.Logic.Modules.FloatingPoint.helpers
Class JHDLFloatingPoint

java.lang.Object
  extended byjava.lang.Number
      extended bybyucc.jhdl.Logic.Modules.FloatingPoint.helpers.FloatingPoint
          extended bybyucc.jhdl.Logic.Modules.FloatingPoint.helpers.JHDLFloatingPoint
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class JHDLFloatingPoint
extends FloatingPoint

Extends Nathan K's FloatingPoint class to support initialization and output to/from BVs.

Author:
Eric Roesler
See Also:
Serialized Form

Field Summary
 
Fields inherited from class byucc.jhdl.Logic.Modules.FloatingPoint.helpers.FloatingPoint
isInfinite, isNaN
 
Constructor Summary
protected JHDLFloatingPoint(double dval, java.lang.Object objval, int numExponentBits, int numMantissaBits)
           
 
Method Summary
 JHDLFloatingPoint add(JHDLFloatingPoint val)
           
 BV BVValue()
           
static JHDLFloatingPoint create(BV sign, BV exponent, BV mantissa)
           
static JHDLFloatingPoint create(BV bv, int exponent_width)
           
static FloatingPoint create(double val, int numExponentBits, int numMantissaBits)
          Constructs a FloatingPoint with the specified numbers of bits.
static JHDLFloatingPoint create(int exponent_width, int mantissa_width, java.util.Random random)
           
static JHDLFloatingPoint createOne(int exponent_width, int mantissa_width)
           
static JHDLFloatingPoint createZero(int exponent_width, int mantissa_width)
           
 JHDLFloatingPoint divide(JHDLFloatingPoint val)
           
 int exponent()
           
protected  int generateExponentBias(int exponent_width)
           
protected  void handleOverflow()
          Handles the condition where the exponent is greater than the number of exponent bits can represent.
protected  void handleUnderflow()
          Handles the condition where the exponent is less than the number of exponent bits can represent.
 java.math.BigInteger mantissa()
           
 JHDLFloatingPoint multiply(JHDLFloatingPoint val)
           
 boolean overflowOccurred()
           
 JHDLFloatingPoint subtract(JHDLFloatingPoint val)
           
 boolean underflowOccurred()
           
 
Methods inherited from class byucc.jhdl.Logic.Modules.FloatingPoint.helpers.FloatingPoint
abs, add, clone, compareTo_g, compareTo_l, compareTo, create, create, create, create, create, create, create, create, create, create, create, create, create, divide, doubleValue, equals, floatValue, getExponent, getNumExponentBits, getNumMantissaBits, getSign, getSignificand, intValue, isInfinite, isNaN, longValue, multiply, negate, remainder, signum, subtract, toBigDecimal, toBinaryString, toString
 
Methods inherited from class java.lang.Number
byteValue, shortValue
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JHDLFloatingPoint

protected JHDLFloatingPoint(double dval,
                            java.lang.Object objval,
                            int numExponentBits,
                            int numMantissaBits)
Method Detail

createZero

public static JHDLFloatingPoint createZero(int exponent_width,
                                           int mantissa_width)

createOne

public static JHDLFloatingPoint createOne(int exponent_width,
                                          int mantissa_width)

create

public static JHDLFloatingPoint create(int exponent_width,
                                       int mantissa_width,
                                       java.util.Random random)

create

public static JHDLFloatingPoint create(BV bv,
                                       int exponent_width)

create

public static JHDLFloatingPoint create(BV sign,
                                       BV exponent,
                                       BV mantissa)

create

public static FloatingPoint create(double val,
                                   int numExponentBits,
                                   int numMantissaBits)
Description copied from class: FloatingPoint
Constructs a FloatingPoint with the specified numbers of bits. Similar to the double-to-float narrowing primitive conversion defined in The Java Language Specification: if val has too great a magnitude to represent with the specified number of bits in the exponent, the FloatingPoint represents positive or negative infinity instead. If the number of bits in the mantissa cannot represent val exactly, rounding is performed according to the round-toward-nearest-even mode as specified in the IEEE 754 standard.


BVValue

public BV BVValue()

add

public JHDLFloatingPoint add(JHDLFloatingPoint val)

subtract

public JHDLFloatingPoint subtract(JHDLFloatingPoint val)

multiply

public JHDLFloatingPoint multiply(JHDLFloatingPoint val)

divide

public JHDLFloatingPoint divide(JHDLFloatingPoint val)

generateExponentBias

protected int generateExponentBias(int exponent_width)

exponent

public int exponent()

mantissa

public java.math.BigInteger mantissa()

handleOverflow

protected void handleOverflow()
Description copied from class: FloatingPoint
Handles the condition where the exponent is greater than the number of exponent bits can represent. This implementation sets the fields to represent infinity. The sign field is not changed.

Overrides:
handleOverflow in class FloatingPoint

handleUnderflow

protected void handleUnderflow()
Description copied from class: FloatingPoint
Handles the condition where the exponent is less than the number of exponent bits can represent. This implementation sets the fields to represent zero. The sign field is not changed.

Overrides:
handleUnderflow in class FloatingPoint

overflowOccurred

public boolean overflowOccurred()

underflowOccurred

public boolean underflowOccurred()


Copyright ? 2006 Brigham Young University, Configurable Computing Laboratory. All Rights Reserved.