I'm Writing a wishbone plumbing package to generate Intercon Modules for my designs.
In this package named wbplumbing
I declared two Bundle for Wishbone Master and Slave interfaces:
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]
}
My Intercon module take this two Bundles as parameters :
// 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))
})
//...
}
The two modules I want to plug to this Intercon are in two differents package named spi2wb and mdio. Both include the wbplumbing package with bundle :
- For master :
import wbplumbing.WbMaster
- For slave :
import wbplumbing.WbSlave
Then on my "top" module I imported this :
// spi, mdio bus modules
import wbplumbing.WbInterconPT
import wbplumbing.{WbMaster, WbSlave} // <- not sure that usefull
import spi2wb.{Spi2Wb, SpiSlave}
import mdio.{MdioWb, MdioIf}
And instantiated it like that :
// 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))
Then I get a type error :
[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
I'm sure the solution is stupidly simple, but can found how to do !