I would like to generate a Module IO interface from a spec I have stored in a scala variable.
I would like to produce this class definition:
class AddIfc extends Module {
val io = IO(new Bundle {
val a = Input(UInt(8.W))
val b = Input(UInt(8.W))
val o = Output(UInt(8.W))
})
}
from something like a list of tuples:
List( ("a", "in", 8), ("b", "in", 8), ("o", "out", 8))
I can imagine building an AST and evaluating it using some of the reflection capabilities in scala. Has anyone done this and have an example to show?