chisel3.Printable
See thePrintable companion object
Superclass of things that can be printed in the resulting circuit
Usually created using the custom string interpolator p"...". Printable string interpolation is similar to String interpolation in Scala For example:
printf(p"The value of wire = $wire\n")
This is equivalent to writing:
printf("The value of wire = %d\n", wire)
All Chisel data types have a method .toPrintable that gives a default pretty print that can be accessed via p"...". This works even for aggregate types, for example:
val myVec = VecInit(5.U, 10.U, 13.U)
printf(p"myVec = $myVec\n")
// myVec = Vec(5, 10, 13)
val myBundle = Wire(new Bundle {
val foo = UInt()
val bar = UInt()
})
myBundle.foo := 3.U
myBundle.bar := 11.U
printf(p"myBundle = $myBundle\n")
// myBundle = Bundle(a -> 3, b -> 11)
Users can override the default behavior of .toPrintable in custom Bundle and Record types.
Attributes
- Companion
- object
- Source
- Printable.scala
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
class FirrtlFormatclass Binaryclass Characterclass Decimalclass Hexadecimalclass FullNameobject HierarchicalModuleNameclass Nameclass PStringobject Percentclass Printablesobject SimulationTime
Members list
In this article