chiselrocket-chip

How to export TileLink node to LazyModule's output and generate respective verilog file


I am trying to create a simple module with tilelink client connected to modules output. How to do it? Have been trying to figure it out for 20 hours at this, I am completly lost.

I am trying the following:


class ArmleoCoreTop extends Module {
  implicit val p = Parameters.empty
  val acore = LazyModule(new ArmleoCore())
  val macore = Module(acore.module)
  val io = IO(acore.io_node.cloneType)
  acore.io_node <> io 

  
}

class ArmleoCore()(implicit p: Parameters) extends LazyModule {
  val client = TLClientNode(Seq(TLMasterPortParameters.v1(Seq(TLMasterParameters.v1(
    name = "ArmleoCore",
    sourceId = IdRange(0, 4),
    requestFifo = true,
    visibility = Seq(AddressSet(0x0000_0000, (BigInt(1) << 64) - 1)))
  ))))

  val io_node = InModuleBody { client.makeIOs() }
  lazy val module = new ArmleoCoreImpl(this)
  
  
}

class ArmleoCoreImpl(outer: ArmleoCore) extends LazyModuleImp(outer) {
  val (tl, edge) = outer.client.out(0)

  val (legal, a) = edge.Get(0.U, "h1000".U, 0x4.U)
  tl.a.bits := a
  val io = IO(new Bundle() {
    val legal = Output(Bool())
  })
  io.legal := legal

  
}

object ArmleoCoreDriver extends App {
  (new chisel3.stage.ChiselStage).emitVerilog(new ArmleoCoreTop(), args)
}

But I am getting:

(run-main-29) java.lang.IllegalArgumentException: requirement failed: Diplomacy has detected a problem with your graph:
[error] At the following node, the number of outward ports should equal the number of produced outward parameters.
[error] source acore.client node:
[error] parents: acore
[error] locator:  (src/main/scala/armleocpu/ArmleoCore.scala:11:25)
[error] 
[error] 0 outward ports connected: []
[error] 0 inward ports connected: []
[error] 
[error] Downstreamed inward parameters: []
[error] Produced outward parameters: [TLMasterPortParameters(List(TLMasterParameters(ArmleoCore, IdRange(0,4), List(), List(AddressSet(0x0, 0xffffffffffffffff)), Set(), false, true, , TBALGFPH, false)), TLChannelBeatBytes(None,None,None,None), 0, List(), List(), List())]

Any ideas on how to properly "export" the node?


Solution

  • Turns out I need to declare the port as "Manager" and makeIOs that port. It makes logical sense, cause you need to declare the slave's capabilities and stuff.