All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class byucc.jhdl.modgen.accum

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.accum

public class accum
extends Logic

General Description

Accumulator that allows a generic sized input and output.

Accum takes in a generic-sized input, either adds or subtracts it to the current contents of the accumulator, and outputs the result. The output wire width must be at least as wide as the input wire width. If the result is too large to fit onto the output wire (overflow occurs), the result is simply truncated. All state changes occur on the rising edge. See the table below to understand how it works:
 
Clk_En
Clear
AddSub
Outnext
0
don't care
don't care
Out
1
1
1
In
1
1
0
-In
1
0
1
Out + In
1
0
0
Out - In

 

Implementation

All Technologies

The input is sign extended to match the output size. Thus, the input and output need not be the same width.

Xilinx XC4000

CLB count:

# of CLBs = width of the output wire + 1.

CLB placement:

The CLBs are arranged in two equally sized columns, unless there is an odd number of CLBs, in which case the right column has one more CLB on the bottom.

Author:
Tim Wheeler

Variable Index

 o cell_interface

Constructor Index

 o accum(Node, Wire, Wire, Wire, Wire, Wire)

Method Index

 o clock()
Clock is used in the behavioral model and is called once per clock cycle
 o compute(int, int, int, int, int)
Used in behavioral model to compute the output
 o defaultSimulationModelIsBehavioral()
Default simulation model is behavioral
 o propagate()
Propagate isn't used in this class
 o reset()
Resets the output to zero

Variables

 o cell_interface
 public static CellInterface cell_interface[]

Constructors

 o accum
 public accum(Node parent,
              Wire in,
              Wire clear,
              Wire adsub,
              Wire clk_en,
              Wire out)
Parameters:
parent - Parent of the class (this)
in - Input to the accumulator
clear - When clear is asserted, out = +/-in
adsub - 1=add the input; 0=subtract the input
clk_en - When low, the output doesn't change
out - Output of the accumulator

Methods

 o reset
 public void reset()
Resets the output to zero

Overrides:
reset in class Structural
 o clock
 public void clock()
Clock is used in the behavioral model and is called once per clock cycle

Overrides:
clock in class Structural
 o propagate
 public void propagate()
Propagate isn't used in this class

Overrides:
propagate in class Structural
 o defaultSimulationModelIsBehavioral
 protected boolean defaultSimulationModelIsBehavioral()
Default simulation model is behavioral

Overrides:
defaultSimulationModelIsBehavioral in class Structural
 o compute
 public int compute(int in,
                    int inWidth,
                    int clear,
                    int adsub,
                    int outWidth)
Used in behavioral model to compute the output

Parameters:
in - input
inWidth - width to treat the input signal input
clear - when asserted, out = +/-in
adsub - 1=add the input; 0=subtract the input
outWidth - width of the output
Returns:
The sign extended output of size outWidth

All Packages  Class Hierarchy  This Package  Previous  Next  Index