added GPIO config | breaks on building test harness

This commit is contained in:
abejgonzalez
2019-04-21 15:19:15 -07:00
parent eda0b113c1
commit 668047e3fd
3 changed files with 87 additions and 5 deletions

View File

@@ -7,6 +7,19 @@ import freechips.rocketchip.diplomacy.{LazyModule, ValName}
import freechips.rocketchip.devices.tilelink.BootROMParams import freechips.rocketchip.devices.tilelink.BootROMParams
import freechips.rocketchip.tile.XLen import freechips.rocketchip.tile.XLen
import testchipip._ import testchipip._
import sifive.blocks.devices.gpio._
/**
* TODO: Why do we need this?
*/
object ConfigValName {
implicit val valName = ValName("TestHarness")
}
import ConfigValName._
// -------------------------------
// Common Configs
// -------------------------------
/** /**
* Class to specify where the BootRom file is (from `rebar` top) * Class to specify where the BootRom file is (from `rebar` top)
@@ -17,12 +30,12 @@ class WithBootROM extends Config((site, here, up) => {
}) })
/** /**
* TODO: Why do we need this? * Class to add in GPIO
*/ */
object ConfigValName { class WithGPIO extends Config((site, here, up) => {
implicit val valName = ValName("TestHarness") case PeripheryGPIOKey => List(
} GPIOParams(address = 0x10012000, width = 4, includeIOF = true))
import ConfigValName._ })
// ------------------------------- // -------------------------------
// Rocket Top Level System Configs // Rocket Top Level System Configs
@@ -75,6 +88,16 @@ class WithSimBlockDeviceRocketTop extends Config((site, here, up) => {
} }
}) })
/**
* Class to specify a top level rocket-chip system with GPIO
*/
class WithGPIORocketTop extends Config((site, here, up) => {
case BuildRocketTop => (clock: Clock, reset: Bool, p: Parameters) => {
val top = Module(LazyModule(new RocketTopWithGPIO()(p)).module)
top
}
})
// -------------- // --------------
// Rocket Configs // Rocket Configs
// -------------- // --------------
@@ -117,26 +140,43 @@ class RV32RocketConfig extends Config(
new WithRV32 ++ new WithRV32 ++
new DefaultRocketConfig) new DefaultRocketConfig)
class GPIORocketConfig extends Config(
new WithGPIO ++
new WithGPIORocketTop ++
new BaseRocketConfig)
// ----------------------------- // -----------------------------
// BOOM Top Level System Configs // BOOM Top Level System Configs
// ----------------------------- // -----------------------------
/**
* Class to specify a "plain" top level BOOM system
*/
class WithNormalBoomTop extends Config((site, here, up) => { class WithNormalBoomTop extends Config((site, here, up) => {
case BuildBoomTop => (clock: Clock, reset: Bool, p: Parameters) => { case BuildBoomTop => (clock: Clock, reset: Bool, p: Parameters) => {
Module(LazyModule(new BoomTop()(p)).module) Module(LazyModule(new BoomTop()(p)).module)
} }
}) })
/**
* Class to specify a top level BOOM system with PWM
*/
class WithPWMBoomTop extends Config((site, here, up) => { class WithPWMBoomTop extends Config((site, here, up) => {
case BuildBoomTop => (clock: Clock, reset: Bool, p: Parameters) => case BuildBoomTop => (clock: Clock, reset: Bool, p: Parameters) =>
Module(LazyModule(new BoomTopWithPWMTL()(p)).module) Module(LazyModule(new BoomTopWithPWMTL()(p)).module)
}) })
/**
* Class to specify a top level BOOM system with a PWM AXI4
*/
class WithPWMAXI4BoomTop extends Config((site, here, up) => { class WithPWMAXI4BoomTop extends Config((site, here, up) => {
case BuildBoomTop => (clock: Clock, reset: Bool, p: Parameters) => case BuildBoomTop => (clock: Clock, reset: Bool, p: Parameters) =>
Module(LazyModule(new BoomTopWithPWMAXI4()(p)).module) Module(LazyModule(new BoomTopWithPWMAXI4()(p)).module)
}) })
/**
* Class to specify a top level BOOM system with a block device
*/
class WithBlockDeviceModelBoomTop extends Config((site, here, up) => { class WithBlockDeviceModelBoomTop extends Config((site, here, up) => {
case BuildBoomTop => (clock: Clock, reset: Bool, p: Parameters) => { case BuildBoomTop => (clock: Clock, reset: Bool, p: Parameters) => {
val top = Module(LazyModule(new BoomTopWithBlockDevice()(p)).module) val top = Module(LazyModule(new BoomTopWithBlockDevice()(p)).module)
@@ -145,6 +185,9 @@ class WithBlockDeviceModelBoomTop extends Config((site, here, up) => {
} }
}) })
/**
* Class to specify a top level BOOM system with a simulator block device
*/
class WithSimBlockDeviceBoomTop extends Config((site, here, up) => { class WithSimBlockDeviceBoomTop extends Config((site, here, up) => {
case BuildBoomTop => (clock: Clock, reset: Bool, p: Parameters) => { case BuildBoomTop => (clock: Clock, reset: Bool, p: Parameters) => {
val top = Module(LazyModule(new BoomTopWithBlockDevice()(p)).module) val top = Module(LazyModule(new BoomTopWithBlockDevice()(p)).module)
@@ -153,6 +196,16 @@ class WithSimBlockDeviceBoomTop extends Config((site, here, up) => {
} }
}) })
/**
* Class to specify a top level BOOM system with GPIO
*/
class WithGPIOBoomTop extends Config((site, here, up) => {
case BuildBoomTop => (clock: Clock, reset: Bool, p: Parameters) => {
val top = Module(LazyModule(new BoomTopWithGPIO()(p)).module)
top
}
})
// ------------ // ------------
// BOOM Configs // BOOM Configs
// ------------ // ------------
@@ -195,3 +248,8 @@ class DualCoreBoomConfig extends Config(
class RV32BoomConfig extends Config( class RV32BoomConfig extends Config(
new WithBootROM ++ new WithBootROM ++
new boom.system.SmallRV32UnifiedBoomConfig) new boom.system.SmallRV32UnifiedBoomConfig)
class GPIOBoomConfig extends Config(
new WithGPIO ++
new WithGPIOBoomTop ++
new BaseBoomConfig)

View File

@@ -36,6 +36,7 @@ class RocketTestHarness(implicit val p: Parameters) extends Module {
axi.w.bits := DontCare axi.w.bits := DontCare
} }
}) })
io.success := dut.connectSimSerial() io.success := dut.connectSimSerial()
} }

