object TransitName
The purpose of TransitName
is to improve the naming of some object created in a different scope by "transiting"
the name from the outer scope to the inner scope.
Consider the example below. This shows three ways of instantiating MyModule
and returning the IO. Normally, the
instance will be named MyModule
. However, it would be better if the instance was named using the name of the val
that user provides for the returned IO. TransitName
can then be used to "transit" the name from the IO to
the module:
/* Assign the IO of a new MyModule instance to value "foo". The instance will be named "MyModule". */ val foo = Module(new MyModule).io /* Assign the IO of a new MyModule instance to value "bar". The instance will be named "bar". */ val bar = { val x = Module(new MyModule) TransitName(x.io, x) // TransitName returns the first argument } /* Assign the IO of a new MyModule instance to value "baz". The instance will be named "baz_generated". */ val baz = { val x = Module(new MyModule) TransitName.withSuffix("_generated")(x.io, x) // TransitName returns the first argument }
TransitName
helps library writers following the Factory
Method Pattern where modules may be instantiated inside an enclosing scope. For an example of this, see how the
Queue factory uses TransitName
in
Decoupled.scala factory.
- Source
- TransitName.scala
- Alphabetic
- By Inheritance
- TransitName
- 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 <: HasId](from: T, to: HasId): T
Transit a name from one type to another
Transit a name from one type to another
- from
the thing with a "good" name
- to
the thing that will receive the "good" name
- returns
the
from
parameter
- 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])
- def withSuffix[T <: HasId](suffix: String)(from: T, to: HasId): T
Transit a name from one type to another and add a suffix
Transit a name from one type to another and add a suffix
- suffix
the suffix to append
- from
the thing with a "good" name
- to
the thing that will receive the "good" name
- returns
the
from
parameter
This is the documentation for Chisel.
Package structure
The chisel3 package presents the public API of Chisel. It contains the concrete core types
UInt
,SInt
,Bool
,FixedPoint
,Clock
, andReg
, the abstract typesBits
,Aggregate
, andData
, and the aggregate typesBundle
andVec
.The Chisel package is a compatibility layer that attempts to provide chisel2 compatibility in chisel3.
Utility objects and methods are found in the
util
package.The
testers
package defines the basic interface for chisel testers.