|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectHorner
public class Horner
Class used to generate the Horner equations for multiplication expressed in terms of shifts and addes.
Field Summary | |
---|---|
private static int |
GEN_CODE
|
private static int |
GEN_EQU
|
private static int |
GEN_EQU_AND_CODE
|
private int |
numberBits
|
private boolean |
useCSD
|
Constructor Summary | |
---|---|
Horner(int numberBits,
boolean useCSD)
Class constructor |
Method Summary | |
---|---|
private java.lang.String |
determineLastTermOfFraction(boolean guardBit,
boolean signBit)
Determine last term of fractional representation |
void |
displayOutput(double number,
int out)
Generate and display the output for a given number |
private java.lang.String |
generateCode(Holder holder)
Generate the MSP430 code for the multiplier contained in the holder. |
private void |
generateDecimalCode(java.lang.StringBuffer sb,
Holder holder)
Generate the MSP430 code for the decimal portion of the multiplier contained in the holder. |
private void |
generateDecimalEquations(java.lang.StringBuffer sb,
Holder holder)
Generate the Horner equations for decimal portion of the multiplier contained in the holder. |
private java.lang.String |
generateEquations(Holder holder)
Generate the Horner equations for the multiplier contained in the holder. |
private void |
generateFractionCode(java.lang.StringBuffer sb,
Holder holder,
boolean wasDecimalPart)
Generate the MSP430 code for fraction portion of the multiplier contained in the holder. |
private void |
generateFractionEquations(java.lang.StringBuffer sb,
Holder holder,
boolean wasDecimalPart)
Generate the Horner equations for fraction portion of the multiplier contained in the holder. |
static void |
main(java.lang.String[] args)
Main entry point used for testing |
static void |
usage(java.lang.String msg)
Print out a usage string and terminate program operation |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final int GEN_EQU
private static final int GEN_CODE
private static final int GEN_EQU_AND_CODE
private int numberBits
private boolean useCSD
Constructor Detail |
---|
public Horner(int numberBits, boolean useCSD)
useCSD
- should be set true if CSD is to be used as optimization
false if not.Method Detail |
---|
private java.lang.String determineLastTermOfFraction(boolean guardBit, boolean signBit)
guardBit
- the guard bit associated with fractionsignBit
- the sign bit associated with the fraction
private void generateDecimalEquations(java.lang.StringBuffer sb, Holder holder)
sb
- StringBuffer object to generate equations inholder
- Holder object containing a representationprivate void generateFractionEquations(java.lang.StringBuffer sb, Holder holder, boolean wasDecimalPart)
holder
- Holder object containing a representationsb
- StringBuffer object to generate equations inwasDecimalPart
- true if number has a decimal part; false
if number was only fractional part.private void generateDecimalCode(java.lang.StringBuffer sb, Holder holder)
sb
- StringBuffer object to generate code inholder
- Holder object containing a representationprivate void generateFractionCode(java.lang.StringBuffer sb, Holder holder, boolean wasDecimalPart)
holder
- Holder object containing a representationsb
- StringBuffer object to generate equations inwasDecimalPart
- true if number has a decimal part; false
if number was only fractional part.private java.lang.String generateEquations(Holder holder)
holder
- Holder object containing the decimal and fraction
representation of the multiplier
private java.lang.String generateCode(Holder holder)
holder
- Holder object containing the decimal and fraction
representation of the multiplier
public void displayOutput(double number, int out)
number
- multiplier to generate the output forout
- 0 is no output, 1 is code output, 2 is equation output
and 3 is both code and equation output. Code output is for the
MSP430 microcontroller.public static void usage(java.lang.String msg)
public static void main(java.lang.String[] args)
args
- double number to generate outputx for. If no
args are specified canned numbers are used for equation generation.
Numbers and equations are written to stdout.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |