Package

chisel3

util

Permalink

package util

The util package provides extensions to core chisel for common hardware components and utility functions.

Linear Supertypes
AnyRef, Any
Content Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. util
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. class Arbiter[T <: Data] extends Module

    Permalink

    Hardware module that is used to sequence n producers into 1 consumer.

    Hardware module that is used to sequence n producers into 1 consumer. Priority is given to lower producer.

    Annotations
    @chiselName()
    Example:
    1. val arb = Module(new Arbiter(2, UInt()))
      arb.io.in(0) <> producer0.io.out
      arb.io.in(1) <> producer1.io.out
      consumer.io.in <> arb.io.out
  2. class ArbiterIO[T <: Data] extends Bundle

    Permalink

    IO bundle definition for an Arbiter, which takes some number of ready-valid inputs and outputs (selects) at most one.

  3. sealed class BitPat extends AnyRef

    Permalink

    Bit patterns are literals with masks, used to represent values with don't care bits.

    Bit patterns are literals with masks, used to represent values with don't care bits. Equality comparisons will ignore don't care bits.

    Example:
    1. "b10101".U === BitPat("b101??") // evaluates to true.B
      "b10111".U === BitPat("b101??") // evaluates to true.B
      "b10001".U === BitPat("b101??") // evaluates to false.B
  4. class Counter extends AnyRef

    Permalink

    A counter module

    A counter module

    Annotations
    @chiselName()
  5. class DecoupledIO[+T <: Data] extends ReadyValidIO[T]

    Permalink

    A concrete subclass of ReadyValidIO signaling that the user expects a "decoupled" interface: 'valid' indicates that the producer has put valid data in 'bits', and 'ready' indicates that the consumer is ready to accept the data this cycle.

    A concrete subclass of ReadyValidIO signaling that the user expects a "decoupled" interface: 'valid' indicates that the producer has put valid data in 'bits', and 'ready' indicates that the consumer is ready to accept the data this cycle. No requirements are placed on the signaling of ready or valid.

  6. trait Enum extends AnyRef

    Permalink
  7. trait HasBlackBoxInline extends BlackBox

    Permalink
  8. trait HasBlackBoxResource extends BlackBox

    Permalink
  9. class IrrevocableIO[+T <: Data] extends ReadyValidIO[T]

    Permalink

    A concrete subclass of ReadyValidIO that promises to not change the value of 'bits' after a cycle where 'valid' is high and 'ready' is low.

    A concrete subclass of ReadyValidIO that promises to not change the value of 'bits' after a cycle where 'valid' is high and 'ready' is low. Additionally, once 'valid' is raised it will never be lowered until after 'ready' has also been raised.

  10. class LockingArbiter[T <: Data] extends LockingArbiterLike[T]

    Permalink
  11. abstract class LockingArbiterLike[T <: Data] extends Module

    Permalink
  12. class LockingRRArbiter[T <: Data] extends LockingArbiterLike[T]

    Permalink
  13. class Pipe[T <: Data] extends Module

    Permalink
  14. class Queue[T <: Data] extends Module

    Permalink

    A hardware module implementing a Queue

    A hardware module implementing a Queue

    Annotations
    @chiselName()
    Example:
    1. val q = Module(new Queue(UInt(), 16))
      q.io.enq <> producer.io.out
      consumer.io.in <> q.io.deq
  15. class QueueIO[T <: Data] extends Bundle

    Permalink

    An I/O Bundle for Queues

  16. class RRArbiter[T <: Data] extends LockingRRArbiter[T]

    Permalink

    Hardware module that is used to sequence n producers into 1 consumer.

    Hardware module that is used to sequence n producers into 1 consumer. Producers are chosen in round robin order.

    Annotations
    @chiselName()
    Example:
    1. val arb = new RRArbiter(2, UInt())
      arb.io.in(0) <> producer0.io.out
      arb.io.in(1) <> producer1.io.out
      consumer.io.in <> arb.io.out
  17. abstract class ReadyValidIO[+T <: Data] extends Bundle

    Permalink

    An I/O Bundle containing 'valid' and 'ready' signals that handshake the transfer of data stored in the 'bits' subfield.

    An I/O Bundle containing 'valid' and 'ready' signals that handshake the transfer of data stored in the 'bits' subfield. The base protocol implied by the directionality is that the producer uses the interface as-is (outputs bits) while the consumer uses the flipped interface (inputs bits). The actual semantics of ready/valid are enforced via the use of concrete subclasses.

  18. class SwitchContext[T <: Bits] extends AnyRef

    Permalink

    Implementation details for switch.

    Implementation details for switch. See switch and is for the user-facing API.

  19. class Valid[+T <: Data] extends Bundle

    Permalink

    An Bundle containing data and a signal determining if it is valid

  20. type ValidIO[+T <: Data] = Valid[T]

    Permalink

    Synonyms, moved from main package object - maintain scope.

