Skip to content

Commit

Permalink
[monitor] Add XiZhiMen for probe monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
sequencer committed Apr 24, 2024
1 parent 6f9388a commit 1fccd43
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ipemu/src/TestBench.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package org.chipsalliance.t1.ipemu
import chisel3._
import chisel3.experimental.SerializableModuleGenerator
import chisel3.probe._
import chisel3.util.experimental.BoringUtils.bore
import org.chipsalliance.t1.ipemu.dpi._
import org.chipsalliance.t1.rtl.{T1, T1Parameter}

Expand Down Expand Up @@ -38,6 +39,7 @@ class TestBench(generator: SerializableModuleGenerator[T1, T1Parameter]) extends
val laneProbes = dut.laneProbes.zipWithIndex.map{case (p, idx) =>
val wire = Wire(p.cloneType).suggestName(s"lane${idx}Probe")
wire := probe.read(p)
wire
}

val laneVrfProbes = dut.laneVrfProbes.zipWithIndex.map{case (p, idx) =>
Expand All @@ -48,6 +50,18 @@ class TestBench(generator: SerializableModuleGenerator[T1, T1Parameter]) extends

val t1Probe = probe.read(dut.t1Probe).suggestName("instructionCountProbe")

// Monitor
withClockAndReset(clock, reset)(Module(new Module {
// h/t: GrandCentral
override def desiredName: String = "XiZhiMen"
val lsuProbeMonitor = bore(lsuProbe)
dontTouch(lsuProbeMonitor)
val laneProbesMonitor = laneProbes.map(bore(_))
laneProbesMonitor.foreach(dontTouch(_))
val laneVrfProbesMonitor = laneVrfProbes.map(bore(_))
laneVrfProbesMonitor.foreach(dontTouch(_))
}))

// Monitors
// TODO: These monitors should be purged out after offline difftest is landed
val peekLsuEnq = Module(new PeekLsuEnq(PeekLsuEnqParameter(dut.parameter.lsuParameters.lsuMSHRSize, latPeekLsuEnq)))
Expand Down
33 changes: 33 additions & 0 deletions t1/src/VectorWrapper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ package org.chipsalliance.t1.rtl
import chisel3._
import tilelink._
import chisel3.util._
import chisel3.util.experimental.BoringUtils.bore
import org.chipsalliance.t1.rtl.lsu.LSUProbe

class InstructionQueueBundle(parameter: T1Parameter) extends Bundle {
val instruction = new VRequest(parameter.xLen)
Expand Down Expand Up @@ -39,4 +41,35 @@ class VectorWrapper(parameter: T1Parameter) extends Module {

response := vector.response
vector.storeBufferClear := storeBufferClear

// Since T1 doesn't split the interface and implementations into two packages.
// we should consider doing this in the future. But now we just instantiate Xizhimen here.
// this remind me that, for all Modules, being a FixedIOModule is really important.
// that makes us being able to split def/impl easily.
// In the future plan, we will pull Xizhimen up to RenMinGuangChang which will also include Monitor modules from Scalar.

// Monitor
val lsuProbe = probe.read(vector.lsuProbe).suggestName("lsuProbe")
val laneProbes = vector.laneProbes.zipWithIndex.map{case (p, idx) =>
val wire = Wire(p.cloneType)
wire := probe.read(p)
wire
}
val laneVrfProbes = vector.laneVrfProbes.zipWithIndex.map{case (p, idx) =>
val wire = Wire(p.cloneType).suggestName(s"lane${idx}VrfProbe")
wire := probe.read(p)
wire
}

// TODO: gather XiZhiMen into a module, making XiZhiMen into an interface package.
withClockAndReset(clock, reset)(Module(new Module {
// h/t: GrandCentral
override def desiredName: String = "XiZhiMen"
val lsuProbeMonitor: LSUProbe = bore(lsuProbe)
dontTouch(lsuProbeMonitor)
val laneProbesMonitor = laneProbes.map(bore(_))
laneProbesMonitor.foreach(dontTouch(_))
val laneVrfProbesMonitor = laneVrfProbes.map(bore(_))
laneVrfProbesMonitor.foreach(dontTouch(_))
}))
}

0 comments on commit 1fccd43

Please sign in to comment.