trait Internals { this: Module =>val io = IO(new Bundle{ val a = Input(Bool()) })
}
class Sub extends Module with Internals
trait HasSub { this: Module with Internals =>val sub = Module(new Sub)
sub.io.a := io.a
}
/* InlineInstance is mixed directly into Foo's definition. Every instance
* of this will be inlined. */class Foo extends Module with Internals with InlineInstance with HasSub
/* Bar will, by default, not be inlined */class Bar extends Module with Internals with HasSub
/* The resulting instances will be:
- Top
- Top.x$sub
- Top.y$sub
- Top.z
- Top.z.sub */class Top extends Module with Internals {
val x = Module(new Foo) // x will be inlinedval y = Module(new Bar with InlineInstance) // y will also be inlinedval z = Module(new Bar) // z will not be inlinedSeq(x, y, z).map(_.io.a := io.a)
}
Inlines an instance of a module