|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectbyucc.jhdl.base.Nameable
byucc.jhdl.base.Node
byucc.jhdl.base.Cell
byucc.jhdl.base.Structural
byucc.jhdl.Logic.LogicGates
byucc.jhdl.Logic.LogicStatic
byucc.jhdl.Logic.Logic
byucc.jhdl.Logic.Modules.IntDivide
Variable width integer divider with the option of signed or unsigned multiply and generic pipeline depth. This is a variable width integer divider based on a non-restoring division algorithm that can be pipelined. The divider can produce both a quotient and remainder or a rounded quotient. It can perform unsigned or signed division.

As seen in the diagram, the divider will calculate the integer quotient and remainder by dividing the dividend value by the divisor value. The clock enable input allows the pipeline to be stalled. The divideByZero output will detect invalid results caused by the divisor value being zero.
The easiest way to instance the IntDivide
is by using static method calls in the
DIVIDERS class.
If desired, however, the constructor calls
may be made explicitly, as shown below.
First, you must import the Logic.Modules package:
import byucc.jhdl.Logic.Modules.;
To instance a standard IntDivide, the following constructor would be used:
new IntDivide(parent, dividend, divisor, null, quotient, remainder, divideByZero, false, false, 0, "name");
Note: If there is no pipelining (pipedepth = 0), the enable signal
will not be used and should be passed as null.
To instance a signed, enabled, and pipelined IntDivide with
pipedepth 3, the constructor would be:
new IntDivide(parent, dividend, divisor, en, quotient, null, divideByZero, true, true, 3, "name");
Note: For Rounded dividers, a null must be passed for the remainder wire.
For all available constructors, see
Constructor Summary or
Constructor Detail.
The dividend, divisor, quotient and remainder wires are all
generic widths with restrictions. Generic width implies that
the module will query the width of these input wires and
construct itself accordingly.
However, there are certain restrictions on the relationships
between the wire widths.
These restrictions are shown in
the table below for both the non-rounded quotient and rounded
quotient configurations of the divider. To obtain all possible
bits of a quotient, its width must be the same as the dividend
width. If the quotient width is less than the dividend width, the
most significant bits are truncated from the quotient
without overflow checking.
In the table below, when a wire is indicated as not
required this means that a null can be passed into
the wire's parameter if the functionality of this signal is not
desired (note that if a null is passed in for a
wire, optimization is performed, see the
Logic Optimization section below for more explanation).
| Wire | Width | Width Restrictions | Required Wire? |
| dividend | dvdWidth | 2<= dvdWidth* | Required |
| divisor | dvrWidth | 2<= dvrWidth<= dvdWidth | Required |
| en | enWidth | enWidth=1 | Not Required** |
| quotient | qWidth | 2<= qWidth<= dvdWidth | Not Required*** |
| remainder | remWidth | remWidth= dvrWidth | Not Required*** |
| divideByZero | divBy0Width | divBy0Width=1 | Not Required |
| Wire | Width | Width Restrictions | Required Wire? |
| dividend | dvdWidth | 2<= dvdWidth* | Required |
| divisor | dvrWidth | 2<= dvrWidth<= dvdWidth | Required |
| en | enWidth | enWidth=1 | Not Required** |
| quotient | qWidth | 2<= qWidth<= dvdWidth | Required |
| remainder | N/A | N/A | Must be null |
| divideByZero | divBy0Width | divBy0Width=1 | Not Required |
* Although these widths should be valid structurally for widths greater than 64 bits, the maximum bit width that the behavioral model is valid for is 63 bits.
** Note that if your divider is purely combinational (the
pipedepth parameter into your constructor is zero), the en
wire must be null.
*** For the non-rounding quotient case, although the quotient
and remainder wire can be individually null they
cannot both be null at the same time (in other
words, you must have a useful output).
numOfStages method or using the method
getNumOfStages once a divider is instantiated.
pipedepth parameter of this divider does NOT represent
the latency of the divider but the frequency of a pipeline register.
pipedepth=0 means fully-combinational divider
pipedepth=1 means fully-pipelined divider
(one pipeline register per logic stage).
pipedepth=2 means place a pipeline register every
other stage
pipedepth=3 means place a pipeline register every
third stage
latency method or by using the
getLatency method once a divider has been constructed.
| Unsigned/Signed Divider | Sign of Dividend | Round Up or Down (Magnitude) | Examples |
| Unsigned | N/A | Round Up | 3/6= 1 |
| Signed | Positive | Round Up | 3/6= 1, 3/-6= -1 |
| Signed | Negative | Round Down | -3/6= 0, -3/-6= 0 |
If any of the wire parameters that can be null
are null, logic will not be built for any wires or
structure corresponding to these inputs or outputs. Therefore
if the functionality of a signal is not desired it is always
best to pass a null in for that wire's parameter.
For example, passing a null in for the remainder
output wire will tell the module not to construct the remainder
correcting hardware. On the other hand, leaving the output
hanging by using the Logic method call nc(divisorWidth) will
cause the remainder logic to be built although it is left
unconnected (because nc() returns a wire and the module doesn't
know the difference between that wire and a connected output
wire). Likewise if one passes a null in for the
en input wire no en net will be not be connected. In
contrast, tying the en input high with the Logic class
method call vcc() will cause the clock enable net to be hooked
up to every flip-flop -- although it's obvious that the en signal
is not really used in this case.
| Field Summary | |
static CellInterface[] |
cell_interface
Standard JHDL CellInterface. |
static int |
DIVIDE_BY_ZERO_INDEX
For indexing divide_by_zero value in the 3 element array compute() returns |
static int |
QUOTIENT_INDEX
For indexing the quotient in the 3 element array compute() returns |
static int |
REMAINDER_INDEX
For indexing the remainder in the 3 element array compute() returns |
| Fields inherited from class byucc.jhdl.Logic.Logic |
ABOVE, ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_LEFT, ALIGN_LSB, ALIGN_MSB, ALIGN_RIGHT, ALIGN_TOP, BELOW, DOWN, EAST_OF, LEFT_OF, MAX_PACK, NORTH_OF, ON, ONTOP, ONTOP_OF, RIGHT_OF, SOUTH_OF, TOLEFT, TORIGHT, UNCONSTRAINED, UP, WEST_OF |
| Fields inherited from class byucc.jhdl.Logic.LogicGates |
tech_mapper |
| Constructor Summary | |
IntDivide(Node parent,
Wire dividend,
Wire divisor,
Wire en,
Wire quotient,
Wire remainder,
Wire divideByZero,
boolean signed,
boolean roundQuotient,
int pipedepth)
Integer divider constructor without a user-defined instance name. |
|
IntDivide(Node parent,
Wire dividend,
Wire divisor,
Wire en,
Wire quotient,
Wire remainder,
Wire divideByZero,
boolean signed,
boolean roundQuotient,
int pipedepth,
java.lang.String instanceName)
Integer divider constructor whose last parameter is a user-defined instance name. |
|
| Method Summary | |
boolean |
cellInterfaceDeterminesUniqueNetlistStructure()
Method to indicate that the netlister can assume that the wires and the bound parameters in the cell interface uniquely determine a cell structure. |
void |
clock()
Clock method is used for behavioral pipelined similuation. |
static long[] |
compute(BV dividendBV,
BV divisorBV,
int quotientWidth,
boolean remainderFlag,
boolean divideByZeroFlag,
boolean signed,
boolean roundQuotient)
Computes all outputs of the divider using BVs. |
static long[] |
compute(long dividend,
int dvdWidth,
long divisor,
int dvrWidth,
int quotientWidth,
boolean remainderFlag,
boolean divideByZeroFlag,
boolean signed,
boolean roundQuotient)
Compute method that calculates a mathematically accurate calculation of all the outputs of the divider and returns them as a long array of 3 elements. |
static long |
computeQuotient(long dividend,
int dvdWidth,
long divisor,
int dvrWidth,
int quotientWidth,
boolean signed,
boolean roundQuotient)
ComputeQuotient method that calculates a mathematically accurate calculation of the quotient the divider would produce out for the given parameters. |
static long |
computeRemainder(java.math.BigInteger dividend,
java.math.BigInteger divisor)
Computes remainder for behavioral model, using BVs / BigIntegers |
static long |
computeRemainder(long dividend,
int dvdWidth,
long divisor,
int dvrWidth,
boolean signed)
ComputeRemainder method provides the correct remainder value that the structural model would generate given the input parameters. |
int |
getLatency()
Method to get the latency of a divider that is already constructed. |
int |
getNumOfStages()
Method to get the number of logic stages of a divider that is already constructed. |
void |
initUserDefinedNode(UserDefinedNode udn)
init method needed for UserDefinedSchematic interface. |
static int |
latency(int dividendWidth,
int quotientWidth,
boolean remainderFlag,
boolean signed,
boolean roundQuotient,
int pipedepth)
The latency method gives the latency in clock cycles of the module with the given input parameters. |
static int |
numOfStages(int dividendWidth,
int quotientWidth,
boolean remainderFlag,
boolean signed,
boolean roundQuotient)
Method that calculates the number of pipelinable logic stages (most stages consist of addsub units). |
void |
paint(UserDefinedNode udn)
paint method for UserDefinedSchematic interface. |
void |
propagate()
Propagate method for combinational behavioral simulation (no registers). |
void |
reset()
Reset method puts zeros on quotient, remainder and divideByZero outputs and clears behavioral delay arrays. |
| Methods inherited from class byucc.jhdl.base.Node |
addObservable, addSimulatorCallback, checkAll, delete, getBuildingFlag, getChildren, getChildrenEnumeration, getInstanceName, getParent, getParentCell, getRelatives, getSystem, getWires, optimize, orphanAllowed, printAllChildren, printTree, removeSimulatorCallback, setDefaultClock |
| Methods inherited from class byucc.jhdl.base.Nameable |
caseSensitivity, caseSensitivity, disableNameClashChecking, getFullName, getFullNameNoTestBench, getHierNameNoTestBench, getInstanceNo, getInstanceNumber, getLeafName, getLeafName, getRelativeName, getUserName, getUserName, hasUserSpecifiedName, isDescendantOf, setInstanceNumber |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static CellInterface[] cell_interface
public static final int QUOTIENT_INDEX
public static final int REMAINDER_INDEX
public static final int DIVIDE_BY_ZERO_INDEX
| Constructor Detail |
public IntDivide(Node parent,
Wire dividend,
Wire divisor,
Wire en,
Wire quotient,
Wire remainder,
Wire divideByZero,
boolean signed,
boolean roundQuotient,
int pipedepth)
IntDivideException - Thrown when any of the parameters are
invalid (as described above in the parameter
description).
public IntDivide(Node parent,
Wire dividend,
Wire divisor,
Wire en,
Wire quotient,
Wire remainder,
Wire divideByZero,
boolean signed,
boolean roundQuotient,
int pipedepth,
java.lang.String instanceName)
IntDivideException - Thrown when any of the parameters are
invalid (as described above in the parameter description).| Method Detail |
public boolean cellInterfaceDeterminesUniqueNetlistStructure()
cellInterfaceDeterminesUniqueNetlistStructure in class Cellpublic void initUserDefinedNode(UserDefinedNode udn)
initUserDefinedNode in interface UserDefinedSchematicpublic void paint(UserDefinedNode udn)
paint in interface UserDefinedSchematic
public static int latency(int dividendWidth,
int quotientWidth,
boolean remainderFlag,
boolean signed,
boolean roundQuotient,
int pipedepth)
public int getLatency()
public static int numOfStages(int dividendWidth,
int quotientWidth,
boolean remainderFlag,
boolean signed,
boolean roundQuotient)
public int getNumOfStages()
public void reset()
reset in interface Clockablereset in class Structuralpublic void clock()
clock in interface Clockableclock in class Structuralpublic void propagate()
propagate in interface byucc.jhdl.base.Propagateablepropagate in class Structural
public static long[] compute(long dividend,
int dvdWidth,
long divisor,
int dvrWidth,
int quotientWidth,
boolean remainderFlag,
boolean divideByZeroFlag,
boolean signed,
boolean roundQuotient)
public static long computeQuotient(long dividend,
int dvdWidth,
long divisor,
int dvrWidth,
int quotientWidth,
boolean signed,
boolean roundQuotient)
public static long computeRemainder(long dividend,
int dvdWidth,
long divisor,
int dvrWidth,
boolean signed)
public static long[] compute(BV dividendBV,
BV divisorBV,
int quotientWidth,
boolean remainderFlag,
boolean divideByZeroFlag,
boolean signed,
boolean roundQuotient)
public static long computeRemainder(java.math.BigInteger dividend,
java.math.BigInteger divisor)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||