X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmain%2Fscala%2Fdevices%2Fmockaon%2FMockAONPeriphery.scala;fp=src%2Fmain%2Fscala%2Fdevices%2Fmockaon%2FMockAONPeriphery.scala;h=3f0d3268b3485c7c0deb80e9ac9869b9f14ddb9b;hb=5b74df20a19cba359e5768ab358a1f320adf40ff;hp=8b6303e2ffb32f03abe1e8cecfe88aef2548216c;hpb=7f368987a8f9135b8fd3ec80cff5f62a42fbd144;p=sifive-blocks.git 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 }