package sifive.blocks.devices.mockaon
import Chisel._
-import diplomacy.LazyModule
-import rocketchip.{TopNetwork,TopNetworkModule}
-import uncore.tilelink2.{IntXing, TLAsyncCrossingSource, TLFragmenter}
-import coreplex._
+import freechips.rocketchip.config.Field
+import freechips.rocketchip.diplomacy.{LazyModule, LazyMultiIOModuleImp}
+import freechips.rocketchip.chip.{HasSystemNetworks, HasCoreplexRISCVPlatform}
+import freechips.rocketchip.tilelink.{IntXing, TLAsyncCrossingSource, TLFragmenter}
+import freechips.rocketchip.util.ResetCatchAndSync
-trait PeripheryMockAON extends TopNetwork {
- val mockAONConfig: MockAONConfig
- val coreplex: CoreplexRISCVPlatform
+case object PeripheryMockAONKey extends Field[MockAONParams]
+trait HasPeripheryMockAON extends HasSystemNetworks with HasCoreplexRISCVPlatform {
// We override the clock & Reset here so that all synchronizers, etc
// are in the proper clock domain.
- val aon = LazyModule(new MockAONWrapper(mockAONConfig))
+ val mockAONParams= p(PeripheryMockAONKey)
+ val aon = LazyModule(new MockAONWrapper(peripheryBusBytes, mockAONParams))
val aon_int = LazyModule(new IntXing)
- aon.node := TLAsyncCrossingSource()(TLFragmenter(peripheryBusConfig.beatBytes, cacheBlockBytes)(peripheryBus.node))
+ aon.node := TLAsyncCrossingSource()(TLFragmenter(peripheryBusBytes, cacheBlockBytes)(peripheryBus.node))
aon_int.intnode := aon.intnode
intBus.intnode := aon_int.intnode
}
-trait PeripheryMockAONBundle {
- val aon = new MockAONWrapperBundle()
+trait HasPeripheryMockAONBundle {
+ val aon: MockAONWrapperBundle
+ def coreResetCatchAndSync(core_clock: Clock) = {
+ ResetCatchAndSync(core_clock, aon.rsts.corerst, 20)
+ }
}
-trait PeripheryMockAONModule {
- this: TopNetworkModule {
- val outer: PeripheryMockAON
- val io: PeripheryMockAONBundle
- } =>
+trait HasPeripheryMockAONModuleImp extends LazyMultiIOModuleImp with HasPeripheryMockAONBundle {
+ val outer: HasPeripheryMockAON
+ val aon = IO(new MockAONWrapperBundle)
- io.aon <> outer.aon.module.io
+ aon <> outer.aon.module.io
// Explicit clock & reset are unused in MockAONWrapper.
// Tie to check this assumption.
outer.coreplex.module.io.rtcToggle := outer.aon.module.io.rtc.asUInt.toBool
+ outer.aon.module.io.ndreset := outer.coreplex.module.io.ndreset
}