Check that HarnessClockInstantiator doesn't receive requests for similarly-named-clocks with different frequencies (#1460)

This commit is contained in:
Jerry Zhao
2023-05-05 17:09:07 -07:00
committed by GitHub
parent b8ccb7d4f6
commit 257e7d7507

View File

@@ -21,9 +21,15 @@ trait HarnessClockInstantiator {
// request a clock bundle at a particular frequency
def requestClockBundle(name: String, freqRequested: Double): ClockBundle = {
val clockBundle = Wire(new ClockBundle(ClockBundleParameters()))
_clockMap(name) = (freqRequested, clockBundle)
clockBundle
if (_clockMap.contains(name)) {
require(freqRequested == _clockMap(name)._1,
s"Request clock freq = $freqRequested != previously requested ${_clockMap(name)._2} for requested clock $name")
_clockMap(name)._2
} else {
val clockBundle = Wire(new ClockBundle(ClockBundleParameters()))
_clockMap(name) = (freqRequested, clockBundle)
clockBundle
}
}
// refClock is the clock generated by TestDriver that is