From b4117f283905d51fa4caf22722c02b22ce28dfd3 Mon Sep 17 00:00:00 2001 From: Hsinyi Lee Date: Tue, 12 May 2020 18:12:00 +0800 Subject: [PATCH 1/2] public events field of EventSet and eventSets field of SuperscalarEventSets and apply hits of EventSet when EventSet is constructed, so events in EventSet and SuperscalarEventSets could be monitor --- src/main/scala/rocket/Events.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/scala/rocket/Events.scala b/src/main/scala/rocket/Events.scala index 9c7da8a5a5f..6e909eb927d 100644 --- a/src/main/scala/rocket/Events.scala +++ b/src/main/scala/rocket/Events.scala @@ -7,9 +7,9 @@ import Chisel._ import freechips.rocketchip.util._ import freechips.rocketchip.util.property._ -class EventSet(gate: (UInt, UInt) => Bool, events: Seq[(String, () => Bool)]) { +class EventSet(gate: (UInt, UInt) => Bool, val events: Seq[(String, () => Bool)]) { def size = events.size - def hits = events.map(_._2()).asUInt + val hits = events.map(_._2()).asUInt def check(mask: UInt) = gate(mask, hits) def dump() { for (((name, _), i) <- events.zipWithIndex) @@ -49,7 +49,7 @@ class EventSets(val eventSets: Seq[EventSet]) { private def eventSetIdBits = 8 } -class SuperscalarEventSets(eventSets: Seq[(Seq[EventSet], (UInt, UInt) => UInt)]) { +class SuperscalarEventSets(val eventSets: Seq[(Seq[EventSet], (UInt, UInt) => UInt)]) { def evaluate(eventSel: UInt): UInt = { val (set, mask) = decode(eventSel) val sets = for ((sets, reducer) <- eventSets) From 7902237d7a2ef946b252e331a750b0c53dc1c9db Mon Sep 17 00:00:00 2001 From: Hsinyi Lee Date: Thu, 14 May 2020 10:53:18 +0800 Subject: [PATCH 2/2] Fix build failed When evaluating EventSet.hits, event signals may not ready. change EventSet.hits to be Wire and evaluate in EventSet.check function, signals should be ready when EventSet.check is called --- src/main/scala/rocket/Events.scala | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/scala/rocket/Events.scala b/src/main/scala/rocket/Events.scala index 6e909eb927d..cd5ac938251 100644 --- a/src/main/scala/rocket/Events.scala +++ b/src/main/scala/rocket/Events.scala @@ -9,8 +9,11 @@ import freechips.rocketchip.util.property._ class EventSet(gate: (UInt, UInt) => Bool, val events: Seq[(String, () => Bool)]) { def size = events.size - val hits = events.map(_._2()).asUInt - def check(mask: UInt) = gate(mask, hits) + val hits = Wire(Vec(size, Bool())) + def check(mask: UInt) = { + hits := events.map(_._2()) + gate(mask, hits.asUInt) + } def dump() { for (((name, _), i) <- events.zipWithIndex) when (check(1.U << i)) { printf(s"Event $name\n") }