Skip to content

Why a Typed waveform viewer

Raffaele Meloni edited this page Jun 24, 2024 · 3 revisions

Table of contents

The concept of a typed waveform viewer: origins

The concept of a typed waveform viewer originated from Tydi (Typed dataflow interface, a specification for expressing how to transfer composite and variable-length typed data structures between hardware components over streams) and Tydi-lang (a language for describing custom typed data structures and type-based streams).

Tydi-lang alone is not able to express the behavior of "processing" components but only the connections and data types exchanged between them. Therefore, the tydi-lang source code is translated into a target HDL. Specifically, tydi targets Chisel and the Tydi-Chisel scala library can be used to enable the specification in Chisel. The user can make use of the tydi compiler and the library to generate the boilerplate code, then they can specify the behavior of the single components in Chisel without worrying about the implementation details of the specification. All the tydi types are translated to respective Chisel types and User types. For more details about this, please refer to the tydi repositories.

In a typed streaming system, the data structures are internally "serialized" at the bit-level for the actual transmission, but thanks to Tydi-lang, Chisel, and Tydi-Chisel this aspect is hidden to the user. Therefore, from a user perspective, components are transferring complex data structures as whole "packets". And it is in this context that tydi raises the level of abstraction.

Extending the concept to Chisel

Since Tydi's backend is Chisel, it depends on Chisel tools and libraries. Consequently, the same testing tools used for Chisel are also available for simulating Tydi. The figure below, reports the current tydi flow.

Tydi toolchain components
Fig 1. - Tydi toolchain components (Fig. 3 from Tydi-Chisel: Collaborative and Interface-Driven Data-Streaming Accelerators)

Moreover, starting from the Chisel basic types all the Tydi types have been implemented in Chisel. This reduced the problem to the implementation of a viewer not only for Tydi but for the whole Chisel ecosystem, such that all projects that use Chisel can benefit from it, including Tydi.

In addition to that, types cover an important role in Chisel as well. As shown in the Data Type Overview section, Chisel includes internal, "standard", and user-defined types. Displaying these types in waveforms, alongside signal hierarchies, is essential for bridging the gap between coding and debugging. It also helps to distinguish signals clearly. Different types, such as Bool and SInt or a Bundle and a user-defined type, have distinct characteristics, making it even more important to clearly differentiate them.

Example of tydi-lang code and respective Chisel code

In the previous section, I mentioned that all Tydi types are successfully implemented in Chisel through its library. This section presents an example of how types defined in tydi-lang are translated to Chisel.

rgb-tydi-chisel-code corresponding-signals
Fig. 2.1 - Example of tydi-lang code translated into Chisel Fig. 2.2 - Corresponding signals