Make FPGA flows use the harnessClockInstantiator
This commit is contained in:
@@ -21,7 +21,7 @@ class WithArtyTweaks extends Config(
|
|||||||
new WithArtyJTAGHarnessBinder ++
|
new WithArtyJTAGHarnessBinder ++
|
||||||
new WithArtyUARTHarnessBinder ++
|
new WithArtyUARTHarnessBinder ++
|
||||||
new WithDebugResetPassthrough ++
|
new WithDebugResetPassthrough ++
|
||||||
|
new chipyard.harness.WithAllClocksFromHarnessClockInstantiator ++
|
||||||
new chipyard.config.WithDTSTimebase(32768) ++
|
new chipyard.config.WithDTSTimebase(32768) ++
|
||||||
new testchipip.WithNoSerialTL
|
new testchipip.WithNoSerialTL
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package chipyard.fpga.arty
|
|||||||
import chisel3._
|
import chisel3._
|
||||||
|
|
||||||
import freechips.rocketchip.diplomacy.{LazyModule}
|
import freechips.rocketchip.diplomacy.{LazyModule}
|
||||||
|
import freechips.rocketchip.prci.{ClockBundle, ClockBundleParameters}
|
||||||
import org.chipsalliance.cde.config.{Parameters}
|
import org.chipsalliance.cde.config.{Parameters}
|
||||||
|
|
||||||
import sifive.fpgashells.shell.xilinx.artyshell.{ArtyShell}
|
import sifive.fpgashells.shell.xilinx.artyshell.{ArtyShell}
|
||||||
@@ -36,4 +37,9 @@ class ArtyFPGATestHarness(override implicit val p: Parameters) extends ArtyShell
|
|||||||
lazyDut match { case d: HasIOBinders =>
|
lazyDut match { case d: HasIOBinders =>
|
||||||
ApplyHarnessBinders(this, d.lazySystem, d.portMap)
|
ApplyHarnessBinders(this, d.lazySystem, d.portMap)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val implicitHarnessClockBundle = Wire(new ClockBundle(ClockBundleParameters()))
|
||||||
|
implicitHarnessClockBundle.clock := buildtopClock
|
||||||
|
implicitHarnessClockBundle.reset := buildtopReset
|
||||||
|
harnessClockInstantiator.instantiateHarnessClocks(implicitHarnessClockBundle)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ class WithNoDesignKey extends Config((site, here, up) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
class WithArty100TTweaks extends Config(
|
class WithArty100TTweaks extends Config(
|
||||||
|
new chipyard.harness.WithAllClocksFromHarnessClockInstantiator ++
|
||||||
new WithArty100TUARTTSI ++
|
new WithArty100TUARTTSI ++
|
||||||
new WithArty100TDDRTL ++
|
new WithArty100TDDRTL ++
|
||||||
new WithNoDesignKey ++
|
new WithNoDesignKey ++
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import chisel3.util._
|
|||||||
import freechips.rocketchip.diplomacy._
|
import freechips.rocketchip.diplomacy._
|
||||||
import org.chipsalliance.cde.config.{Parameters}
|
import org.chipsalliance.cde.config.{Parameters}
|
||||||
import freechips.rocketchip.tilelink.{TLClientNode, TLBlockDuringReset}
|
import freechips.rocketchip.tilelink.{TLClientNode, TLBlockDuringReset}
|
||||||
|
import freechips.rocketchip.prci.{ClockBundle, ClockBundleParameters}
|
||||||
|
|
||||||
import sifive.fpgashells.shell.xilinx._
|
import sifive.fpgashells.shell.xilinx._
|
||||||
import sifive.fpgashells.shell._
|
import sifive.fpgashells.shell._
|
||||||
@@ -87,6 +88,11 @@ class Arty100THarness(override implicit val p: Parameters) extends Arty100TShell
|
|||||||
chiptop match { case d: HasIOBinders =>
|
chiptop match { case d: HasIOBinders =>
|
||||||
ApplyHarnessBinders(this, d.lazySystem, d.portMap)
|
ApplyHarnessBinders(this, d.lazySystem, d.portMap)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val implicitHarnessClockBundle = Wire(new ClockBundle(ClockBundleParameters()))
|
||||||
|
implicitHarnessClockBundle.clock := buildtopClock
|
||||||
|
implicitHarnessClockBundle.reset := buildtopReset
|
||||||
|
harnessClockInstantiator.instantiateHarnessClocks(implicitHarnessClockBundle)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ class WithSystemModifications extends Config((site, here, up) => {
|
|||||||
|
|
||||||
class WithVC707Tweaks extends Config (
|
class WithVC707Tweaks extends Config (
|
||||||
// harness binders
|
// harness binders
|
||||||
|
new chipyard.harness.WithAllClocksFromHarnessClockInstantiator ++
|
||||||
new WithVC707UARTHarnessBinder ++
|
new WithVC707UARTHarnessBinder ++
|
||||||
new WithVC707SPISDCardHarnessBinder ++
|
new WithVC707SPISDCardHarnessBinder ++
|
||||||
new WithVC707DDRMemHarnessBinder ++
|
new WithVC707DDRMemHarnessBinder ++
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import chisel3.experimental.{IO}
|
|||||||
import freechips.rocketchip.diplomacy.{LazyModule, LazyRawModuleImp, BundleBridgeSource}
|
import freechips.rocketchip.diplomacy.{LazyModule, LazyRawModuleImp, BundleBridgeSource}
|
||||||
import org.chipsalliance.cde.config.{Parameters}
|
import org.chipsalliance.cde.config.{Parameters}
|
||||||
import freechips.rocketchip.tilelink.{TLClientNode}
|
import freechips.rocketchip.tilelink.{TLClientNode}
|
||||||
|
import freechips.rocketchip.prci.{ClockBundle, ClockBundleParameters}
|
||||||
|
|
||||||
import sifive.fpgashells.shell.xilinx.{VC707Shell, UARTVC707ShellPlacer, PCIeVC707ShellPlacer, ChipLinkVC707PlacedOverlay}
|
import sifive.fpgashells.shell.xilinx.{VC707Shell, UARTVC707ShellPlacer, PCIeVC707ShellPlacer, ChipLinkVC707PlacedOverlay}
|
||||||
import sifive.fpgashells.ip.xilinx.{IBUF, PowerOnResetFPGAOnly}
|
import sifive.fpgashells.ip.xilinx.{IBUF, PowerOnResetFPGAOnly}
|
||||||
@@ -132,4 +133,9 @@ class VC707FPGATestHarnessImp(_outer: VC707FPGATestHarness) extends LazyRawModul
|
|||||||
// check the top-level reference clock is equal to the default
|
// check the top-level reference clock is equal to the default
|
||||||
// non-exhaustive since you need all ChipTop clocks to equal the default
|
// non-exhaustive since you need all ChipTop clocks to equal the default
|
||||||
require(getRefClockFreq == p(DefaultClockFrequencyKey))
|
require(getRefClockFreq == p(DefaultClockFrequencyKey))
|
||||||
|
|
||||||
|
val implicitHarnessClockBundle = Wire(new ClockBundle(ClockBundleParameters()))
|
||||||
|
implicitHarnessClockBundle.clock := buildtopClock
|
||||||
|
implicitHarnessClockBundle.reset := buildtopReset
|
||||||
|
harnessClockInstantiator.instantiateHarnessClocks(implicitHarnessClockBundle)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ class WithSystemModifications extends Config((site, here, up) => {
|
|||||||
// DOC include start: AbstractVCU118 and Rocket
|
// DOC include start: AbstractVCU118 and Rocket
|
||||||
class WithVCU118Tweaks extends Config(
|
class WithVCU118Tweaks extends Config(
|
||||||
// harness binders
|
// harness binders
|
||||||
|
new chipyard.harness.WithAllClocksFromHarnessClockInstantiator ++
|
||||||
new WithUART ++
|
new WithUART ++
|
||||||
new WithSPISDCard ++
|
new WithSPISDCard ++
|
||||||
new WithDDRMem ++
|
new WithDDRMem ++
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import chisel3.experimental.{IO}
|
|||||||
import freechips.rocketchip.diplomacy.{LazyModule, LazyRawModuleImp, BundleBridgeSource}
|
import freechips.rocketchip.diplomacy.{LazyModule, LazyRawModuleImp, BundleBridgeSource}
|
||||||
import org.chipsalliance.cde.config.{Parameters}
|
import org.chipsalliance.cde.config.{Parameters}
|
||||||
import freechips.rocketchip.tilelink.{TLClientNode}
|
import freechips.rocketchip.tilelink.{TLClientNode}
|
||||||
|
import freechips.rocketchip.prci.{ClockBundle, ClockBundleParameters}
|
||||||
|
|
||||||
import sifive.fpgashells.shell.xilinx._
|
import sifive.fpgashells.shell.xilinx._
|
||||||
import sifive.fpgashells.ip.xilinx.{IBUF, PowerOnResetFPGAOnly}
|
import sifive.fpgashells.ip.xilinx.{IBUF, PowerOnResetFPGAOnly}
|
||||||
@@ -134,4 +135,9 @@ class VCU118FPGATestHarnessImp(_outer: VCU118FPGATestHarness) extends LazyRawMod
|
|||||||
// check the top-level reference clock is equal to the default
|
// check the top-level reference clock is equal to the default
|
||||||
// non-exhaustive since you need all ChipTop clocks to equal the default
|
// non-exhaustive since you need all ChipTop clocks to equal the default
|
||||||
require(getRefClockFreq == p(DefaultClockFrequencyKey))
|
require(getRefClockFreq == p(DefaultClockFrequencyKey))
|
||||||
|
|
||||||
|
val implicitHarnessClockBundle = Wire(new ClockBundle(ClockBundleParameters()))
|
||||||
|
implicitHarnessClockBundle.clock := buildtopClock
|
||||||
|
implicitHarnessClockBundle.reset := buildtopReset
|
||||||
|
harnessClockInstantiator.instantiateHarnessClocks(implicitHarnessClockBundle)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,3 +83,18 @@ class AbsoluteFreqHarnessClockInstantiator extends HarnessClockInstantiator {
|
|||||||
class WithAbsoluteFreqHarnessClockInstantiator extends Config((site, here, up) => {
|
class WithAbsoluteFreqHarnessClockInstantiator extends Config((site, here, up) => {
|
||||||
case HarnessClockInstantiatorKey => () => new AbsoluteFreqHarnessClockInstantiator
|
case HarnessClockInstantiatorKey => () => new AbsoluteFreqHarnessClockInstantiator
|
||||||
})
|
})
|
||||||
|
|
||||||
|
class AllClocksFromHarnessClockInstantiator extends HarnessClockInstantiator {
|
||||||
|
def instantiateHarnessClocks(refClock: ClockBundle): Unit = {
|
||||||
|
val freqs = _clockMap.map(_._2._1)
|
||||||
|
freqs.tail.foreach(t => require(t == freqs.head, s"Mismatching clocks $t != ${freqs.head}"))
|
||||||
|
for ((_, (_, bundle)) <- _clockMap) {
|
||||||
|
bundle.clock := refClock.clock
|
||||||
|
bundle.reset := refClock.reset
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class WithAllClocksFromHarnessClockInstantiator extends Config((site, here, up) => {
|
||||||
|
case HarnessClockInstantiatorKey => () => new AllClocksFromHarnessClockInstantiator
|
||||||
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user