Packages

o

chisel3.util

PopCount

object PopCount extends PopCountObjIntf

Returns the number of bits set (value is 1 or true) in the input signal.

Source
Bitwise.scala
Example:
  1. PopCount(Seq(true.B, false.B, true.B, true.B))  // evaluates to 3.U
    PopCount(Seq(false.B, false.B, true.B, false.B))  // evaluates to 1.U
    
    PopCount("b1011".U)  // evaluates to 3.U
    PopCount("b0010".U)  // evaluates to 1.U
    PopCount(myUIntWire)  // dynamic count
Linear Supertypes
PopCountObjIntf, AnyRef, Any
Ordering
  1. Grouped
  2. Alphabetic
  3. By Inheritance
Inherited
  1. PopCount
  2. PopCountObjIntf
  3. AnyRef
  4. 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 _applyImpl(in: Bits)(implicit sourceInfo: SourceInfo): UInt
    Attributes
    protected
  5. def _applyImpl(in: Iterable[Bool])(implicit sourceInfo: SourceInfo): UInt
    Attributes
    protected
  6. macro def apply(in: Bits): UInt
    Definition Classes
    PopCountObjIntf
  7. macro def apply(in: Iterable[Bool]): UInt
    Definition Classes
    PopCountObjIntf
  8. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  9. def atLeast(n: Int, x: Iterable[Bool])(implicit sourceInfo: SourceInfo): Bool

    Implements PopCount(x)>=n with less deep circuitry in case n=0,1,2,x.width-1,x.width

    Implements PopCount(x)>=n with less deep circuitry in case n=0,1,2,x.width-1,x.width

    n

    Int Static value that PopCount(x) is compared against

    x

    Seq/Vec of Bool to PopCount

    returns

    true.B when x has n or more bits set

  10. def atLeast(n: Int, x: UInt)(implicit sourceInfo: SourceInfo): Bool

    Implements PopCount(x)>=n with less deep circuitry in case n=0,1,2,x.width-1,x.width

    Implements PopCount(x)>=n with less deep circuitry in case n=0,1,2,x.width-1,x.width

    n

    Int Static value that PopCount(x) is compared against

    x

    UInt to PopCount

    returns

    true.B when x has n or more bits set

  11. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  12. def do_apply(in: Bits)(implicit sourceInfo: SourceInfo): UInt

    Definition Classes
    PopCountObjIntf
  13. def do_apply(in: Iterable[Bool])(implicit sourceInfo: SourceInfo): UInt

    Definition Classes
    PopCountObjIntf
  14. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  15. def equalTo(n: Int, x: Iterable[Bool])(implicit sourceInfo: SourceInfo): Bool

    Implements PopCount(x)==n with less deep circuitry in case n=0,1,x.width-1,x.width

    Implements PopCount(x)==n with less deep circuitry in case n=0,1,x.width-1,x.width

    n

    Int Static value that PopCount(x) is compared against

    x

    Seq/Vec of Bool to PopCount

    returns

    true.B when x has exactly n bits set

  16. def equalTo(n: Int, x: UInt)(implicit sourceInfo: SourceInfo): Bool

    Implements PopCount(x)==n with less deep circuitry in case n=0,1,x.width-1,x.width

    Implements PopCount(x)==n with less deep circuitry in case n=0,1,x.width-1,x.width

    n

    Int Static value that PopCount(x) is compared against

    x

    UInt to PopCount

    returns

    true.B when x has exactly n bits set

  17. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  18. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  19. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  20. def greaterThan(n: Int, x: Iterable[Bool])(implicit sourceInfo: SourceInfo): Bool

    Implements PopCount(x)>n with less deep circuitry in case n=0,1,x.width-1

    Implements PopCount(x)>n with less deep circuitry in case n=0,1,x.width-1

    n

    Int Static value that PopCount(x) is compared against

    x

    Seq/Vec of Bool to PopCount

    returns

    true.B when x has more than n bits set

  21. def greaterThan(n: Int, x: UInt)(implicit sourceInfo: SourceInfo): Bool

    Implements PopCount(x)>n with less deep circuitry in case n=0,1,x.width-1

    Implements PopCount(x)>n with less deep circuitry in case n=0,1,x.width-1

    n

    Int Static value that PopCount(x) is compared against

    x

    UInt to PopCount

    returns

    true.B when x has more than n bits set

  22. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  23. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  24. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  25. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  26. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  27. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  28. def toString(): String
    Definition Classes
    AnyRef → Any
  29. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  30. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  31. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from PopCountObjIntf

Inherited from AnyRef

Inherited from Any

SourceInfoTransformMacro

Ungrouped