xref: /XiangShan/src/main/scala/utils/DebugIdentityNode.scala (revision 618fb109099cc1d271e72520857cee13429b073c)
1package utils
2
3import chisel3._
4import chipsalliance.rocketchip.config.Parameters
5import freechips.rocketchip.diplomacy.{LazyModule, LazyModuleImp}
6import freechips.rocketchip.tilelink.{TLClientNode, TLIdentityNode, TLMasterParameters, TLMasterPortParameters}
7
8class DebugIdentityNode()(implicit p: Parameters) extends LazyModule {
9
10  val node = TLIdentityNode()
11
12  val n = TLClientNode(Seq(TLMasterPortParameters.v1(
13    Seq(
14      TLMasterParameters.v1("debug node")
15    )
16  )))
17
18  lazy val module = new LazyModuleImp(this){
19    val (out, _) = node.out(0)
20    val (in, _) = node.in(0)
21    when(in.a.fire()){
22      printf(p"[A] addr: ${Hexadecimal(in.a.bits.address)} " +
23        p"opcode: ${in.a.bits.opcode} data: ${Hexadecimal(in.a.bits.data)}\n"
24      )
25    }
26    when(in.d.fire()){
27      printf(p"[D] opcode: ${in.d.bits.opcode} data: ${Hexadecimal(in.d.bits.data)}\n")
28    }
29  }
30}
31