util: add DontTouch trait with dontTouchPorts method
This commit is contained in:
parent
aa3a18222c
commit
d33737802a
@ -6,6 +6,7 @@ import Chisel._
|
|||||||
import freechips.rocketchip.config.Parameters
|
import freechips.rocketchip.config.Parameters
|
||||||
import freechips.rocketchip.coreplex._
|
import freechips.rocketchip.coreplex._
|
||||||
import freechips.rocketchip.devices.tilelink._
|
import freechips.rocketchip.devices.tilelink._
|
||||||
|
import freechips.rocketchip.util.DontTouch
|
||||||
|
|
||||||
/** Example Top with periphery devices and ports, and a Rocket coreplex */
|
/** Example Top with periphery devices and ports, and a Rocket coreplex */
|
||||||
class ExampleRocketSystem(implicit p: Parameters) extends RocketCoreplex
|
class ExampleRocketSystem(implicit p: Parameters) extends RocketCoreplex
|
||||||
@ -25,3 +26,4 @@ class ExampleRocketSystemModule[+L <: ExampleRocketSystem](_outer: L) extends Ro
|
|||||||
with HasMasterAXI4MMIOPortModuleImp
|
with HasMasterAXI4MMIOPortModuleImp
|
||||||
with HasSlaveAXI4PortModuleImp
|
with HasSlaveAXI4PortModuleImp
|
||||||
with HasPeripheryBootROMModuleImp
|
with HasPeripheryBootROMModuleImp
|
||||||
|
with DontTouch
|
||||||
|
@ -14,6 +14,7 @@ class TestHarness()(implicit p: Parameters) extends Module {
|
|||||||
val dut = Module(LazyModule(new ExampleRocketSystem).module)
|
val dut = Module(LazyModule(new ExampleRocketSystem).module)
|
||||||
dut.reset := reset | dut.debug.ndreset
|
dut.reset := reset | dut.debug.ndreset
|
||||||
|
|
||||||
|
dut.dontTouchPorts()
|
||||||
dut.tieOffInterrupts()
|
dut.tieOffInterrupts()
|
||||||
dut.connectSimAXIMem()
|
dut.connectSimAXIMem()
|
||||||
dut.connectSimAXIMMIO()
|
dut.connectSimAXIMMIO()
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
package freechips.rocketchip.util
|
package freechips.rocketchip.util
|
||||||
|
|
||||||
import Chisel._
|
import Chisel._
|
||||||
|
import chisel3.experimental.{dontTouch, RawModule}
|
||||||
import freechips.rocketchip.config.Parameters
|
import freechips.rocketchip.config.Parameters
|
||||||
import scala.math._
|
import scala.math._
|
||||||
|
|
||||||
@ -21,6 +22,21 @@ class ParameterizedBundle(implicit p: Parameters) extends Bundle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: replace this with an implicit class when @chisel unprotects dontTouchPorts
|
||||||
|
trait DontTouch {
|
||||||
|
self: RawModule =>
|
||||||
|
|
||||||
|
/** Marks every port as don't touch
|
||||||
|
*
|
||||||
|
* @note This method can only be called after the Module has been fully constructed
|
||||||
|
* (after Module(...))
|
||||||
|
*/
|
||||||
|
def dontTouchPorts(): this.type = {
|
||||||
|
self.getModulePorts.foreach(dontTouch(_))
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
trait Clocked extends Bundle {
|
trait Clocked extends Bundle {
|
||||||
val clock = Clock()
|
val clock = Clock()
|
||||||
val reset = Bool()
|
val reset = Bool()
|
||||||
|
Loading…
Reference in New Issue
Block a user