Back Source Testbench

package work.Generic_Adder

This package provides a generic binary adder.

The rest of the package contains implementation details of the CIAdd procedure. It is subject to change, and therefore currently undocumented. Please refer to the source code of CIAdd for details.

Building other adder-based circuits

In order to build a subtractor, you can exploit one of the formulae:

  A - B = A + ¬B + 1
  A - B = ¬(¬A + B)

An incrementer or decrementer is better built using functions from package work.Bit_Manipulation:

  function incr (A : in std_ulogic_vector) return std_ulogic_vector is
  begin
    return A xor lshift(cascade_and(A), 1, '1');
  end incr;

  function decr (A : in std_ulogic_vector) return std_ulogic_vector is
  begin
    return not incr(not A);
  end decr;

A negation can be done with Y := incr(not A);.


Copyright (C) 2002 Michael Riepe