Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elaborate chisel type annotation from firtool to generate debug information for the Tywaves project #6983

Open
rameloni opened this issue May 3, 2024 · 2 comments

Comments

@rameloni
Copy link

rameloni commented May 3, 2024

@fabianschuiki I created this issue to keep talking about the conversation we started here: chipsalliance/chisel#4015 (comment)

I added attributes to debug variable to store the chisel type name and, eventually, the constructor parameters in the debug dialect (and maybe in dbg.struct and dbg.array as well).

However, I may need to create a dbg variable for each sub field, recursively, of aggregates.
Is there a reason why values in dbg.struct/dbg.array are of Firrtl types rather than dbg.variable type in MaterializeDebugInfo?

@sequencer
Copy link
Contributor

I think we can to expose the chisel type via compiler plugin like what we did in the source info. But what on earth is a chisel type? That’s the fundamental question(we need specification)

@rameloni
Copy link
Author

rameloni commented May 8, 2024

I think we can to expose the chisel type via compiler plugin like what we did in the source info.

I already managed to expose source level information from chisel to firrtl and firtool. In the meantime I also managed to read this information from firtool, processing it into proper debug variables and updating hgldd/emitting a new file format.

But what on earth is a chisel type? That’s the fundamental question(we need specification)

Whit chisel type refer to the type of the scala variable in the source chisel code.
In the following example:

class MyBundle(size: Int) extends Bundle {
   val a = Bool()
   val b = SInt(size.W)
   val nested = new Bundle {
      val x = UInt(8.W)
   }
}
val inBundle  = IO(Input(new MyBundle(10)))
val wireBundle = Wire(new MyBundle(7))
val outBundle = IO(Output(new MyBundle(9)))) 

The types 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>]
... ...

Namely, I refer to anything represented in this table, including user-defined types:
https://raw.githubusercontent.com/chipsalliance/chisel/main/docs/src/images/type_hierarchy.svg?sanitize=true
This is basically the information I'm trying to emit in a file format similar to hgldd: chipsalliance/chisel#4015 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants