如何将某些捆绑软件作为模块参数传递?

问题描述 投票:1回答:1

我正在编写wishbone plumbing package为我的设计生成Intercon模块。在名为wbplumbing的程序包中,我声明了Wishbone Master和Slave接口的两个Bundle:

class WbMaster (val dwidth: Int,
                val awidth: Int) extends Bundle {
    val adr_o = Output(UInt(awidth.W))
// ...
    val cyc_o = Output(Bool())
    override def cloneType = (new WbMaster(dwidth, awidth)).asInstanceOf[this.type]
}

// Wishbone slave interface
class WbSlave (val dwidth: Int,
               val awidth: Int) extends Bundle {
  val adr_i = Input(UInt(awidth.W))
// ...
  val cyc_i = Input(Bool())
  override def cloneType = (new WbSlave(dwidth, awidth)).asInstanceOf[this.type]
}

我的Intercon模块将这两个Bundles作为参数:

// Wishbone Intercon Pass Trought : one master, one slave
class WbInterconPT (val awbm: WbMaster,
                    val awbs: WbSlave) extends Module {
  val io = IO(new Bundle{
    val wbm = Flipped(new WbMaster(awbm.dwidth, awbm.awidth))
    val wbs = Flipped(new WbSlave(awbs.dwidth, awbs.awidth))
})
//...
}

我要插入此Intercon的两个模块位于名为spi2wbmdio的两个不同包中。两者都包括带有捆绑包的wbplumbing软件包:

  • 对于管理员:
import wbplumbing.WbMaster
  • 对于奴隶:
import wbplumbing.WbSlave

然后在我的“顶部”模块上导入此:

// spi, mdio bus modules
import wbplumbing.WbInterconPT
import wbplumbing.{WbMaster, WbSlave} // <- not sure that usefull
import spi2wb.{Spi2Wb, SpiSlave}
import mdio.{MdioWb, MdioIf}

并像这样实例化它:

  // Wishbone parameters
  val dwidth = 16
  val awidth = 2

  // module instantiation
  val spi2Wb = Module(new Spi2Wb(dwidth, awidth))
  val wbMdio = Module(new MdioWb(mainFreq, targetFreq))
  val wbIntercon = Module(new WbInterconPT(spi2Wb.io.wbm, wbMdio.io.wbs))

然后我收到类型错误:

[info] Set current project to spi2ksz (in build file:/pchpch/spi2ksz/)
[info] Compiling 1 Scala source to /pchpch/spi2ksz/target/scala-2.11/classes ...
[error] /pchpch/spi2ksz/src/main/scala/spi2ksz.scala:29:47: type mismatch;
[error]  found   : spi2wb.WbMaster
[error]  required: wbplumbing.WbMaster
[error]   val wbIntercon = new WbInterconPT(spi2Wb.io.wbm, wbMdio.io.wbs)
[error]                                               ^
[error] /pchpch/spi2ksz/src/main/scala/spi2ksz.scala:29:62: type mismatch;
[error]  found   : mdio.WbSlave
[error]  required: wbplumbing.WbSlave
[error]   val wbIntercon = new WbInterconPT(spi2Wb.io.wbm, wbMdio.io.wbs)
[error]                                                              ^
[error] two errors found
[error] (Compile / compileIncremental) Compilation failed

我确定解决方法非常简单,但是可以找到方法!

scala hdl chisel
1个回答
1
投票

好吧,这是一个publishLocal错误。在设计之初,我在此处分别声明了WbSlave和WbMaster Bundle。然后我发表了它。

然后,我编写了WbPlumbing软件包以将它们全部放在一起。而且我忘记了将两个模块“重新”发布到本地。

有时,问问题解决问题;)

© www.soinside.com 2019 - 2024. All rights reserved.