chisel3.util
Members list
Type members
Classlikes
Hardware module that is used to sequence n producers into 1 consumer. Priority is given to lower producer.
Hardware module that is used to sequence n producers into 1 consumer. Priority is given to lower producer.
Value parameters
- gen
-
data type
- n
-
number of inputs
Attributes
- Example
-
val arb = Module(new Arbiter(UInt(), 2)) arb.io.in(0) <> producer0.io.out arb.io.in(1) <> producer1.io.out consumer.io.in <> arb.io.out - Source
- Arbiter.scala
- Supertypes
-
class Moduletrait ImplicitResettrait ImplicitClockclass RawModuleclass BaseModuletrait Selectabletrait Selectabletrait IsInstantiabletrait InstanceIdclass Objecttrait Matchableclass AnyShow all
IO bundle definition for an Arbiter, which takes some number of ready-valid inputs and outputs (selects) at most one.
IO bundle definition for an Arbiter, which takes some number of ready-valid inputs and outputs (selects) at most one.
Value parameters
- gen
-
data type
- n
-
number of inputs
Attributes
- Source
- Arbiter.scala
- Supertypes
-
class Bundleclass Recordtrait Selectabletrait Aggregateclass Datatrait InstanceIdclass Objecttrait Matchableclass AnyShow all
Attributes
- Source
- GrayCode.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
BinaryToGray.type
Attributes
- Companion
- class
- Source
- BitPat.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
BitPat.type
Attributes
- Companion
- object
- Source
- BitPat.scala
- Supertypes
Concatenates elements of the input, in order, together.
Concatenates elements of the input, in order, together.
Attributes
Used to generate an inline (logic directly in the containing Module, no internal Module is created) hardware counter.
Used to generate an inline (logic directly in the containing Module, no internal Module is created) hardware counter.
Typically instantiated with apply methods in object Counter
Does not create a new Chisel Module
Attributes
- Example
-
val countOn = true.B // increment counter every clock cycle val (counterValue, counterWrap) = Counter(countOn, 4) when (counterValue === 3.U) { ... }// Using Scala Range API val (counterValue, counterWrap) = Counter(0 until 10 by 2) when (counterValue === 4.U) { ... } - Companion
- object
- Source
- Counter.scala
- Supertypes
Attributes
- Companion
- class
- Source
- Counter.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Counter.type
This factory adds a decoupled handshaking protocol to a data bundle.
This factory adds a decoupled handshaking protocol to a data bundle.
Attributes
- Source
- Decoupled.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Decoupled.type
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.
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.
Value parameters
- gen
-
the type of data to be wrapped in DecoupledIO
Attributes
- Source
- Decoupled.scala
- Supertypes
-
class ReadyValidIO[T]class Bundleclass Recordtrait Selectabletrait Aggregateclass Datatrait InstanceIdclass Objecttrait Matchableclass AnyShow all
Consumer - drives (outputs) ready, inputs valid and bits.
Consumer - drives (outputs) ready, inputs valid and bits.
Value parameters
- gen
-
The type of data to dequeue
Attributes
- Source
- Decoupled.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
DeqIO.type
Producer - drives (outputs) valid and bits, inputs ready.
Producer - drives (outputs) valid and bits, inputs ready.
Value parameters
- gen
-
The type of data to enqueue
Attributes
- Source
- Decoupled.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
EnqIO.type
Defines a set of unique UInt constants
Defines a set of unique UInt constants
Unpack with a list to specify an enumeration. Usually used with switch to describe a finite state machine.
Attributes
- Example
-
val state_on :: state_off :: Nil = Enum(2) val current_state = WireDefault(state_off) switch (current_state) { is (state_on) { ... } is (state_off) { ... } } - Companion
- object
- Source
- Enum.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
object Enum
Attributes
- Companion
- trait
- Source
- Enum.scala
- Supertypes
- Self type
-
Enum.type
Create repetitions of the input using a tree fanout topology.
Create repetitions of the input using a tree fanout topology.
Attributes
- Example
-
Fill(2, "b1000".U) // equivalent to "b1000 1000".U Fill(2, "b1001".U) // equivalent to "b1001 1001".U Fill(2, myUIntWire) // dynamic fill - Source
- Bitwise.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Fill.type
Creates repetitions of each bit of the input in order.
Creates repetitions of each bit of the input in order.
Attributes
- Example
-
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(false.B, false.B, false.B, true.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 - Source
- Bitwise.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
FillInterleaved.type
Attributes
- Source
- GrayCode.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
GrayToBinary.type
Implicit conversions to automatically convert scala.Boolean and scala.Int to Bool and UInt respectively
Implicit conversions to automatically convert scala.Boolean and scala.Int to Bool and UInt respectively
Attributes
- Source
- ImplicitConversions.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ImplicitConversions.type
Factory adds an irrevocable handshaking protocol to a data bundle.
Factory adds an irrevocable handshaking protocol to a data bundle.
Attributes
- Source
- Irrevocable.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Irrevocable.type
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.
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.
Value parameters
- gen
-
the type of data to be wrapped in IrrevocableIO
Attributes
- Source
- Irrevocable.scala
- Supertypes
-
class ReadyValidIO[T]class Bundleclass Recordtrait Selectabletrait Aggregateclass Datatrait InstanceIdclass Objecttrait Matchableclass AnyShow all
For each element in a list, muxes (looks up) between cases (one per list element) based on a common address.
For each element in a list, muxes (looks up) between cases (one per list element) based on a common address.
Value parameters
- addr
-
common select for cases, shared (same) across all list elements
- default
-
default value for each list element, should the address not match any case
- mapping
-
list of cases, where each entry consists of a BitPath (compared against addr) and a list of elements (same length as default) that is the output value for that element (will have the same index in the output).
Attributes
- Note
-
This appears to be an odd, specialized operator that we haven't seen used much, and seems to be a holdover from chisel2. This may be deprecated and removed, usage is not recommended.
- Example
-
ListLookup(2.U, // address for comparison List(10.U, 11.U, 12.U), // default "row" if none of the following cases match Array(BitPat(2.U) -> List(20.U, 21.U, 22.U), // this "row" hardware-selected based off address 2.U BitPat(3.U) -> List(30.U, 31.U, 32.U)) ) // hardware-evaluates to List(20.U, 21.U, 22.U) // Note: if given address 0.U, the above would hardware evaluate to List(10.U, 11.U, 12.U) - Source
- Lookup.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ListLookup.type
Attributes
- Source
- Arbiter.scala
- Supertypes
-
class LockingArbiterLike[T]class Moduletrait ImplicitResettrait ImplicitClockclass RawModuleclass BaseModuletrait Selectabletrait Selectabletrait IsInstantiabletrait InstanceIdclass Objecttrait Matchableclass AnyShow all
Attributes
- Source
- Arbiter.scala
- Supertypes
-
class Moduletrait ImplicitResettrait ImplicitClockclass RawModuleclass BaseModuletrait Selectabletrait Selectabletrait IsInstantiabletrait InstanceIdclass Objecttrait Matchableclass AnyShow all
- Known subtypes
Attributes
- Source
- Arbiter.scala
- Supertypes
-
class LockingArbiterLike[T]class Moduletrait ImplicitResettrait ImplicitClockclass RawModuleclass BaseModuletrait Selectabletrait Selectabletrait IsInstantiabletrait InstanceIdclass Objecttrait Matchableclass AnyShow all
- Known subtypes
-
class RRArbiter[T]
Returns the base-2 integer logarithm of an UInt.
Returns the base-2 integer logarithm of an UInt.
Attributes
- Note
-
The result is truncated, so e.g. Log2(13.U) === 3.U
- Example
-
Log2(8.U) // evaluates to 3.U Log2(13.U) // evaluates to 3.U (truncation) Log2(myUIntWire) - Source
- CircuitMath.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Log2.type
Muxes between cases based on whether an address matches any pattern for a case. Similar to MuxLookup, but uses BitPat for address comparison.
Muxes between cases based on whether an address matches any pattern for a case. Similar to MuxLookup, but uses BitPat for address comparison.
Value parameters
- addr
-
address to select between cases
- default
-
default value should the address not match any case
- mapping
-
list of cases, where each entry consists of a BitPat (compared against addr) and the output value if the BitPat matches
Attributes
- Note
-
This appears to be an odd, specialized operator that we haven't seen used much, and seems to be a holdover from chisel2. This may be deprecated and removed, usage is not recommended.
- Source
- Lookup.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Lookup.type
Create a MixedVec type, given element types. Inputs must be Chisel types which have no value (not hardware types).
Create a MixedVec type, given element types. Inputs must be Chisel types which have no value (not hardware types).
Attributes
- Returns
-
MixedVec with the given types.
- Companion
- class
- Source
- MixedVec.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
MixedVec.type
A hardware array of elements that can hold values of different types/widths, unlike Vec which can only hold elements of the same type/width.
A hardware array of elements that can hold values of different types/widths, unlike Vec which can only hold elements of the same type/width.
Value parameters
- eltsIn
-
Element types. Must be Chisel types.
Attributes
- Example
-
val v = Wire(MixedVec(Seq(UInt(8.W), UInt(16.W), UInt(32.W)))) v(0) := 100.U(8.W) v(1) := 10000.U(16.W) v(2) := 101.U(32.W) - Companion
- object
- Source
- MixedVec.scala
- Supertypes
-
trait IndexedSeq[T]trait IndexedSeqOps[T, IndexedSeq, IndexedSeq[T]]trait IndexedSeq[T]trait IndexedSeqOps[T, IndexedSeq, IndexedSeq[T]]trait Seq[T]trait SeqOps[T, IndexedSeq, IndexedSeq[T]]trait Seq[T]trait Equalstrait SeqOps[T, IndexedSeq, IndexedSeq[T]]trait PartialFunction[Int, T]trait Int => Ttrait Iterable[T]trait Iterable[T]trait IterableFactoryDefaults[T, IndexedSeq]trait IterableOps[T, IndexedSeq, IndexedSeq[T]]trait IterableOnceOps[T, IndexedSeq, IndexedSeq[T]]trait IterableOnce[T]class Recordtrait Selectabletrait Aggregateclass Datatrait InstanceIdclass Objecttrait Matchableclass AnyShow all
Create a MixedVec wire with default values as specified, and type of each element inferred from those default values.
Create a MixedVec wire with default values as specified, and type of each element inferred from those default values.
This is analogous to VecInit.
Attributes
- Returns
-
MixedVec with given values assigned
- Example
-
MixedVecInit(Seq(100.U(8.W), 10000.U(16.W), 101.U(32.W))) - Source
- MixedVec.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
MixedVecInit.type
Builds a Mux tree out of the input signal vector using a one hot encoded select signal. Returns the output of the Mux tree.
Builds a Mux tree out of the input signal vector using a one hot encoded select signal. Returns the output of the Mux tree.
Attributes
Given an association of values to enable signals, returns the first value with an associated high enable signal.
Creates a cascade of n Muxs to search for a key value. The Selector may be a UInt or an EnumType.
Creates a cascade of n Muxs to search for a key value. The Selector may be a UInt or an EnumType.
Attributes
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.
Attributes
- Note
-
assumes exactly one high bit, results undefined otherwise
- Example
-
OHToUInt("b0100".U) // results in 2.U - Source
- OneHot.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
OHToUInt.type
A factory to generate a hardware pipe. This can be used to delay Valid data by a design-time configurable number of cycles.
A factory to generate a hardware pipe. This can be used to delay Valid data by a design-time configurable number of cycles.
Here, we construct three different pipes using the different provided apply methods and hook them up together. The types are explicitly specified to show that these all communicate using Valid interfaces:
val in: Valid[UInt] = Wire(Valid(UInt(2.W)))
/* A zero latency (combinational) pipe is connected to 'in' */
val foo: Valid[UInt] = Pipe(in.valid, in.bits, 0)
/* A one-cycle pipe is connected to the output of 'foo' */
val bar: Valid[UInt] = Pipe(foo.valid, foo.bits)
/* A two-cycle pipe is connected to the output of 'bar' */
val baz: Valid[UInt] = Pipe(bar, 2)
Attributes
- See also
-
Pipe class for an alternative API
Valid interface
Queue and the Queue factory for actual queues
The ShiftRegister factory to generate a pipe without a Valid interface
- Companion
- class
- Source
- Pipe.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Pipe.type
Pipeline module generator parameterized by data type and latency.
Pipeline module generator parameterized by data type and latency.
This defines a module with one input, enq, and one output, deq. The input and output are Valid interfaces that wrap some Chisel type, e.g., a UInt or a Bundle. This generator will then chain together a number of pipeline stages that all advance when the input Valid enq fires. The output deq Valid will fire only when valid data has made it all the way through the pipeline.
As an example, to construct a 4-stage pipe of 8-bit UInts and connect it to a producer and consumer, you can use the following:
val foo = Module(new Pipe(UInt(8.W)), 4)
pipe.io.enq := producer.io
consumer.io := pipe.io.deq
If you already have the Valid input or the components of a Valid interface, it may be simpler to use the Pipe factory companion object. This, which Pipe internally utilizes, will automatically connect the input for you.
Value parameters
- gen
-
a Chisel type
- latency
-
the number of pipeline stages
Attributes
- See also
-
Pipe factory for an alternative API
Valid interface
Queue and the Queue factory for actual queues
The ShiftRegister factory to generate a pipe without a Valid interface
- Companion
- object
- Source
- Pipe.scala
- Supertypes
-
class Moduletrait ImplicitResettrait ImplicitClockclass RawModuleclass BaseModuletrait Selectabletrait Selectabletrait IsInstantiabletrait InstanceIdclass Objecttrait Matchableclass AnyShow all
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.
Attributes
- Example
-
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 - Source
- Bitwise.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
PopCount.type
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.
Attributes
- Note
-
Multiple bits may be high in the input.
If no bits are high, the result is undefined.
- Example
-
PriorityEncoder("b0110".U) // results in 1.U - Source
- OneHot.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
PriorityEncoder.type
Returns a bit vector in which only the least-significant 1 bit in the input vector, if any, is set.
Returns a bit vector in which only the least-significant 1 bit in the input vector, if any, is set.
Attributes
- Example
-
PriorityEncoderOH(Seq(false.B, true.B, true.B, false.B)) // results in Seq(false.B, true.B, false.B, false.B) - Source
- OneHot.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
PriorityEncoderOH.type
Builds a Mux tree under the assumption that multiple select signals can be enabled. Priority is given to the first select signal.
Builds a Mux tree under the assumption that multiple select signals can be enabled. Priority is given to the first select signal.
Attributes
- Example
-
val hotValue = chisel3.util.PriorityMux(Seq( io.selector(0) -> 2.U, io.selector(1) -> 4.U, io.selector(2) -> 8.U, io.selector(4) -> 11.U, ))Returns the output of the Mux tree.
- Source
- Mux.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
PriorityMux.type
A hardware module implementing a Queue
A hardware module implementing a Queue
Value parameters
- entries
-
The max number of entries in the queue
- flow
-
True if the inputs can be consumed on the same cycle (the inputs "flow" through the queue immediately). The ''valid'' signals are coupled.
- gen
-
The type of data to queue
- hasFlush
-
True if generated queue requires a flush feature
- pipe
-
True if a single entry queue can run at full throughput (like a pipeline). The ''ready'' signals are combinationally coupled.
- useSyncReadMem
-
True uses SyncReadMem instead of Mem as an internal memory element.
Attributes
- Example
-
val q = Module(new Queue(UInt(), 16)) q.io.enq <> producer.io.out consumer.io.in <> q.io.deq - Companion
- object
- Source
- Queue.scala
- Supertypes
-
class Moduletrait ImplicitResettrait ImplicitClockclass RawModuleclass BaseModuletrait Selectabletrait Selectabletrait IsInstantiabletrait InstanceIdclass Objecttrait Matchableclass AnyShow all
Factory for a generic hardware queue.
Factory for a generic hardware queue.
Attributes
- Companion
- class
- Source
- Queue.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Queue.type
An I/O Bundle for Queues
An I/O Bundle for Queues
Value parameters
- entries
-
The max number of entries in the queue.
- gen
-
The type of data to queue
- hasFlush
-
A boolean for whether the generated Queue is flushable
Attributes
- Source
- Queue.scala
- Supertypes
-
class Bundleclass Recordtrait Selectabletrait Aggregateclass Datatrait InstanceIdclass Objecttrait Matchableclass AnyShow all
Hardware module that is used to sequence n producers into 1 consumer. Producers are chosen in round robin order.
Hardware module that is used to sequence n producers into 1 consumer. Producers are chosen in round robin order.
Value parameters
- gen
-
data type
- initLastGrant
-
when true, initialize the
lastGrantregister to 0 - n
-
number of inputs
Attributes
- Example
-
val arb = Module(new RRArbiter(UInt(), 2)) arb.io.in(0) <> producer0.io.out arb.io.in(1) <> producer1.io.out consumer.io.in <> arb.io.out - Source
- Arbiter.scala
- Supertypes
-
class LockingRRArbiter[T]class LockingArbiterLike[T]class Moduletrait ImplicitResettrait ImplicitClockclass RawModuleclass BaseModuletrait Selectabletrait Selectabletrait IsInstantiabletrait InstanceIdclass Objecttrait Matchableclass AnyShow all
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.
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.
Value parameters
- gen
-
the type of data to be wrapped in Ready/Valid
Attributes
- Companion
- object
- Source
- ReadyValidIO.scala
- Supertypes
-
class Bundleclass Recordtrait Selectabletrait Aggregateclass Datatrait InstanceIdclass Objecttrait Matchableclass AnyShow all
- Known subtypes
-
class DecoupledIO[T]class IrrevocableIO[T]
Attributes
- Companion
- class
- Source
- ReadyValidIO.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ReadyValidIO.type
Returns the input in bit-reversed order. Useful for little/big-endian conversion.
Returns the input in bit-reversed order. Useful for little/big-endian conversion.
Attributes
- Example
-
Reverse("b1101".U) // equivalent to "b1011".U Reverse("b1101".U(8.W)) // equivalent to "b10110000".U Reverse(myUIntWire) // dynamic reverse - Source
- Bitwise.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Reverse.type
Attributes
- Source
- Reg.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ShiftRegister.type
Attributes
- Source
- Reg.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ShiftRegisters.type
A sparse vector. Under the hood, this is a Record that can be dynamically indexed as if it were a dense Vec.
A sparse vector. Under the hood, this is a Record that can be dynamically indexed as if it were a dense Vec.
SparseVec has the usual trappings of a Vec. It has a size and a gen type. However, it also has an indices argument. This indicates the indices at which the SparseVec is allowed to have data. Additionally, the behavior of a SparseVec around what happens if a value is read from a value not in the indices:
defaultValuesets the default value that is read from an index between the zeroth index and the largest value inindicesthat is not in theindices.outOfBoundsValuesets the behavior when reading a value larger than the largest value inindices.
The reason for this configurability is to enable exact compatibility with an equivalent dense Vec of the same size and initialized to a given value. Specifically, use SparseVec.DefaultValueBehavior.DynamicIndexEquivalent and SparseVec.OutOfBoundsBehavior.First to make this behave as such:
-
The SparseVec has a default value of how a FIRRTL compiler compiles DontCare for a dynamic index.
-
The SparseVec out-of-bounds behavior returns the zeroth element if a zeroth element exists. Otherwise, it returns a DontCare.
Note that this DontCare is likely not a true "don't care" that will be optimized to any value. Instead, it is a value equal to how a FIRRTL compiler chooses to optimize a dynamic index into a wire vector initialized with a DontCare. This has historically been zero.
Once created, a SparseVec can be written or read from as a Record. It may also be read from using a dynamic index, but not written to. Neither the default value nor the out-of-bounds value may be written to. The dynamic index type is conifgurable and may be one of:
- SparseVec.Lookup.Binary to convert the SparseVec index into a binary index into a dense vector.
- SparseVec.Lookup.OneHot to convert the SparseVec index into a one-hot encoded index into a dense vector using Mux1H.
- SparseVec.Lookup.IfElse to use a sequence of when statements.
A SparseVec will take up storage equal to the size of the provided mapping argument with one additional slot for the default value, if one is needed.
Value parameters
- defaultValue
-
the default value behavior when accessing an index not in the
indices - gen
-
the element type of the vector
- indices
-
the indices of the vector which are valid
- outOfBoundsValue
-
the out-of-bounds behavior when accessing an index larger than the largest value in
indices - size
-
the apparent size of the vector
Attributes
- Companion
- object
- Source
- SparseVec.scala
- Supertypes
-
class Recordtrait Selectabletrait Aggregateclass Datatrait InstanceIdclass Objecttrait Matchableclass AnyShow all
Utilities related to SparseVec.
Utilities related to SparseVec.
Attributes
- Companion
- class
- Source
- SparseVec.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
SparseVec.type
Attributes
- Note
-
DO NOT USE. This API is subject to change without warning.
- Source
- Conditional.scala
- Supertypes
-
class Objecttrait Matchableclass Any
Returns the one hot encoding of the input UInt.
Returns the one hot encoding of the input UInt.
Attributes
- Example
-
UIntToOH(2.U) // results in "b0100".U - Source
- OneHot.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
UIntToOH.type
A Bundle that adds a valid bit to some data. This indicates that the user expects a "valid" interface between a producer and a consumer. Here, the producer asserts the valid bit when data on the bits line contains valid data. This differs from DecoupledIO or IrrevocableIO as there is no ready line that the consumer can use to put back pressure on the producer.
A Bundle that adds a valid bit to some data. This indicates that the user expects a "valid" interface between a producer and a consumer. Here, the producer asserts the valid bit when data on the bits line contains valid data. This differs from DecoupledIO or IrrevocableIO as there is no ready line that the consumer can use to put back pressure on the producer.
In most scenarios, the Valid class will ''not'' be used directly. Instead, users will create Valid interfaces using the Valid factory.
Type parameters
- T
-
the type of the data
Value parameters
- gen
-
some data
Attributes
- See also
-
Valid factory for concrete examples
- Companion
- object
- Source
- Valid.scala
- Supertypes
-
class Bundleclass Recordtrait Selectabletrait Aggregateclass Datatrait InstanceIdclass Objecttrait Matchableclass AnyShow all
Factory for generating "valid" interfaces. A "valid" interface is a data-communicating interface between a producer and a consumer where the producer does not wait for the consumer. Concretely, this means that one additional bit is added to the data indicating its validity.
Factory for generating "valid" interfaces. A "valid" interface is a data-communicating interface between a producer and a consumer where the producer does not wait for the consumer. Concretely, this means that one additional bit is added to the data indicating its validity.
As an example, consider the following Bundle, MyBundle:
class MyBundle extends Bundle {
val foo = Output(UInt(8.W))
}
To convert this to a valid interface, you wrap it with a call to the Valid companion object's apply method:
val bar = Valid(new MyBundle)
The resulting interface is ''structurally'' equivalent to the following:
class MyValidBundle extends Bundle {
val valid = Output(Bool())
val bits = Output(new MyBundle)
}
In addition to adding the valid bit, a Valid.fire method is also added that returns the valid bit. This
provides a similarly named interface to DecoupledIO's fire.
Attributes
- See also
- Companion
- class
- Source
- Valid.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Valid.type
Helper Object for applying Attribute Annotations
Helper Object for applying Attribute Annotations
Attributes
- Source
- AttributeAnnotation.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
addAttribute.type
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.
Attributes
- Note
- Source
- Conditional.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
is.type
Returns whether a Scala integer is a power of two.
Returns whether a Scala integer is a power of two.
Attributes
- Example
-
isPow2(1) // returns true isPow2(2) // returns true isPow2(3) // returns false isPow2(4) // returns true - Source
- Math.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
isPow2.type
Compute the log2 of a Scala integer, rounded up. Useful for getting the number of bits needed to represent some number of states (in - 1). To get the number of bits needed to represent some number n, use log2Ceil(n + 1).
Compute the log2 of a Scala integer, rounded up. Useful for getting the number of bits needed to represent some number of states (in - 1). To get the number of bits needed to represent some number n, use log2Ceil(n + 1).
Note: can return zero, and should not be used in cases where it may generate unsupported zero-width wires.
Attributes
- Example
-
log2Ceil(1) // returns 0 log2Ceil(2) // returns 1 log2Ceil(3) // returns 2 log2Ceil(4) // returns 2 - Source
- Math.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
log2Ceil.type
Compute the log2 of a Scala integer, rounded down, with min value of 1.
Compute the log2 of a Scala integer, rounded down, with min value of 1.
Attributes
- Example
-
log2Down(1) // returns 1 log2Down(2) // returns 1 log2Down(3) // returns 1 log2Down(4) // returns 2 - Source
- Math.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
log2Down.type
Compute the log2 of a Scala integer, rounded down.
Compute the log2 of a Scala integer, rounded down.
Can be useful in computing the next-smallest power of two.
Attributes
- Example
-
log2Floor(1) // returns 0 log2Floor(2) // returns 1 log2Floor(3) // returns 1 log2Floor(4) // returns 2 - Source
- Math.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
log2Floor.type
Compute the log2 of a Scala integer, rounded up, with min value of 1. Useful for getting the number of bits needed to represent some number of states (in - 1), To get the number of bits needed to represent some number n, use log2Up(n + 1). with the minimum value preventing the creation of currently-unsupported zero-width wires.
Compute the log2 of a Scala integer, rounded up, with min value of 1. Useful for getting the number of bits needed to represent some number of states (in - 1), To get the number of bits needed to represent some number n, use log2Up(n + 1). with the minimum value preventing the creation of currently-unsupported zero-width wires.
Note: prefer to use log2Ceil when in is known to be > 1 (where log2Ceil(in) > 0). This will be deprecated when zero-width wires is supported.
Attributes
- Example
-
log2Up(1) // returns 1 log2Up(2) // returns 1 log2Up(3) // returns 2 log2Up(4) // returns 2 - Source
- Math.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
log2Up.type
Map each bit to the logical OR of itself and all bits with lower index
Map each bit to the logical OR of itself and all bits with lower index
Here scanLeft means "start from the left and iterate to the right, where left is the lowest index", a common operation on arrays and lists.
Attributes
- Example
-
scanLeftOr("b00001000".U(8.W)) // Returns "b11111000".U scanLeftOr("b00010100".U(8.W)) // Returns "b11111100".U scanLeftOr("b00000000".U(8.W)) // Returns "b00000000".U - Source
- Bitwise.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
scanLeftOr.type
Map each bit to the logical OR of itself and all bits with higher index
Map each bit to the logical OR of itself and all bits with higher index
Here scanRight means "start from the right and iterate to the left, where right is the highest index", a common operation on arrays and lists.
Attributes
- Example
-
scanRightOr("b00001000".U) // Returns "b00001111".U scanRightOr("b00010100".U) // Returns "b00011111".U scanRightOr("b00000000".U) // Returns "b00000000".U - Source
- Bitwise.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
scanRightOr.type
Attributes
- Source
- Math.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
signedBitLength.type
Attributes
- Source
- Naming.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
simpleClassName.type
Conditional logic to form a switch block. See is for the case API.
Conditional logic to form a switch block. See is for the case API.
Attributes
- Example
-
switch (myState) { is (state1) { // some logic here that runs when myState === state1 } is (state2) { // some logic here that runs when myState === state2 } } - Source
- Switch.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
switch.type
Attributes
- Source
- Math.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
unsignedBitLength.type
Deprecated classlikes
Attributes
- Deprecated
-
[Since version since]message - Source
- BlackBoxUtils.scala
- Supertypes
-
class BlackBoxclass BaseModuletrait Selectabletrait Selectabletrait IsInstantiabletrait InstanceIdclass Objecttrait Matchableclass AnyShow all
- Self type
Attributes
- Deprecated
-
[Since version since]message - Source
- BlackBoxUtils.scala
- Supertypes
-
class BlackBoxclass BaseModuletrait Selectabletrait Selectabletrait IsInstantiabletrait InstanceIdclass Objecttrait Matchableclass AnyShow all
- Self type
Attributes
- Deprecated
-
[Since version since]message - Source
- BlackBoxUtils.scala
- Supertypes
-
class BlackBoxclass BaseModuletrait Selectabletrait Selectabletrait IsInstantiabletrait InstanceIdclass Objecttrait Matchableclass AnyShow all
- Self type
Attributes
- Deprecated
-
[Since version since]deprecationMessage - Source
- ExtModuleUtils.scala
- Supertypes
-
class ExtModuleclass BaseModuletrait Selectabletrait Selectabletrait IsInstantiabletrait InstanceIdclass Objecttrait Matchableclass AnyShow all
- Self type
Attributes
- Deprecated
-
[Since version since]deprecationMessage - Source
- ExtModuleUtils.scala
- Supertypes
-
class ExtModuleclass BaseModuletrait Selectabletrait Selectabletrait IsInstantiabletrait InstanceIdclass Objecttrait Matchableclass AnyShow all
- Self type
Attributes
- Deprecated
-
[Since version since]deprecationMessage - Source
- ExtModuleUtils.scala
- Supertypes
-
class ExtModuleclass BaseModuletrait Selectabletrait Selectabletrait IsInstantiabletrait InstanceIdclass Objecttrait Matchableclass AnyShow all
- Self type