All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class byucc.jhdl.modgen.Sub

java.lang.Object
   |
   +----byucc.jhdl.base.Nameable
           |
           +----byucc.jhdl.base.Node
                   |
                   +----byucc.jhdl.base.Cell
                           |
                           +----byucc.jhdl.base.Structural
                                   |
                                   +----byucc.jhdl.Logic.Logic
                                           |
                                           +----byucc.jhdl.modgen.Sub

public class Sub
extends Logic

General Description

Sub creates an subtraction unit with generic length operands. The subtraction unit can optionally be registered, have carry in, or have carry out. All of the cells are RLOCd for precise placement. Users can instruct the module generator to place the cells along even bit boundaries or odd.

Implementation

All Technologies

The inputs a,b and output s must be the same wordsize.
If a carry in signal is supplied, 0 = borrow, 1 = no carry.

Pipelining

Pipelining is enabled by setting the registered parameter true.

The registers in the pipe can be stalled using a clk_en signal. clk_en can be passed in null for a perpetually enabled design. An exception will be thrown if clk_en is present when the module is unregistered.

Xilinx XC4000

Selecting bit alignment

Xilinx 4k parts require a CLB to initialize the carry chain. ODD_ALIGNED Sub units perform the calculation of the first bit of the sum in this initialization CLB (odd numbered bits are calculated in the F-LUTS), while EVEN_ALIGNED Sub units only initialize the carry chain in the first CLB.

Calculating module size

To find the CLB count for an Sub unit, take the wordsize of the operands and divide by two and add one. If the unit is EVEN_ALIGNED, also add the remainder

Author:
Jeremy Anderson

Variable Index

 o cell_interface
 o cellname
 o EVEN_ALIGNED
constants to determine placement information EVEN_ALIGNED subtracters begin the carry chain with a FORCE.
 o ODD_ALIGNED

Constructor Index

 o Sub(Node, int, boolean, Wire, Wire, Wire, Wire, Wire, Wire)
Constructor for Sub unit

Method Index

 o cellInterfaceDeterminesUniqueNetlistStructure()
 o clock()
 o compute(int, int, int, int)
Compute implements the behavior of the Sub for behavioral modelling of the circuit
 o defaultSimulationModelIsBehavioral()
The default simulation model is behavioral
 o getCellName()
 o propagate()
 o reset()

Variables

 o EVEN_ALIGNED
 public static final int EVEN_ALIGNED
constants to determine placement information EVEN_ALIGNED subtracters begin the carry chain with a FORCE. Even numbered bit subs occur on the bottom CLB boundary. ODD_ALIGNED subtracters perform the lsb sub in the bottom CLB. Odd numbered bit subs occur on the bottom CLB boundary.

 o ODD_ALIGNED
 public static final int ODD_ALIGNED
 o cell_interface
 public static CellInterface cell_interface[]
 o cellname
 public static final String cellname

Constructors

 o Sub
 public Sub(Node parent,
            int alignment,
            boolean registered,
            Wire clk_en,
            Wire cin,
            Wire a,
            Wire b,
            Wire s,
            Wire cout)
Constructor for Sub unit

Parameters:
parent - Parent of this circuit
alignment - EVEN_ALIGNED or ODD_ALIGNED
registered - True for output registers, false for no registers
clk_en - Clock enable wire
cin - Carry in wire. Null for no carry in.
a - A operand
b - B operand
s - Result wire.
cout - Carry out wire. Null for no carry out.

Methods

 o getCellName
 public String getCellName()
Overrides:
getCellName in class Cell
 o cellInterfaceDeterminesUniqueNetlistStructure
 public boolean cellInterfaceDeterminesUniqueNetlistStructure()
Overrides:
cellInterfaceDeterminesUniqueNetlistStructure in class Cell
 o defaultSimulationModelIsBehavioral
 protected boolean defaultSimulationModelIsBehavioral()
The default simulation model is behavioral

Overrides:
defaultSimulationModelIsBehavioral in class Structural
 o compute
 public static int[] compute(int width,
                             int cin,
                             int a,
                             int b)
Compute implements the behavior of the Sub for behavioral modelling of the circuit

Parameters:
width - Wordsize of the Sub
cin - carry in to the Sub
a - a input.
b - b input.
Returns:
Array of integers containing the sum and carryout of the Sub
 o propagate
 public void propagate()
Overrides:
propagate in class Structural
 o clock
 public void clock()
Overrides:
clock in class Structural
 o reset
 public void reset()
Overrides:
reset in class Structural

All Packages  Class Hierarchy  This Package  Previous  Next  Index