Value Members

  1. object BitPat

    Permalink
  2. object Cat

    Permalink

    Concatenates elements of the input, in order, together.

    Concatenates elements of the input, in order, together.

    Example:
    1. Cat("b101".U, "b11".U)  // equivalent to "b101 11".U
      Cat(myUIntWire0, myUIntWire1)
      Cat(Seq("b101".U, "b11".U))  // equivalent to "b101 11".U
      Cat(mySeqOfBits)
  3. object Counter

    Permalink
  4. object Decoupled

    Permalink

    This factory adds a decoupled handshaking protocol to a data bundle.

  5. val DecoupledIO: Decoupled.type

    Permalink
  6. object DeqIO

    Permalink

    Consumer - drives (outputs) ready, inputs valid and bits.

  7. object EnqIO

    Permalink

    Producer - drives (outputs) valid and bits, inputs ready.

  8. object Enum extends Enum

    Permalink
  9. object Fill

    Permalink

    Create repetitions of the input using a tree fanout topology.

    Create repetitions of the input using a tree fanout topology.

    Example:
    1. Fill(2, "b1000".U)  // equivalent to "b1000 1000".U
      Fill(2, "b1001".U)  // equivalent to "b1001 1001".U
      Fill(2, myUIntWire)  // dynamic fill
  10. object FillInterleaved

    Permalink

    Creates repetitions of each bit of the input in order.

    Creates repetitions of each bit of the input in order.

    Example:
    1. FillInterleaved(2, "b1 0 0 0".U)  // equivalent to "b11 00 00 00".U
      FillInterleaved(2, "b1 0 0 1".U)  // equivalent to "b11 00 00 11".U
      FillInterleaved(2, myUIntWire)  // dynamic interleaved fill
      FillInterleaved(2, Seq(true.B, false.B, false.B, false.B))  // equivalent to "b11 00 00 00".U
      FillInterleaved(2, Seq(true.B, false.B, false.B, true.B))  // equivalent to "b11 00 00 11".U
  11. object ImplicitConversions

    Permalink
  12. object Irrevocable

    Permalink

    Factory adds an irrevocable handshaking protocol to a data bundle.

  13. object LFSR16

    Permalink
  14. object ListLookup

    Permalink
  15. object Log2

    Permalink

    Returns the base-2 integer logarithm of an UInt.

    Returns the base-2 integer logarithm of an UInt.

    Example:
    1. Log2(8.U)  // evaluates to 3.U
      Log2(13.U)  // evaluates to 3.U (truncation)
      Log2(myUIntWire)
    Note

    The result is truncated, so e.g. Log2(13.U) === 3.U

  16. object Lookup

    Permalink
  17. object Mux1H

    Permalink

    Builds a Mux tree out of the input signal vector using a one hot encoded select signal.

    Builds a Mux tree out of the input signal vector using a one hot encoded select signal. Returns the output of the Mux tree.

    Note

    results undefined if multiple select signals are simultaneously high

  18. object MuxCase

    Permalink

    Given an association of values to enable signals, returns the first value with an associated high enable signal.

  19. object MuxLookup

    Permalink

    Creates a cascade of n Muxs to search for a key value.

  20. object OHToUInt

    Permalink

    Returns the bit position of the sole high bit of the input bitvector.

    Returns the bit position of the sole high bit of the input bitvector.

    Inverse operation of UIntToOH.

    Note

    assumes exactly one high bit, results undefined otherwise

  21. object Pipe

    Permalink

    A hardware module that delays data coming down the pipeline by the number of cycles set by the latency parameter.

    A hardware module that delays data coming down the pipeline by the number of cycles set by the latency parameter. Functionality is similar to ShiftRegister but this exposes a Pipe interface.

    Example usage: val pipe = new Pipe(UInt()) pipe.io.enq <> produce.io.out consumer.io.in <> pipe.io.deq

  22. object PopCount

    Permalink

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

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

    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
  23. object PriorityEncoder

    Permalink

    Returns the bit position of the least-significant high bit of the input bitvector.

    Returns the bit position of the least-significant high bit of the input bitvector.

    Multiple bits may be high in the input.

  24. object PriorityEncoderOH

    Permalink

    Returns a bit vector in which only the least-significant 1 bit in the input vector, if any, is set.

  25. object PriorityMux

    Permalink

    Builds a Mux tree under the assumption that multiple select signals can be enabled.

    Builds a Mux tree under the assumption that multiple select signals can be enabled. Priority is given to the first select signal.

    Returns the output of the Mux tree.

  26. object Queue

    Permalink

    Factory for a generic hardware queue.

    Factory for a generic hardware queue.

    returns

    output (dequeue) interface from the queue

    Example:
    1. consumer.io.in <> Queue(producer.io.out, 16)
  27. object ReadyValidIO

    Permalink
  28. object RegEnable

    Permalink
  29. object Reverse

    Permalink

    Returns the input in bit-reversed order.

    Returns the input in bit-reversed order. Useful for little/big-endian conversion.

    Example:
    1. Reverse("b1101".U)  // equivalent to "b1011".U
      Reverse("b1101".U(8.W))  // equivalent to "b10110000".U
      Reverse(myUIntWire)  // dynamic reverse
  30. object ShiftRegister

    Permalink
  31. object TransitName

    Permalink

    The purpose of TransitName is to allow a library to 'move' a name call to a more appropriate place.

    The purpose of TransitName is to allow a library to 'move' a name call to a more appropriate place. For example, a library factory function may create a module and return the io. The only user-exposed field is that given IO, which can't use any name supplied by the user. This can add a hook so that the supplied name then names the Module. See Queue companion object for working example

  32. object UIntToOH

    Permalink

    Returns the one hot encoding of the input UInt.

  33. object Valid

    Permalink

    Adds a valid protocol to any interface

  34. val ValidIO: Valid.type

    Permalink
  35. object is

    Permalink

    Use to specify cases in a switch block, equivalent to a when block comparing to the condition variable.

    Use to specify cases in a switch block, equivalent to a when block comparing to the condition variable.

    Note

    dummy implementation, a macro inside switch transforms this into the actual implementation

    ,

    multiple conditions may fire simultaneously

    ,

    illegal outside a switch block

  36. object isPow2

    Permalink

    Check if an Integer is a power of 2

  37. object log2Ceil

    Permalink

    Compute the log2 rounded up

  38. object log2Floor

    Permalink

    Compute the log2 rounded down

  39. object switch

    Permalink

    Conditional logic to form a switch block.

    Conditional logic to form a switch block. See is for the case API.

    Example:
    1. switch (myState) {
        is (state1) {
          // some logic here that runs when myState === state1
        }
        is (state2) {
          // some logic here that runs when myState === state2
        }
      }
  40. object unless

    Permalink

Deprecated Value Members

  1. object log2Down

    Permalink

    Compute the log2 rounded down with min value of 1

    Compute the log2 rounded down with min value of 1

    Annotations
    @deprecated
    Deprecated

    (Since version chisel3) Use log2Floor instead

  2. object log2Up

    Permalink

    Compute the log2 rounded up with min value of 1

    Compute the log2 rounded up with min value of 1

    Annotations
    @deprecated
    Deprecated

    (Since version chisel3) Use log2Ceil instead

Inherited from AnyRef

Inherited from Any

Ungrouped