Diplomacy error while implementing TLRegisterRouter
Currently I'm trying to design a MMIO DMA device, and while compiling the code, I have seen the following error:
[warn] there were 10 feature warnings; re-run with -feature for details [warn] one warning found [info] running chipyard.Generator --target-dir /home/caoyue/yuecao/chipyard_test/chipyard/sims/verilator/generated-src/chipyard.TestHarness.ScratchpadOnlyDMARocketConfig --name chipyard.TestHarness.ScratchpadOnlyDMARocketConfig --top-module chipyard.TestHarness --legacy-configs chipyard:ScratchpadOnlyDMARocketConfig Elaborating design... Interrupt map (1 harts 1 interrupts): [1, 1] => uart_0
The mentioned 'frontend' module is defined in the following way. Does this issue caused by my interrupt definition? If yes, what should be the correct way of defining interrupt as finish signal?
case class DMADeviceFrontendParams(address: BigInt, beatBytes: Int)
trait DMADeviceFrontendBundle extends Bundle with HasDMADeviceParameters{ val complete = Decoupled(Flipped(Bool())) val addr_sp = Output(UInt(pAddrBits.W)) val addr_mmio = Output(UInt(pAddrBits.W)) val len = Output(UInt(lenBits.W)) val write = Output(Bool()) val input_valid = Output(Bool()) }
trait DMADeviceFrontendModule extends HasRegMap with HasDMADeviceParameters {
implicit val p: Parameters val io: DMADeviceFrontendBundle def params: DMADeviceFrontendParams val dataBits = dataBitsPerBeat
require (max_len <= 1024) require (pAddrBits <= 64) val addr_sp_reg = Reg(UInt(pAddrBits.W)) val addr_mmio_reg = Reg(UInt(pAddrBits.W)) val len_reg = Reg(UInt(lenBits.W)) val write_reg = Reg(Bool()) //means write scratch pad data to mmio val complete_reg = Reg(Bool()) val ready_status = Wire(Bool())
io.addr_sp := addr_sp_reg io.addr_mmio := addr_mmio_reg io.len := len_reg io.write := write_reg io.input_valid := (addr_sp_reg=/=0.U) && (addr_mmio_reg=/=0.U) //Use two address status (non-zero) as the general valid status, so write these two address at last io.complete.ready := io.input_valid complete_reg := io.complete.valid interrupts(0) := io.complete.valid
ready_status := (addr_sp_reg===0.U) && (addr_mmio_reg===0.U)
when(complete_reg) { addr_sp_reg := 0.U addr_mmio_reg := 0.U }
printf("yc-log: addr_sp_reg = %x, addr_mmio_reg = %x, len_reg = %d, write_reg = %d, complete_reg = %d ready_status = %d\n", addr_sp_reg, addr_mmio_reg, len_reg, write_reg, complete_reg, ready_status)
regmap( 0x00 -> Seq(RegField(pAddrBits, addr_sp_reg)), 0x08 -> Seq(RegField(pAddrBits, addr_mmio_reg)), 0x10 -> Seq(RegField.w(lenBits, len_reg)), 0x12 -> Seq(RegField.w(1, write_reg)), 0x13 -> Seq(RegField.r(1, complete_reg)), 0x14 -> Seq(RegField.r(1, ready_status))) }
class DMADeviceFrontend(c: DMADeviceFrontendParams)(implicit p: Parameters) extends TLRegisterRouter( c.address, "dmadev-controller", Seq("yc,dmadev"), interrupts = 1, beatBytes = c.beatBytes)( new TLRegBundle(c, _) with DMADeviceFrontendBundle)( new TLRegModule(c, _, _) with DMADeviceFrontendModule)
..... class MyDMA(c: DMADeviceFrontendParams)(implicit p:Parameters) extends LazyModule{ val frontend = LazyModule(new DMADeviceFrontend(c)) val device = LazyModule(new DMADevice)
lazy val module = new LazyModuleImp(this) { frontend.module.io <> device.module.io.req } } trait CanHavePeripheryMyDMA { this: BaseSubsystem => implicit val p: Parameters
private val address = 0x2000 private val portName = "mydma"
p(DMADeviceKey).map { k => val mydma = LazyModule(new MyDMA(DMADeviceFrontendParams(address, pbus.beatBytes))(p))
pbus.toVariableWidthSlave(Some(portName)) { mydma.frontend.node }
fbus.fromPort(Some(portName))() :=* mydma.device.node_sp
pbus.fromPort(Some(portName))() :=* mydma.device.node_mmio
} }
By filtering the error, I find that the previous error is caused by that I'm trying to create an interrupt. Since I didn't find much detail on creating interrupt in the design (the current implementation is imitated based on BlockDevice.scala), could you please give me some suggestion on the interrupt creation?
Find the way to add the interrupt, I should connect the frontend intnode to ibus. Will close the ticket.