HasAutoTypename

chisel3.experimental.HasAutoTypename

Trait for Records that signals the compiler plugin to generate a typeName for the inheriting Record based on the parameter values provided to its constructor.

Attributes

Example

Consider a Bundle which manually implements typeName:

class MyBundle(param1: Int, param2: Int)(gen: Data) extends Bundle {
 val foo = UInt(param1.W)
 val bar = UInt(param2.W)
 val data = gen
 override def typeName = s"MyBundle_${param1}_${param2}_${gen.typeName}"
}
(new MyBundle(3, 4)(SInt(3.W))).typeName // "MyBundle_3_4_SInt3"
(new MyBundle(1, 32)(Bool())).typeName   // "MyBundle_1_32_Bool"

An identical typeName implementation can be generated and provided with HasAutoTypename, making the manual implementation unnecessary:

class MyBundle(param1: Int, param2: Int)(gen: Data) extends Bundle with HasAutoTypename {
 val foo = UInt(param1.W)
 val bar = UInt(param2.W)
 val data = gen
}
(new MyBundle(3, 4)(SInt(3.W))).typeName // "MyBundle_3_4_SInt3"
(new MyBundle(1, 32)(Bool())).typeName   // "MyBundle_1_32_Bool"
Source
HasAutoTypename.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

override def typeName: String

Auto generate a type name for this Bundle using the bundle arguments supplied by the compiler plugin.

Auto generate a type name for this Bundle using the bundle arguments supplied by the compiler plugin.

Attributes

Definition Classes
Source
HasAutoTypename.scala