Packages

o

chisel3

WireDefault

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
}
Source
Data.scala
Note

The Default in WireDefault refers to a default connection. This is in contrast to RegInit where the Init refers to a value on reset.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. WireDefault
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

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[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

  5. 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

    Construct a Wire with a type template and a default connection

    t

    The type template used to construct this Wire

    init

    The hardware value that will serve as the default value

  6. 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

    Construct a Wire with a type template and a chisel3.DontCare default

    t

    The type template used to construct this Wire

    init

    The default connection to this Wire, can only be DontCare

    Note

    This is really just a specialized form of apply[T <: Data](t: T, init: T): T with DontCare as init

  7. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  8. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  13. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  14. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  17. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  18. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  19. def toString(): String
    Definition Classes
    AnyRef → Any
  20. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped