Decouple Vortex imem bundle from TL

This commit is contained in:
Hansung Kim
2023-10-17 12:18:58 -07:00
parent e4dd0c21e9
commit fb97bd3c2b
3 changed files with 30 additions and 20 deletions

Submodule src/main/resources/vsrc/vortex updated: 3adf178478...696621b2dc

View File

@@ -34,9 +34,9 @@ class VortexBundle(tile: VortexTile)(implicit p: Parameters) extends CoreBundle
val interrupts = Input(new CoreInterrupts()) val interrupts = Input(new CoreInterrupts())
// conditionally instantiate ports depending on whether we want to use VX_cache or not // conditionally instantiate ports depending on whether we want to use VX_cache or not
val imem = if (!tile.vortexParams.useVxCache) Some(Vec(1, new Bundle { // TODO: magic number val imem = if (!tile.vortexParams.useVxCache) Some(Vec(1, new Bundle {
val a = tile.imemNodes.head.out.head._1.a.cloneType val a = Decoupled(new VortexBundleA())
val d = Flipped(tile.imemNodes.head.out.head._1.d.cloneType) val d = Flipped(Decoupled(new VortexBundleD()))
})) else None })) else None
val dmem = if (!tile.vortexParams.useVxCache) Some(Vec(tile.numLanes, new Bundle { val dmem = if (!tile.vortexParams.useVxCache) Some(Vec(tile.numLanes, new Bundle {
val a = Decoupled(new VortexBundleA()) val a = Decoupled(new VortexBundleA())

View File

@@ -290,10 +290,18 @@ class VortexTileModuleImp(outer: VortexTile) extends BaseTileModuleImp(outer) {
core.io.mem.get.a <> outer.memNode.out.head._1.a core.io.mem.get.a <> outer.memNode.out.head._1.a
core.io.mem.get.d <> outer.memNode.out.head._1.d core.io.mem.get.d <> outer.memNode.out.head._1.d
} else { } else {
(core.io.imem.get zip outer.imemNodes).foreach { case (coreMem, tileNode) => val imemTLAdapter = Module(new VortexTLAdapter(
coreMem.d <> tileNode.out.head._1.d outer.sourceWidth,
tileNode.out.head._1.a <> coreMem.a new VortexBundleA(),
} new VortexBundleD(),
chiselTypeOf(outer.imemNodes.head.out.head._1.a.bits),
chiselTypeOf(outer.imemNodes.head.out.head._1.d.bits),
))
// TODO: make imemNodes not a vector
imemTLAdapter.io.inReq <> core.io.imem.get(0).a
core.io.imem.get(0).d <> imemTLAdapter.io.inResp
outer.imemNodes(0).out(0)._1.a <> imemTLAdapter.io.outReq
imemTLAdapter.io.outResp <> outer.imemNodes(0).out(0)._1.d
// Since the individual per-lane TL requests might come back out-of-sync between // Since the individual per-lane TL requests might come back out-of-sync between
// the lanes, but Vortex core expects the lane requests to be synced, // the lanes, but Vortex core expects the lane requests to be synced,
@@ -315,8 +323,10 @@ class VortexTileModuleImp(outer: VortexTile) extends BaseTileModuleImp(outer) {
.map(b => (b.d.bits.source === arb.io.out.bits) && arb.io.out.valid) .map(b => (b.d.bits.source === arb.io.out.bits) && arb.io.out.valid)
.asUInt .asUInt
// connection: VortexBundle <--> sourceGen <--> dmemNodes // connection: VortexBundle <--> VortexTLAdapter <--> dmemNodes
val sourceGens = Seq.tabulate(outer.numLanes) { _ => // @perf: this would duplicate SourceGenerator table for every lane and eat
// up some area
val tlAdapters = Seq.tabulate(outer.numLanes) { _ =>
Module(new VortexTLAdapter( Module(new VortexTLAdapter(
outer.sourceWidth, outer.sourceWidth,
new VortexBundleA(), new VortexBundleA(),
@@ -325,21 +335,21 @@ class VortexTileModuleImp(outer: VortexTile) extends BaseTileModuleImp(outer) {
chiselTypeOf(dmemTLBundles.head.d.bits), chiselTypeOf(dmemTLBundles.head.d.bits),
)) ))
} }
(core.io.dmem.get zip sourceGens) foreach { case (coreMem, sourceGen) => (core.io.dmem.get zip tlAdapters) foreach { case (coreMem, tlAdapter) =>
sourceGen.io.inReq <> coreMem.a tlAdapter.io.inReq <> coreMem.a
coreMem.d <> sourceGen.io.inResp coreMem.d <> tlAdapter.io.inResp
} }
(sourceGens zip dmemTLBundles) foreach { case (sourceGen, tlBundle) => (tlAdapters zip dmemTLBundles) foreach { case (tlAdapter, tlBundle) =>
tlBundle.a <> sourceGen.io.outReq tlBundle.a <> tlAdapter.io.outReq
} }
// using the chosen source id, // using the chosen source id,
// - lie to core that response is not valid if source doesn't match picked // - lie to core that response is not valid if source doesn't match picked
// - lie to downstream that core is not ready if source doesn't match picked // - lie to downstream that core is not ready if source doesn't match picked
(sourceGens zip dmemTLBundles).zipWithIndex.foreach { (tlAdapters zip dmemTLBundles).zipWithIndex.foreach {
case ((sourceGen, tlBundle), i) => case ((tlAdapter, tlBundle), i) =>
sourceGen.io.outResp.bits := tlBundle.d.bits tlAdapter.io.outResp.bits := tlBundle.d.bits
sourceGen.io.outResp.valid := tlBundle.d.valid && matchingSources(i) tlAdapter.io.outResp.valid := tlBundle.d.valid && matchingSources(i)
tlBundle.d.ready := sourceGen.io.outResp.ready && matchingSources(i) tlBundle.d.ready := tlAdapter.io.outResp.ready && matchingSources(i)
} }
// (core.io.dmem.get zip outer.dmemNodes).foreach { case (coreMem, tileNode) => // (core.io.dmem.get zip outer.dmemNodes).foreach { case (coreMem, tileNode) =>