separate PWM and basic example into separate packages

This commit is contained in:
Howard Mao 2016-10-21 21:06:40 -07:00
parent 3b03ac15e0
commit f6993880dd
8 changed files with 50 additions and 45 deletions

View File

@ -1,27 +0,0 @@
package example
import cde.{Parameters, Config, CDEMatchError}
import testchipip.WithSerialAdapter
import chisel3._
import diplomacy.LazyModule
class WithExampleTop extends Config(
(pname, site, here) => pname match {
case BuildExampleTop => (p: Parameters) => LazyModule(new ExampleTop(p))
case _ => throw new CDEMatchError
})
class WithPWM extends Config(
(pname, site, here) => pname match {
case BuildExampleTop => (p: Parameters) => LazyModule(new ExampleTopWithPWM(p))
case _ => throw new CDEMatchError
})
class SerialAdapterConfig extends Config(
new WithSerialAdapter ++ new rocketchip.BaseConfig)
class DefaultExampleConfig extends Config(
new WithExampleTop ++ new SerialAdapterConfig)
class PWMExampleConfig extends Config(
new WithPWM ++ new SerialAdapterConfig)

View File

@ -0,0 +1,7 @@
package example
import cde.{Parameters, Config, CDEMatchError}
import testchipip.WithSerialAdapter
class DefaultExampleConfig extends Config(
new WithSerialAdapter ++ new rocketchip.BaseConfig)

View File

@ -5,9 +5,7 @@ import diplomacy.LazyModule
import rocketchip._
import testchipip._
import chisel3._
import cde.{Parameters, Field}
case object BuildExampleTop extends Field[Parameters => ExampleTop]
import cde.Parameters
class TestHarness(implicit val p: Parameters) extends Module {
val io = new Bundle {
@ -16,7 +14,7 @@ class TestHarness(implicit val p: Parameters) extends Module {
def buildTop(p: Parameters): ExampleTop = LazyModule(new ExampleTop(p))
val dut = p(BuildExampleTop)(p).module
val dut = buildTop(p).module
val ser = Module(new SimSerialWrapper(p(SerialInterfaceWidth)))
val nMemChannels = dut.io.mem_axi.size

View File

@ -2,7 +2,6 @@ package example
import chisel3._
import cde.Parameters
import diplomacy.LazyModule
import testchipip._
import rocketchip._
@ -22,15 +21,3 @@ class ExampleTopModule[+L <: ExampleTop, +B <: ExampleTopBundle](p: Parameters,
with PeripheryBootROMModule with PeripheryCoreplexLocalInterrupterModule
with PeripheryMasterMemModule with PeripherySerialModule
with HardwiredResetVector with DirectConnection with NoDebug
class ExampleTopWithPWM(q: Parameters) extends ExampleTop(q)
with PeripheryPWM {
override lazy val module = Module(
new ExampleTopWithPWMModule(p, this, new ExampleTopWithPWMBundle(p)))
}
class ExampleTopWithPWMBundle(p: Parameters) extends ExampleTopBundle(p)
with PeripheryPWMBundle
class ExampleTopWithPWMModule(p: Parameters, l: ExampleTopWithPWM, b: => ExampleTopWithPWMBundle)
extends ExampleTopModule(p, l, b) with PeripheryPWMModule

View File

@ -0,0 +1,6 @@
package pwm
import cde.{Parameters, Config, CDEMatchError}
import testchipip.WithSerialAdapter
class PWMConfig extends Config(new example.DefaultExampleConfig)

View File

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

View File

@ -0,0 +1,17 @@
package pwm
import util.GeneratorApp
import cde.Parameters
import diplomacy.LazyModule
class TestHarness(q: Parameters) extends example.TestHarness()(q) {
override def buildTop(p: Parameters) =
LazyModule(new ExampleTopWithPWM(p))
}
object Generator extends GeneratorApp {
val longName = names.topModuleProject + "." +
names.topModuleClass + "." +
names.configs
generateFirrtl
}

View File

@ -0,0 +1,17 @@
package pwm
import chisel3._
import example._
import cde.Parameters
class ExampleTopWithPWM(q: Parameters) extends ExampleTop(q)
with PeripheryPWM {
override lazy val module = Module(
new ExampleTopWithPWMModule(p, this, new ExampleTopWithPWMBundle(p)))
}
class ExampleTopWithPWMBundle(p: Parameters) extends ExampleTopBundle(p)
with PeripheryPWMBundle
class ExampleTopWithPWMModule(p: Parameters, l: ExampleTopWithPWM, b: => ExampleTopWithPWMBundle)
extends ExampleTopModule(p, l, b) with PeripheryPWMModule