Packages

o

chisel3.util

CarrySaveAdder

object CarrySaveAdder

Carry-save adder circuit generation functions. Constructs a tree to reduce an arbitrary number of input terms to two terms.

Example resulting circuit topology if applied to 8 4-bit-wide terms, a...h:

Rank 1: create groups of 3 terms, reducing each group to 2 terms; i,j,k,l,g,h
     GROUP0    GROUP1   GROUP2
       aaaa      dddd     gggg
       bbbb      eeee     hhhh
       cccc      ffff
      _____+    _____+   _____+
       iiii      kkkk     gggg
      jjjj.     llll.     hhhh
Rank 2: create groups of 3 terms, reducing each group to 2 terms: m,n,o,p
     GROUP0    GROUP1
       iiii    llll.
      jjjj.     gggg
       kkkk     hhhh
     ______+  ______+
      mmmmm    ooooo
      nnnn.    pppp.
Rank 3: create groups of 3 terms, reducing each group to 2 terms: q,r,p
     GROUP0   GROUP1
      mmmmm    pppp.
      nnnn.
      ooooo
     ______+  ______+
      qqqqq    pppp.
     rrrrr.
Rank 4: reduce last group of 3 terms to 2 terms: s,t
      qqqqq
     rrrrr.
      pppp.
     ______+
     ssssss
     tttt..

Every . is an empty spot introduced by the topology, constant zero in the carry LSB. If the input has single-bit terms, insert those there. In the example tree above, there are six spots where we can insert a single-bit term: j,l,n,p,r,t

Future improvement suggestion (not implemented yet):

  • Add support for negative weights at arbitrary bit positions; required to support subtraction.
  • The circuitry then returns two UInt hardware terms; final addition includes a signed constant offset.
Source
CircuitMath.scala
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. CarrySaveAdder
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def apply(terms: Seq[UInt], bit: Bool, moreBits: Bool*)(implicit sourceInfo: SourceInfo): UInt

    Adds the arbitrary-length sequence of UInts in an area- and timing-efficient way, by using a Carry-Save Adder tree.

    Adds the arbitrary-length sequence of UInts in an area- and timing-efficient way, by using a Carry-Save Adder tree. The elements from the bits parameter are inserted in the holes at the LSB positions in the tree, without adding logic depth. If more bits are offered than holes are available, elaboration fails.

  5. def apply(terms: Seq[UInt], bit: Bool)(implicit sourceInfo: SourceInfo): UInt

    Adds the arbitrary-length sequence of UInts in an area- and timing-efficient way, by using a Carry-Save Adder tree.

    Adds the arbitrary-length sequence of UInts in an area- and timing-efficient way, by using a Carry-Save Adder tree. Inserts an additional bit in the LSB bit position, without adding logic depth. If less than three terms are provided, there is no hole for the addtional bit, and elaboration fails.

  6. def apply(firstTerm: UInt, moreTerms: UInt*)(implicit sourceInfo: SourceInfo): UInt

    Adds an arbitrary number of UInts in an area- and timing-efficient way, by using a Carry-Save Adder tree.

  7. def apply(terms: Seq[UInt])(implicit sourceInfo: SourceInfo): UInt

    Adds the arbitrary-length sequence of UInts in an area- and timing-efficient way, by using a Carry-Save Adder tree.

  8. def apply(terms: Seq[UInt], bits: Seq[Bool])(implicit sourceInfo: SourceInfo): UInt

    Adds an arbitrary-length sequence of UInts in an area- and timing-efficient way, by using a Carry-Save Adder tree.

    Adds an arbitrary-length sequence of UInts in an area- and timing-efficient way, by using a Carry-Save Adder tree. The elements from the bits parameter are inserted in the holes at the LSB positions in the tree, without adding logic depth. If more bits are offered than holes are available, elaboration fails.

  9. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  10. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  11. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  13. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  14. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  15. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  16. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  17. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  19. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  20. def sumCarry(terms: Seq[UInt], bit: Bool, moreBits: Bool*)(implicit sourceInfo: SourceInfo): (UInt, UInt)

    Adds the arbitrary-length sequence of UInts in an area- and timing-efficient way, by using a Carry-Save Adder tree.

    Adds the arbitrary-length sequence of UInts in an area- and timing-efficient way, by using a Carry-Save Adder tree. The elements from the bits parameter are inserted in the holes at the LSB positions in the tree, without adding logic depth. If more bits are offered than holes are available, elaboration fails. Returns the sum in redundant format as sum/carry tuple.

  21. def sumCarry(terms: Seq[UInt], bit: Bool)(implicit sourceInfo: SourceInfo): (UInt, UInt)

    Adds the arbitrary-length sequence of UInts in an area- and timing-efficient way, by using a Carry-Save Adder tree.

    Adds the arbitrary-length sequence of UInts in an area- and timing-efficient way, by using a Carry-Save Adder tree. Inserts an additional bit in the LSB bit position, without adding logic depth. If less than three terms are provided, there is no hole for the addtional bit, and elaboration fails. Returns the sum in redundant format as sum/carry tuple.

  22. def sumCarry(firstTerm: UInt, moreTerms: UInt*)(implicit sourceInfo: SourceInfo): (UInt, UInt)

    Adds an arbitrary number of UInts in an area- and timing-efficient way, by using a Carry-Save Adder tree.

    Adds an arbitrary number of UInts in an area- and timing-efficient way, by using a Carry-Save Adder tree. Returns the sum in redundant format as sum/carry tuple.

  23. def sumCarry(terms: Seq[UInt])(implicit sourceInfo: SourceInfo): (UInt, UInt)

    Adds the arbitrary-length sequence of UInts in an area- and timing-efficient way, by using a Carry-Save Adder tree.

    Adds the arbitrary-length sequence of UInts in an area- and timing-efficient way, by using a Carry-Save Adder tree. Returns the sum in redundant format as sum/carry tuple.

  24. def sumCarry(terms: Seq[UInt], bits: Seq[Bool])(implicit sourceInfo: SourceInfo): (UInt, UInt)

    Adds the arbitrary-length sequence of UInts in an area- and timing-efficient way, by using a Carry-Save Adder tree.

    Adds the arbitrary-length sequence of UInts in an area- and timing-efficient way, by using a Carry-Save Adder tree. The elements from the bits parameter are inserted in the holes at the LSB positions in the tree, without adding logic depth. If more bits are offered than holes are available, elaboration fails. Returns the sum in redundant format as sum/carry tuple.

  25. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  26. def toString(): String
    Definition Classes
    AnyRef → Any
  27. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  28. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  29. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped