Skip to content

Commit

Permalink
[rtl] Add XiZhiMen for probe monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
sequencer authored and Avimitin committed May 21, 2024
1 parent f3efeef commit fc798ac
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 subsystem/src/LazyT1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
package org.chipsalliance.t1.subsystem

import chisel3._
import chisel3.util.experimental.BoringUtils.bore
import chisel3.experimental.SerializableModuleGenerator
import chisel3.properties.{ClassType, Path, Property}
import freechips.rocketchip.diplomacy.AddressSet
import freechips.rocketchip.subsystem.{BaseSubsystem, InstantiatesHierarchicalElements}
import org.chipsalliance.cde.config._
import org.chipsalliance.t1.rockettile.{AbstractLazyT1, AbstractLazyT1ModuleImp, T1LSUParameter}
import org.chipsalliance.t1.rtl.{T1, T1Parameter}
import org.chipsalliance.t1.rtl.lsu.LSUProbe

case object T1Generator extends Field[SerializableModuleGenerator[T1, T1Parameter]]

Expand All @@ -32,6 +34,37 @@ class LazyT1Imp(outer: LazyT1)(implicit p: Parameters) extends AbstractLazyT1Mod
// We insist using the json config for Vector for uArch tuning.
val t1: T1 = Module(outer.generator.module())

// 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(t1.lsuProbe).suggestName("lsuProbe")
val laneProbes = t1.laneProbes.zipWithIndex.map{case (p, idx) =>
val wire = Wire(p.cloneType)
wire := probe.read(p)
wire
}
val laneVrfProbes = t1.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(_))
}))

t1.request.valid := request.valid
t1.request.bits.instruction := request.bits.instruction
t1.request.bits.src1Data := request.bits.rs1Data
Expand Down

0 comments on commit fc798ac

Please sign in to comment.