From: Shreesha Srinath Date: Thu, 3 Aug 2017 01:11:05 +0000 (-0700) Subject: mockaon: Adds logic to detect external rtc toggles X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=26dd0af657a37584506f41746cdd5b2eeb43d969;p=sifive-blocks.git mockaon: Adds logic to detect external rtc toggles --- diff --git a/src/main/scala/devices/mockaon/MockAONPeriphery.scala b/src/main/scala/devices/mockaon/MockAONPeriphery.scala index 8b6303e..3f0d326 100644 --- a/src/main/scala/devices/mockaon/MockAONPeriphery.scala +++ b/src/main/scala/devices/mockaon/MockAONPeriphery.scala @@ -42,7 +42,12 @@ trait HasPeripheryMockAONModuleImp extends LazyMultiIOModuleImp with HasPeripher outer.aon.module.clock := Bool(false).asClock 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 }