Making bus connections

134 views
Skip to first unread message

michael etzkorn

unread,
Sep 1, 2021, 4:32:32 PM9/1/21
to Chipyard
I'm relatively new to Chisel, Chipyard, Diplomacy, TileLink, etc. I'm hoping to introduce an XDMA to my SoC which is defined in `fpga-shells`. 

The values in the XDMA module are defined as Inward and Outward TileLink nodes.
```
  val slave: TLInwardNode =
    (imp.slave
      := AXI4Buffer()
      := AXI4UserYanker()
      := AXI4Deinterleaver(p(CacheBlockBytes))
      := AXI4IdIndexer(idBits=c.sIDBits)
      := TLToAXI4(adapterName = Some("pcie-slave")))

  val control: TLInwardNode =
    (imp.control
      := AXI4Buffer()
      := AXI4UserYanker(capMaxFlight = Some(2))
      := TLToAXI4()
      := TLFragmenter(4, p(CacheBlockBytes), holdFirstDeny = true))

  val master: TLOutwardNode =
    (TLWidthWidget(c.busBytes)
      := AXI4ToTL()
      := AXI4UserYanker(capMaxFlight=Some(16))
      := AXI4Fragmenter()
      := AXI4IdIndexer(idBits=2)
      := imp.master)

```

Here's my attempt at the trait:

```
trait CanHaveXDMA {this: BaseSubsystem =>
    implicit val p: Parameters
    private val portName = "xdma"

    p(XDMAKey).map{ k =>
        val XDMA = LazyModule(new XDMA(p(XDMAKey))(p))
        //pbus.fromPort(Some("pcie-slave"))() := XDMA.slave
        pbus.toVariableWidthSlave(Some("pcie-slave")) {XDMA.slave :*= _}
        fbus.fromPort(Some("xdma"))() := XDMA.master
        cbus.toVariableWidthSlave(s"port_named_$portName") {
            XDMA.control
        }
        //interrupt has to be connected
    }
}

```

Abe mentioned on github that I also might need to do something from the chiptop level like the TL backing memory does. chipyard/System.scala at 9d055fdac638ab90735cbde42fd2d86355eb260b · ucb-bar/chipyard (github.com) but I'm still trying to understand what it does that I can't do from DigitalTop specifically. I'll look into where connectTo, connectFrom, fromPort, toPort, toVariableWidthSlave and all the other functions related to this are defined and try to make sense of which one is best for this situation (and for future situations). Thanks for the help!

Michael Etzkorn

michael etzkorn

unread,
Sep 1, 2021, 4:40:22 PM9/1/21
to Chipyard
I'm also new to using google forums, so I'm figuring out how to embed code. This (naturally) had errors in it, and I'm experimenting to fix them now. Any advice or resources to read on making connections to the busses of Chipyard / Rocketchip is greatly appreciated!

michael etzkorn

unread,
Sep 1, 2021, 4:42:08 PM9/1/21
to Chipyard
Seems like nodes.scala is well documented. Starting there. 
Reply all
Reply to author
Forward
0 new messages