1
0

mockaon: Adds logic to detect external rtc toggles

This commit is contained in:
Shreesha Srinath 2017-08-02 18:11:05 -07:00
parent 7f368987a8
commit 26dd0af657

View File

@ -42,7 +42,12 @@ trait HasPeripheryMockAONModuleImp extends LazyMultiIOModuleImp with HasPeripher
outer.aon.module.clock := Bool(false).asClock outer.aon.module.clock := Bool(false).asClock
outer.aon.module.reset := Bool(true) outer.aon.module.reset := Bool(true)
outer.clint.module.io.rtcTick := outer.aon.module.io.rtc.asUInt.toBool // Synchronize the external toggle into the clint
val rtc_sync = ShiftRegister(outer.aon.module.io.rtc.asUInt.toBool, 3)
val rtc_last = Reg(init = Bool(false), next=rtc_sync)
val rtc_tick = Reg(init = Bool(false), next=(rtc_sync & (~rtc_last)))
outer.clint.module.io.rtcTick := rtc_tick
outer.aon.module.io.ndreset := outer.debug.module.io.ctrl.ndreset outer.aon.module.io.ndreset := outer.debug.module.io.ctrl.ndreset
} }