Commit 70ab79e2 authored by Yuxiao Mao's avatar Yuxiao Mao
Browse files

Timer: add larger window

parent 39a6efbf
......@@ -33,23 +33,45 @@ class DetectPatternTimerInternal(params: DetectPatternTimerParams)(implicit mp:
// Registed (valid) pack analysis result for multiple slow cycles
val npackSize: Int = params.npackSizeInFastCycles / mp.clockDiv
val npackSize2: Int = npackSize * 2;
val npackSize4: Int = npackSize * 4;
val npackSize8: Int = npackSize * 8;
val npack_timer = RegInit(0.U(npackSize.W)).suggestName("npack_timer")
val npack_timer = RegInit(0.U(npackSize8.W)).suggestName("npack_timer")
val npack_timer_orR = RegInit(false.B)
val npack_timer_orR2 = RegInit(false.B)
val npack_timer_orR4 = RegInit(false.B)
val npack_timer_orR8 = RegInit(false.B)
when (in.pack_has_valid) {
npack_timer := Cat(npack_timer(npackSize-2, 0), in.pack_has_timer)
npack_timer := Cat(npack_timer(npackSize8-2, 0), in.pack_has_timer)
npack_timer_orR := npack_timer(npackSize-2, 0).orR || in.pack_has_timer
npack_timer_orR2 := npack_timer(npackSize2-2, 0).orR || in.pack_has_timer
npack_timer_orR4 := npack_timer(npackSize4-2, 0).orR || in.pack_has_timer
npack_timer_orR8 := npack_timer(npackSize8-2, 0).orR || in.pack_has_timer
}
val atk_timer_timer = Wire(Bool())
val atk_timer_timer2 = Wire(Bool())
val atk_timer_timer4 = Wire(Bool())
val atk_timer_timer8 = Wire(Bool())
atk_timer_timer := npack_timer_orR && in.pack_has_timer && in.isMonitoring
atk_timer_timer2 := npack_timer_orR2 && in.pack_has_timer && in.isMonitoring
atk_timer_timer4 := npack_timer_orR2 && in.pack_has_timer && in.isMonitoring
atk_timer_timer8 := npack_timer_orR2 && in.pack_has_timer && in.isMonitoring
val atk_timer_flush = Wire(Bool())
atk_timer_flush := npack_timer_orR && in.pack_has_flush && in.isMonitoring
override def regmap(offset: Int) =
(if (params.withTimerTimer) RegmapUtil.countEventThreshAlarm(atk_timer_timer, in.resetCounters, offset, "AtkTimerTimer") else Nil) ++
(if (params.withTimerFlush) RegmapUtil.countEventThreshAlarm(atk_timer_flush, in.resetCounters, offset + 0x10, "AtkTimerFlush") else Nil)
(if (params.withTimerTimer) {
RegmapUtil.countEventThreshAlarm(atk_timer_timer, in.resetCounters, offset, "AtkTimerTimer") ++
RegmapUtil.countEvent(atk_timer_timer2, in.resetCounters, offset + 0x10, "AtkTimerTimer2") ++
RegmapUtil.countEvent(atk_timer_timer4, in.resetCounters, offset + 0x14, "AtkTimerTimer4") ++
RegmapUtil.countEvent(atk_timer_timer8, in.resetCounters, offset + 0x18, "AtkTimerTimer8")
} else Nil) ++
(if (params.withTimerFlush) {
RegmapUtil.countEventThreshAlarm(atk_timer_flush, in.resetCounters, offset + 0x80, "AtkTimerFlush")
} else Nil)
}
object DetectPatternTimer {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment