merge the different ExampleTop subclasses into the example package

This commit is contained in:
Howard Mao
2017-06-26 16:29:04 -07:00
parent 31f5fc98e4
commit f766dcc550
11 changed files with 89 additions and 148 deletions

View File

@@ -1,21 +0,0 @@
package blkdev
import config.{Parameters, Config}
import example.DefaultExampleConfig
import testchipip.{WithBlockDevice, WithNBlockDeviceTrackers}
class WithSimBlockDevice extends Config((site, here, up) => {
case UseSimBlockDevice => true
})
class WithBlockDeviceModel extends Config((site, here, up) => {
case UseSimBlockDevice => false
})
class BlockDeviceConfig extends Config(
new WithSimBlockDevice ++
new WithBlockDevice ++
new DefaultExampleConfig)
class WithTwoTrackers extends WithNBlockDeviceTrackers(2)
class WithFourTrackers extends WithNBlockDeviceTrackers(4)

View File

@@ -1,27 +0,0 @@
package blkdev
import diplomacy.LazyModule
import chisel3._
import config.{Parameters, Field}
import testchipip.GeneratorApp
import example._
case object UseSimBlockDevice extends Field[Boolean]
class TestHarness(implicit p: Parameters) extends Module {
val io = IO(new Bundle {
val success = Output(Bool())
})
val dut = Module(LazyModule(new ExampleTopWithBlockDevice).module)
dut.connectSimAXIMem()
if (p(UseSimBlockDevice))
dut.connectSimBlockDevice()
else
dut.connectBlockDeviceModel()
io.success := dut.connectSimSerial()
}
object Generator extends GeneratorApp {
generateFirrtl
}

View File

@@ -1,15 +0,0 @@
package blkdev
import chisel3._
import config.Parameters
import testchipip._
import example._
class ExampleTopWithBlockDevice(implicit p: Parameters) extends ExampleTop
with HasPeripheryBlockDevice {
override lazy val module = new ExampleTopWithBlockDeviceModule(this)
}
class ExampleTopWithBlockDeviceModule(l: ExampleTopWithBlockDevice)
extends ExampleTopModule(l)
with HasPeripheryBlockDeviceModuleImp

View File

@@ -1,14 +1,56 @@
package example
import chisel3._
import config.{Parameters, Config}
import testchipip.WithSerialAdapter
import diplomacy.LazyModule
import coreplex.WithRoccExample
import rocketchip.WithoutTLMonitors
import testchipip._
class DefaultExampleConfig extends Config(
class WithExampleTop extends Config((site, here, up) => {
case BuildTop => (p: Parameters) =>
Module(LazyModule(new ExampleTop()(p)).module)
})
class WithPWM extends Config((site, here, up) => {
case BuildTop => (p: Parameters) =>
Module(LazyModule(new ExampleTopWithPWM()(p)).module)
})
class WithBlockDeviceModel extends Config((site, here, up) => {
case BuildTop => (p: Parameters) => {
val top = Module(LazyModule(new ExampleTopWithBlockDevice()(p)).module)
top.connectBlockDeviceModel()
top
}
})
class WithSimBlockDevice extends Config((site, here, up) => {
case BuildTop => (p: Parameters) => {
val top = Module(LazyModule(new ExampleTopWithBlockDevice()(p)).module)
top.connectSimBlockDevice()
top
}
})
class BaseExampleConfig extends Config(
new WithoutTLMonitors ++
new WithSerialAdapter ++
new rocketchip.DefaultConfig)
class DefaultExampleConfig extends Config(
new WithExampleTop ++ new BaseExampleConfig)
class RoccExampleConfig extends Config(
new WithRoccExample ++ new DefaultExampleConfig)
class PWMConfig extends Config(new WithPWM ++ new BaseExampleConfig)
class SimBlockDeviceConfig extends Config(
new WithBlockDevice ++ new WithSimBlockDevice ++ new BaseExampleConfig)
class BlockDeviceModelConfig extends Config(
new WithBlockDevice ++ new WithBlockDeviceModel ++ new BaseExampleConfig)
class WithTwoTrackers extends WithNBlockDeviceTrackers(2)
class WithFourTrackers extends WithNBlockDeviceTrackers(4)

View File

@@ -1,4 +1,4 @@
package pwm
package example
import chisel3._
import chisel3.util._

View File

@@ -4,16 +4,16 @@ import diplomacy.LazyModule
import rocketchip._
import testchipip._
import chisel3._
import config.Parameters
import config.{Field, Parameters}
case object BuildTop extends Field[Parameters => ExampleTopModule[ExampleTop]]
class TestHarness(implicit val p: Parameters) extends Module {
val io = IO(new Bundle {
val success = Output(Bool())
})
def buildTop(p: Parameters): ExampleTop = LazyModule(new ExampleTop()(p))
val dut = Module(buildTop(p).module)
val dut = p(BuildTop)(p)
dut.connectSimAXIMem()
io.success := dut.connectSimSerial()
}

View File

@@ -24,3 +24,20 @@ class ExampleTopModule[+L <: ExampleTop](l: L) extends BaseSystemModule(l)
with HasRocketPlexMasterModuleImp
with HasNoDebugModuleImp
with HasPeripherySerialModuleImp
class ExampleTopWithPWM(implicit p: Parameters) extends ExampleTop
with HasPeripheryPWM {
override lazy val module = new ExampleTopWithPWMModule(this)
}
class ExampleTopWithPWMModule(l: ExampleTopWithPWM)
extends ExampleTopModule(l) with HasPeripheryPWMModuleImp
class ExampleTopWithBlockDevice(implicit p: Parameters) extends ExampleTop
with HasPeripheryBlockDevice {
override lazy val module = new ExampleTopWithBlockDeviceModule(this)
}
class ExampleTopWithBlockDeviceModule(l: ExampleTopWithBlockDevice)
extends ExampleTopModule(l)
with HasPeripheryBlockDeviceModuleImp

View File

@@ -1,8 +0,0 @@
package pwm
import config.{Parameters, Config}
import testchipip.WithSerialAdapter
import uncore.tilelink.ClientUncachedTileLinkIO
import chisel3._
class PWMConfig extends Config(new example.DefaultExampleConfig)

View File

@@ -1,14 +0,0 @@
package pwm
import config.Parameters
import diplomacy.LazyModule
import testchipip.GeneratorApp
class TestHarness(q: Parameters) extends example.TestHarness()(q) {
override def buildTop(p: Parameters) =
LazyModule(new ExampleTopWithPWM()(p))
}
object Generator extends GeneratorApp {
generateFirrtl
}

View File

@@ -1,13 +0,0 @@
package pwm
import chisel3._
import example._
import config.Parameters
class ExampleTopWithPWM(implicit p: Parameters) extends ExampleTop
with HasPeripheryPWM {
override lazy val module = new ExampleTopWithPWMModule(this)
}
class ExampleTopWithPWMModule(l: ExampleTopWithPWM)
extends ExampleTopModule(l) with HasPeripheryPWMModuleImp