1
0
Fork 0

Add method to print perf events

This commit is contained in:
Andrew Waterman 2017-07-25 15:14:15 -07:00
parent 5df8f0d1ea
commit 86ccd935fc
1 changed files with 5 additions and 1 deletions

View File

@ -10,9 +10,13 @@ class EventSet(gate: (UInt, UInt) => Bool, events: Seq[(String, () => Bool)]) {
def size = events.size
def hits = events.map(_._2()).asUInt
def check(mask: UInt) = gate(mask, hits)
def dump() {
for (((name, _), i) <- events.zipWithIndex)
when (check(1.U << i)) { printf(s"Event $name\n") }
}
}
class EventSets(eventSets: Seq[EventSet]) {
class EventSets(val eventSets: Seq[EventSet]) {
def maskEventSelector(eventSel: UInt): UInt = {
// allow full associativity between counters and event sets (for now?)
val setMask = (BigInt(1) << log2Ceil(eventSets.size)) - 1