trait Internals { this: Module =>val io = IO(new Bundle{ val a = Input(Bool()) })
}
class Foo extends Module with Internals with FlattenInstance
class Bar extends Module with Internals {
val baz = Module(new Baz)
baz.io.a := io.a
}
class Baz extends Module with Internals
/* The resulting instances will be:
- Top
- Top.x
- Top.y
- Top.z
- Top.z.baz */class Top extends Module with Internals {
val x = Module(new Foo) // x will be flattenedval y = Module(new Bar with FlattenInstance) // y will also be flattenedval z = Module(new Bar) // z will not be flattenedSeq(x, y, z).map(_.io.a := io.a)
}
Flattens an instance of a module