[clocks] Update dealiaser based on feedback

This commit is contained in:
David Biancolin
2020-09-17 11:33:26 -07:00
parent cfa7e30d95
commit 6a26a350ee

View File

@@ -9,7 +9,7 @@ import freechips.rocketchip.prci._
/**
* Somewhat hacky. Since not all clocks in a clock group specify a taken frequency
* current, this LazyModule attempts to dealias them, by finding a specified
* clock whose name has the longest matching prefix.
* clock with a matching name.
*
* Perhaps another, simpler solution would be to pass a default.
*
@@ -30,17 +30,16 @@ class ClockGroupDealiaser(name: String)(implicit p: Parameters) extends LazyModu
val node = ClockGroupDealiaserNode()
lazy val module = new LazyRawModuleImp(this) {
require(node.out.size == 1, "Must use a ClockGroupAggregator")
require(node.out.size == 1 && node.in.size == 1,
"ClockGroupDealiaser requires a single ClockGroup, please use a ClockGroupAggregator")
val (outClocks, e @ ClockGroupEdgeParameters(_, outSinkParams, _, _)) = node.out.head
val (inClocks, ClockGroupEdgeParameters(_, inSinkParams, _, _)) = node.in.head
val inMap = inClocks.member.data.zip(inSinkParams.members).map({ case (b, p) => p.name -> b}).toMap
for (((outBName, outB), outName) <- outClocks.member.elements.zip(outSinkParams.members.map(_.name))) {
val inClock = inMap.getOrElse(outName, throw new Exception("""
| No clock in input group with name: Option matching ${outName}. At least one clock
| No clock in input group with name option matching ${outName}. At least one clock
| with the same must specify a frequency in its take parameter.""".stripMargin))
// This will be removed.
dontTouch(outB)
outB := inClock
}
}