HasAutoTypename
chisel3.experimental.HasAutoTypename
trait 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
typeNameimplementation can be generated and provided withHasAutoTypename, 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 Objecttrait Matchableclass Any
- Self type
Members list
In this article