fallback for hint select
This commit is contained in:
@@ -9,8 +9,12 @@ import org.chipsalliance.diplomacy.ValName
|
|||||||
import org.chipsalliance.diplomacy.lazymodule._
|
import org.chipsalliance.diplomacy.lazymodule._
|
||||||
import org.chipsalliance.diplomacy.nodes.{RenderedEdge, SimpleNodeImp, SinkNode, SourceNode}
|
import org.chipsalliance.diplomacy.nodes.{RenderedEdge, SimpleNodeImp, SinkNode, SourceNode}
|
||||||
|
|
||||||
object ExtPolicyNodeImp extends SimpleNodeImp[Int, Int, Int, UInt] {
|
class ExtPolicyBundle(x: Int) extends Bundle {
|
||||||
def bundle(x: Int) = UInt(x.W)
|
val hint = Output(UInt(x.W))
|
||||||
|
val actual = Input(UInt(x.W))
|
||||||
|
}
|
||||||
|
object ExtPolicyNodeImp extends SimpleNodeImp[Int, Int, Int, ExtPolicyBundle] {
|
||||||
|
def bundle(x: Int) = new ExtPolicyBundle(x)
|
||||||
def edge(x: Int, y: Int, p: Parameters, sourceInfo: SourceInfo): Int = x
|
def edge(x: Int, y: Int, p: Parameters, sourceInfo: SourceInfo): Int = x
|
||||||
def render(x: Int): RenderedEdge = RenderedEdge("ffffff")
|
def render(x: Int): RenderedEdge = RenderedEdge("ffffff")
|
||||||
}
|
}
|
||||||
@@ -23,17 +27,12 @@ class XbarWithExtPolicy(nameSuffix: Option[String] = None)
|
|||||||
|
|
||||||
class ImplChild extends Impl {
|
class ImplChild extends Impl {
|
||||||
val policy: TLArbiter.Policy = (width, valids, select) => {
|
val policy: TLArbiter.Policy = (width, valids, select) => {
|
||||||
val readys = policySlaveNode.in.head._1
|
val in = policySlaveNode.in.head._1
|
||||||
Mux((valids & readys).orR,
|
val hintHit = (valids & in.hint).orR
|
||||||
readys, // take hint
|
val fallback = TLArbiter.lowestIndexFirst(width, valids, !hintHit && select)
|
||||||
TLArbiter.lowestIndexFirst(width, valids, select)
|
in.actual := select.asTypeOf(in.actual.cloneType)
|
||||||
)
|
Mux(hintHit, in.hint, fallback)
|
||||||
// readys & VecInit.fill(width)(VecInit((valids.asBools zip readys.asBools).map {
|
|
||||||
// case (v, r) => r || !v
|
|
||||||
// }).asUInt.andR).asUInt
|
|
||||||
}
|
}
|
||||||
// val wide_bundle = TLBundleParameters.union((node.in ++ node.out).map(_._2.bundle))
|
|
||||||
// override def desiredName = (Seq("TLXbar") ++ nameSuffix ++ Seq(s"i${node.in.size}_o${node.out.size}_${wide_bundle.shortName}")).mkString("_")
|
|
||||||
TLXbar.circuit(policy, node.in, node.out)
|
TLXbar.circuit(policy, node.in, node.out)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -671,11 +671,26 @@ class RadianceClusterModuleImp(outer: RadianceCluster) extends ClusterModuleImp(
|
|||||||
ws := TLArbiter.roundRobin(vs.getWidth, vs, uniform_fires(rw)(bid).asUInt.orR)
|
ws := TLArbiter.roundRobin(vs.getWidth, vs, uniform_fires(rw)(bid).asUInt.orR)
|
||||||
}
|
}
|
||||||
// mask valid into xbar to prevent triggering assertion
|
// mask valid into xbar to prevent triggering assertion
|
||||||
(word_selects_1h zip outer.uniform_nodes_in).foreach { case (ws, ui) =>
|
// (word_selects_1h zip outer.uniform_nodes_in).foreach { case (ws, ui) =>
|
||||||
ui(bid).foreach { sources =>
|
// ui(bid).foreach { sources =>
|
||||||
|
// val in_valid = sources.map(_.in.head._1.a.valid)
|
||||||
|
// val out_valid = sources.map(_.out.head._1.a.valid)
|
||||||
|
// val ws_actual = Mux((ws & VecInit(in_valid).asUInt).orR,
|
||||||
|
// ws, TLArbiter.roundRobin(
|
||||||
|
// in_valid.length, VecInit(in_valid).asUInt, VecInit(sources.map(_.in.head._1.a.fire)).asUInt.orR))
|
||||||
|
// (in_valid lazyZip out_valid lazyZip ws_actual.asBools).foreach { case (iv, ov, sel) =>
|
||||||
|
// ov := iv && sel // only present output valid if input is selected
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
(word_selects_1h lazyZip outer.uniform_policy_nodes lazyZip outer.uniform_nodes_in).foreach { case (ws, pn, ui) =>
|
||||||
|
(pn(bid) zip ui(bid)).foreach { case (policies, sources) =>
|
||||||
val in_valid = sources.map(_.in.head._1.a.valid)
|
val in_valid = sources.map(_.in.head._1.a.valid)
|
||||||
val out_valid = sources.map(_.out.head._1.a.valid)
|
val out_valid = sources.map(_.out.head._1.a.valid)
|
||||||
(in_valid lazyZip out_valid lazyZip ws.asBools).foreach { case (iv, ov, sel) =>
|
val hint_hit = (ws & VecInit(in_valid).asUInt).orR
|
||||||
|
val ws_actual = Mux(hint_hit, ws, TLArbiter.lowestIndexFirst(
|
||||||
|
in_valid.length, VecInit(in_valid).asUInt, hint_hit && policies.out.head._1.actual(0)))
|
||||||
|
(in_valid lazyZip out_valid lazyZip ws_actual.asBools).foreach { case (iv, ov, sel) =>
|
||||||
ov := iv && sel // only present output valid if input is selected
|
ov := iv && sel // only present output valid if input is selected
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -683,8 +698,7 @@ class RadianceClusterModuleImp(outer: RadianceCluster) extends ClusterModuleImp(
|
|||||||
|
|
||||||
(outer.uniform_policy_nodes zip word_selects_1h).zipWithIndex.foreach { case ((nodes_bw, ws), rw) =>
|
(outer.uniform_policy_nodes zip word_selects_1h).zipWithIndex.foreach { case ((nodes_bw, ws), rw) =>
|
||||||
nodes_bw(bid).foreach { policy =>
|
nodes_bw(bid).foreach { policy =>
|
||||||
println(s"policy out ${policy.out.head._1.getWidth}, word select ${ws.getWidth}")
|
policy.out.head._1.hint := ws
|
||||||
policy.out.head._1 := ws
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user