1
0

rocketchip: Bundle-slices need access to the outer LazyModule

We need this change in order for some ports to use parameters that result
from LazyModule diplomacy.

Now you can eat your cake too!
This commit is contained in:
Wesley W. Terpstra 2016-10-25 14:38:14 -07:00
parent 0ae45d0f24
commit ec2d23b8b7
2 changed files with 10 additions and 8 deletions

View File

@ -67,11 +67,13 @@ abstract class BaseTop(q: Parameters) extends LazyModule {
TopModule.contents = Some(this) TopModule.contents = Some(this)
} }
abstract class BaseTopBundle(val p: Parameters) extends Bundle { abstract class BaseTopBundle[+L <: BaseTop](
val p: Parameters,
val outer: L) extends Bundle {
val success = Bool(OUTPUT) val success = Bool(OUTPUT)
} }
abstract class BaseTopModule[+L <: BaseTop, +B <: BaseTopBundle]( abstract class BaseTopModule[+L <: BaseTop, +B <: BaseTopBundle[L]](
val p: Parameters, val p: Parameters,
val outer: L, val outer: L,
val io: B) extends LazyModuleImp(outer) { val io: B) extends LazyModuleImp(outer) {

View File

@ -17,10 +17,10 @@ class ExampleTop(q: Parameters) extends BaseTop(q)
with PeripheryMasterMem with PeripheryMasterMem
with PeripheryMasterMMIO with PeripheryMasterMMIO
with PeripherySlave { with PeripherySlave {
override lazy val module = Module(new ExampleTopModule(p, this, new ExampleTopBundle(p))) override lazy val module = Module(new ExampleTopModule(p, this, new ExampleTopBundle(p, this)))
} }
class ExampleTopBundle(p: Parameters) extends BaseTopBundle(p) class ExampleTopBundle[+L <: ExampleTop](p: Parameters, l: L) extends BaseTopBundle(p, l)
with PeripheryBootROMBundle with PeripheryBootROMBundle
with PeripheryDebugBundle with PeripheryDebugBundle
with PeripheryExtInterruptsBundle with PeripheryExtInterruptsBundle
@ -29,7 +29,7 @@ class ExampleTopBundle(p: Parameters) extends BaseTopBundle(p)
with PeripheryMasterMMIOBundle with PeripheryMasterMMIOBundle
with PeripherySlaveBundle with PeripherySlaveBundle
class ExampleTopModule[+L <: ExampleTop, +B <: ExampleTopBundle](p: Parameters, l: L, b: B) extends BaseTopModule(p, l, b) class ExampleTopModule[+L <: ExampleTop, +B <: ExampleTopBundle[L]](p: Parameters, l: L, b: B) extends BaseTopModule(p, l, b)
with PeripheryBootROMModule with PeripheryBootROMModule
with PeripheryDebugModule with PeripheryDebugModule
with PeripheryExtInterruptsModule with PeripheryExtInterruptsModule
@ -43,11 +43,11 @@ class ExampleTopModule[+L <: ExampleTop, +B <: ExampleTopBundle](p: Parameters,
/** Example Top with TestRAM */ /** Example Top with TestRAM */
class ExampleTopWithTestRAM(q: Parameters) extends ExampleTop(q) class ExampleTopWithTestRAM(q: Parameters) extends ExampleTop(q)
with PeripheryTestRAM { with PeripheryTestRAM {
override lazy val module = Module(new ExampleTopWithTestRAMModule(p, this, new ExampleTopWithTestRAMBundle(p))) override lazy val module = Module(new ExampleTopWithTestRAMModule(p, this, new ExampleTopWithTestRAMBundle(p, this)))
} }
class ExampleTopWithTestRAMBundle(p: Parameters) extends ExampleTopBundle(p) class ExampleTopWithTestRAMBundle[+L <: ExampleTopWithTestRAM](p: Parameters, l: L) extends ExampleTopBundle(p, l)
with PeripheryTestRAMBundle with PeripheryTestRAMBundle
class ExampleTopWithTestRAMModule[+L <: ExampleTopWithTestRAM, +B <: ExampleTopWithTestRAMBundle](p: Parameters, l: L, b: B) extends ExampleTopModule(p, l, b) class ExampleTopWithTestRAMModule[+L <: ExampleTopWithTestRAM, +B <: ExampleTopWithTestRAMBundle[L]](p: Parameters, l: L, b: B) extends ExampleTopModule(p, l, b)
with PeripheryTestRAMModule with PeripheryTestRAMModule