xref: /XiangShan/src/main/scala/utils/TLDump.scala (revision 24b11ca37f2240447b17e9d86b260876a9254f90)
1package utils
2
3import chisel3._
4import freechips.rocketchip.tilelink.{TLBundle, TLBundleA, TLBundleB, TLBundleC, TLBundleD, TLBundleE, TLChannel}
5
6trait HasTLDump {
7
8  implicit class dumpA(a: TLBundleA) {
9    def dump =
10      printf(
11        a.channelName + " opcode: %x param: %x size: %x source: %d address: %x mask: %x data: %x corrupt: %b\n",
12        a.opcode, a.param, a.size, a.source, a.address, a.mask, a.data, a.corrupt
13      )
14  }
15
16  implicit class dumpB(b: TLBundleB) {
17    def dump =
18      printf(
19        b.channelName + " opcode: %x param: %x size: %x source: %d address: %x mask: %x data: %x corrupt: %b\n",
20        b.opcode, b.param, b.size, b.source, b.address, b.mask, b.data, b.corrupt
21      )
22  }
23
24  implicit class dumpC(c: TLBundleC) {
25    def dump =
26      printf(
27        c.channelName + " opcode: %x param: %x size: %x source: %d address: %x data: %x corrupt: %b\n",
28        c.opcode, c.param, c.size, c.source, c.address, c.data, c.corrupt
29      )
30  }
31
32  implicit class dumpD(d: TLBundleD) {
33    def dump =
34      printf(
35        d.channelName + " opcode: %x param: %x size: %x source: %d sink: %d denied: %b data: %x corrupt: %b\n",
36        d.opcode, d.param, d.size, d.source, d.sink, d.denied, d.data, d.corrupt
37      )
38  }
39
40  implicit class dumpE(e: TLBundleE) {
41    def dump =
42      printf(e.channelName + " sink: %d\n", e.sink)
43  }
44}
45