View File

@@ -7,6 +7,7 @@ import freechips.rocketchip.config.Parameters
import freechips.rocketchip.devices.tilelink._ import freechips.rocketchip.devices.tilelink._
import freechips.rocketchip.util.DontTouch import freechips.rocketchip.util.DontTouch
import testchipip._ import testchipip._
import sifive.blocks.devices.gpio._
// ------------------------ // ------------------------
// Rocket Top Level Systems // Rocket Top Level Systems
@@ -59,6 +60,17 @@ class RocketTopWithBlockDeviceModule(l: RocketTopWithBlockDevice)
extends RocketTopModule(l) extends RocketTopModule(l)
with HasPeripheryBlockDeviceModuleImp with HasPeripheryBlockDeviceModuleImp
//---------------------------------------------------------------------------------------------------------
class RocketTopWithGPIO(implicit p: Parameters) extends RocketTop
with HasPeripheryGPIO {
override lazy val module = new RocketTopWithGPIOModule(this)
}
class RocketTopWithGPIOModule(l: RocketTopWithGPIO)
extends RocketTopModule(l)
with HasPeripheryGPIOModuleImp
// ---------------------- // ----------------------
// BOOM Top Level Systems // BOOM Top Level Systems
// ---------------------- // ----------------------
@@ -104,3 +116,14 @@ class BoomTopWithBlockDevice(implicit p: Parameters) extends BoomTop
class BoomTopWithBlockDeviceModule(l: BoomTopWithBlockDevice) extends BoomTopModule(l) class BoomTopWithBlockDeviceModule(l: BoomTopWithBlockDevice) extends BoomTopModule(l)
with HasPeripheryBlockDeviceModuleImp with HasPeripheryBlockDeviceModuleImp
//---------------------------------------------------------------------------------------------------------
class BoomTopWithGPIO(implicit p: Parameters) extends BoomTop
with HasPeripheryGPIO {
override lazy val module = new BoomTopWithGPIOModule(this)
}
class BoomTopWithGPIOModule(l: BoomTopWithGPIO)
extends BoomTopModule(l)
with HasPeripheryGPIOModuleImp