object WireDefault
Utility for constructing hardware wires with a default connection
The two forms of WireDefault
differ in how the type and width of the resulting Wire are
specified.
Single Argument
The single argument form uses the argument to specify both the type and default connection. For non-literal Bits, the width of the Wire will be inferred. For literal Bits and all non-Bits arguments, the type will be copied from the argument. See the following examples for more details:
1. Literal Bits initializer: width will be set to match
val w1 = WireDefault(1.U) // width will be inferred to be 1 val w2 = WireDefault(1.U(8.W)) // width is set to 8
2. Non-Literal Element initializer - width will be inferred
val x = Wire(UInt()) val y = Wire(UInt(8.W)) val w1 = WireDefault(x) // width will be inferred val w2 = WireDefault(y) // width will be inferred
3. Aggregate initializer - width will be set to match the aggregate
class MyBundle { val unknown = UInt() val known = UInt(8.W) } val w1 = Wire(new MyBundle) val w2 = WireDefault(w1) // Width of w2.unknown is inferred // Width of w2.known is set to 8
Double Argument
The double argument form allows the type of the Wire and the default connection to be specified independently.
The width inference semantics for WireDefault
with two arguments match those of Wire. The
first argument to WireDefault
is the type template which defines the width of the Wire
in
exactly the same way as the only argument to Wire.
More explicitly, you can reason about WireDefault
with multiple arguments as if it were defined
as:
def WireDefault[T <: Data](t: T, init: T): T = { val x = Wire(t) x := init x }
- Note
The
Default
inWireDefault
refers to adefault
connection. This is in contrast to RegInit where theInit
refers to a value on reset.
- Alphabetic
- By Inheritance
- WireDefault
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def apply[T <: Data](init: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T
Construct a Wire with a default connection
Construct a Wire with a default connection
- init
The hardware value that will serve as a type template and default value
- def apply[T <: Data](t: T, init: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T
Construct a Wire with a type template and a default connection
- def apply[T <: Data](t: T, init: DontCare.type)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T
Construct a Wire with a type template and a chisel3.DontCare default
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])