Hi,
I study some implementations in rocket chip and follow it to complete my project.
However, some questions emerge from processing my project.
The purpose of my project is to generate blockdevice system and attach it on rocket system.
My partial implementation code:
class System (address: BigInt)(implicit p: Parameters) extends LazyModule{
val mmio = TLIdentityNode()
val tobus = TLIdentityNode()
val frontend = LazyModule(new SystemTLFrontend(SystemParams(address))(p))
frontend.node := mmio
val tobusend = LazyModule(new SystemBackend(address))
tobus := tobusend.node
lazy val module = new LazyModuleImp(this){ }
}
When I go to build the emulator, there are some errors happen.
error:
Caused by: java.lang.IllegalArgumentException: requirement failed: tobusend.node (System.scala:176:28) was incorrectly connected as a source at System.scala:177:9
On the other hand, I rearrange two statements as shown below:
class System (address: BigInt)(implicit p: Parameters) extends LazyModule{
val mmio = TLIdentityNode()
val tobus = TLIdentityNode()
val frontend = LazyModule(new SystemTLFrontend(SystemParams(address))(p))
frontend.node := mmio
lazy val module = new LazyModuleImp(this){
val tobusend = LazyModule(new SystemBackend(address))
tobus := tobusend.node
}
}
It could pass compile without error.
But I still cannot realize the reason with such revision.
For my realization, lazy val module = new LazyModuleImp(this){ ....}
is as implementation part that can declare IO ports, etc.
The below two line may put outside LazyModuleImp from my comprehension with studying rocket chip source code.
val tobusend = LazyModule(new SystemBackend(address))
tobus := tobusend.node
Can anyone gives me some answers?