Skip to content

Commit

Permalink
public events field of EventSet and eventSets field of SuperscalarEve… (
Browse files Browse the repository at this point in the history
#2464)

* 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

* 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
  • Loading branch information
lihsinyi authored May 14, 2020
1 parent ebfe1ff commit 17c09cc
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/main/scala/rocket/Events.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ 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
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") }
Expand Down Expand Up @@ -49,7 +52,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)
Expand Down

0 comments on commit 17c09cc

Please sign in to comment.