-
Notifications
You must be signed in to change notification settings - Fork 0
What is considered a chisel type in Tywaves?
The main objective of the Tywaves project consists in providing a typed waveform viewer for Chisel, in which not only the hierarchical structure is important such as structures and vectors, but also the source scala type of the signal and modules inspected in the viewer.
Chisel allows using scala features to build reusable hardware components. While writing a Chisel circuit, each signal has a clearly defined scala-type, as can be seen from the code below:
class MyBundle(size: Int) extends Bundle {
val a: Bool = Bool()
val b: SInt = SInt(size.W)
val nested = new Bundle {
val x: UInt = UInt(8.W)
}
}
val inBundle : MyBundle = IO(Input(new MyBundle(size = 10)))
val wireBundle: MyBundle = Wire(new MyBundle(7))
val outBundle : MYBundle = IO(Output(new MyBundle(9)))
The types in this code would be:
Variable | Type |
---|---|
inBundle | IO[MyBundle(10)] |
wireBundle | Wire[MyBundle(7)] |
outBundle | IO[MyBundle(9)] |
inBundle.a | IO[Bool] |
inBundle.b | IO[SInt<10>] |
inBundle.nested | IO[AnonymousBundle] |
inBundle.nested.x | IO[UInt<8>] |
... | ... |
Types can also have constructor parameters.
The fig. 1 shows the hierarchy of Chisel data types, in addition to the internal and "standard", types in Chisel can be further extended by the user to create their own custom types, and these types are encoded as scala classes.
Fig. 1 - Chisel data types hierarchy from chisel: Data Types Overview |
In conclusion, a chisel type is the type of the scala variable representing a signal or a module in the source chisel code. This information, together with signal hierarchies, is missing from the standard waveform viewers. Tywaves provides a solution to this by implementing a typed waveform viewer for Chisel.