Merge pull request #1461 from ucb-bar/single-clock

Add singleclock broadcast clockbinder
This commit is contained in:
Jerry Zhao
2024-05-28 14:41:30 -07:00
committed by GitHub
2 changed files with 61 additions and 1 deletions

View File

@@ -72,7 +72,7 @@ class WithPLLSelectorDividerClockGenerator(enable: Boolean = true) extends Overr
}
}
})
// This passes all clocks through to the TestHarness
class WithPassthroughClockGenerator extends OverrideLazyIOBinder({
(system: HasChipyardPRCI) => {
@@ -102,6 +102,32 @@ class WithPassthroughClockGenerator extends OverrideLazyIOBinder({
}
})
// Broadcasts a single clock IO to all clock domains. Ignores all requested frequencies
class WithSingleClockBroadcastClockGenerator(freqMHz: Int = 100) extends OverrideLazyIOBinder({
(system: HasChipyardPRCI) => {
implicit val p = GetSystemParameters(system)
val clockGroupsAggregator = LazyModule(new ClockGroupAggregator("single_clock"))
val clockGroupsSourceNode = ClockGroupSourceNode(Seq(ClockGroupSourceParameters()))
system.chiptopClockGroupsNode :*= clockGroupsAggregator.node := clockGroupsSourceNode
InModuleBody {
val clock_wire = Wire(Input(Clock()))
val reset_wire = Wire(Input(AsyncReset()))
val (clock_io, clockIOCell) = IOCell.generateIOFromSignal(clock_wire, "clock", p(IOCellKey))
val (reset_io, resetIOCell) = IOCell.generateIOFromSignal(reset_wire, "reset", p(IOCellKey))
clockGroupsSourceNode.out.foreach { case (bundle, edge) =>
bundle.member.data.foreach { b =>
b.clock := clock_io
b.reset := reset_io
}
}
(Seq(ClockPort(() => clock_io, freqMHz), ResetPort(() => reset_io)), clockIOCell ++ resetIOCell)
}
}
})
class WithClockTapIOCells extends OverrideIOBinder({
(system: CanHaveClockTap) => {
system.clockTapIO.map { tap =>

View File

@@ -0,0 +1,34 @@
package chipyard
import org.chipsalliance.cde.config.{Config}
import freechips.rocketchip.diplomacy._
import freechips.rocketchip.subsystem.{MBUS, SBUS}
import testchipip.soc.{OBUS}
//==================================================
// This file contains examples of the different ways
// clocks can be generated for chiypard designs
//==================================================
// The default constructs IOs for all requested clocks in the chiptopClockGroupsNode
// Note: This is what designs inheriting from AbstractConfig do by default
class DefaultClockingRocketConfig extends Config(
new chipyard.clocking.WithPassthroughClockGenerator ++
new freechips.rocketchip.subsystem.WithNBigCores(1) ++
new chipyard.config.AbstractConfig)
// This is a more physically realistic approach, normally we can't punch out a separate
// pin for each clock domain. The standard "test chip" approach is to punch a few slow clock
// inputs, integrate a PLL, and generate an array of selectors/dividers to configure the
// clocks for each domain. See the source for WithPLLSelectorDividerClockGenerator for more info
class ChipLikeClockingRocketConfig extends Config(
new chipyard.clocking.WithPLLSelectorDividerClockGenerator ++
new freechips.rocketchip.subsystem.WithNBigCores(1) ++
new chipyard.config.AbstractConfig)
// This merges all the clock domains in chiptopClockGroupsNode into one, then generates a single
// clock input pin.
class SingleClockBroadcastRocketConfig extends Config(
new chipyard.clocking.WithSingleClockBroadcastClockGenerator ++
new freechips.rocketchip.subsystem.WithNBigCores(1) ++
new chipyard.config.AbstractConfig)