ucb-bar/chipyard

FireSim doesn't work with cloned configs + CloneLazyModule caveats

Opened this issue · 1 comments

Background Work

Chipyard Version and Hash

Latest

OS Setup

N/A

Other Setup

Tried building

class Cloned64MegaBoomV3Config extends Config(

Current Behavior

Errors since you can't access the .module member here for each tile:

chiptops.foreach {
case c: ChipTop => c.lazySystem match {
case ls: InstantiatesHierarchicalElements => {
if (p(FireSimMultiCycleRegFile)) ls.totalTiles.values.map {
case r: RocketTile => {
annotate(MemModelAnnotation(r.module.core.rocketImpl.rf.rf))
r.module.fpuOpt.foreach(fpu => annotate(MemModelAnnotation(fpu.fpuImpl.regfile)))
}
case b: BoomTile => {
val core = b.module.core
core.iregfile match {
case irf: boom.v3.exu.RegisterFileSynthesizable => annotate(MemModelAnnotation(irf.regfile))
}
if (core.fp_pipeline != null) core.fp_pipeline.fregfile match {
case frf: boom.v3.exu.RegisterFileSynthesizable => annotate(MemModelAnnotation(frf.regfile))
}
}
case _ =>
}
if (p(FireSimFAME5)) ls.totalTiles.values.map {
case b: BoomTile =>
annotate(EnableModelMultiThreadingAnnotation(b.module))
case r: RocketTile =>
annotate(EnableModelMultiThreadingAnnotation(r.module))
case _ => Nil
}
}
case _ =>
}
case _ =>

Expected Behavior

You can bypass the issue by just annotating the 1st element of the sequence. Ideally an API is exposed for CloneLazyModule that indicates if it's been cloned.

Other Information

No response

Additionally, CloneLazyModule doesn't work for non-diplomatic IOs. I.e. something like this doesn't work:

class M0 extends LazyModule {
  val module = LazyModuleImp {
     val io = IO(new Bundle {
        val ib = Input(Bool())
        val ob = Output(Bool())
     }
  }
}

// in lazy module scope
val m0 = LazyModule(new M0)
val m1 = LazyModule(new M0)

// in impl scope
m1.module.io.ib := false.B
m0.module.io.ib := m1.module.io.ob

// change instantiation to this
val m0 = LazyModule(new M0)
val m1 = CloneLazyModule(new M0, m0)