Packages

o

chisel3.util

TransitName

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
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. TransitName
  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 <: 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

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

Inherited from AnyRef

Inherited from Any

Ungrouped