initial commit
This commit is contained in:
18
src/main/scala/Configs.scala
Normal file
18
src/main/scala/Configs.scala
Normal file
@@ -0,0 +1,18 @@
|
||||
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 SerialAdapterConfig extends Config(
|
||||
new WithSerialAdapter ++ new rocketchip.BaseConfig)
|
||||
|
||||
class DefaultExampleConfig extends Config(
|
||||
new WithExampleTop ++ new SerialAdapterConfig)
|
||||
37
src/main/scala/TestHarness.scala
Normal file
37
src/main/scala/TestHarness.scala
Normal file
@@ -0,0 +1,37 @@
|
||||
package example
|
||||
|
||||
import util.GeneratorApp
|
||||
import diplomacy.LazyModule
|
||||
import rocketchip._
|
||||
import testchipip._
|
||||
import chisel3._
|
||||
import cde.{Parameters, Field}
|
||||
|
||||
case object BuildExampleTop extends Field[Parameters => ExampleTop]
|
||||
|
||||
class TestHarness(implicit val p: Parameters) extends Module {
|
||||
val io = new Bundle {
|
||||
val success = Bool(OUTPUT)
|
||||
}
|
||||
|
||||
def buildTop(p: Parameters): ExampleTop = LazyModule(new ExampleTop(p))
|
||||
|
||||
val dut = p(BuildExampleTop)(p).module
|
||||
val ser = Module(new SimSerialWrapper(p(SerialInterfaceWidth)))
|
||||
|
||||
val nMemChannels = dut.io.mem_axi.size
|
||||
for (axi <- dut.io.mem_axi) {
|
||||
val mem = Module(new SimAXIMem(BigInt(p(ExtMemSize) / nMemChannels)))
|
||||
mem.io.axi <> axi
|
||||
}
|
||||
|
||||
ser.io.serial <> dut.io.serial
|
||||
io.success := ser.io.exit
|
||||
}
|
||||
|
||||
object Generator extends GeneratorApp {
|
||||
val longName = names.topModuleProject + "." +
|
||||
names.topModuleClass + "." +
|
||||
names.configs
|
||||
generateFirrtl
|
||||
}
|
||||
24
src/main/scala/Top.scala
Normal file
24
src/main/scala/Top.scala
Normal file
@@ -0,0 +1,24 @@
|
||||
package example
|
||||
|
||||
import chisel3._
|
||||
import cde.Parameters
|
||||
import diplomacy.LazyModule
|
||||
import testchipip._
|
||||
import rocketchip._
|
||||
|
||||
class ExampleTop(q: Parameters) extends BaseTop(q)
|
||||
with PeripheryBootROM with PeripheryCoreplexLocalInterrupter
|
||||
with PeripherySerial with PeripheryMasterMem {
|
||||
override lazy val module = Module(
|
||||
new ExampleTopModule(p, this, new ExampleTopBundle(p)))
|
||||
}
|
||||
|
||||
class ExampleTopBundle(p: Parameters) extends BaseTopBundle(p)
|
||||
with PeripheryBootROMBundle with PeripheryCoreplexLocalInterrupterBundle
|
||||
with PeripheryMasterMemBundle with PeripherySerialBundle
|
||||
|
||||
class ExampleTopModule(p: Parameters, l: ExampleTop, b: => ExampleTopBundle)
|
||||
extends BaseTopModule(p, l, b)
|
||||
with PeripheryBootROMModule with PeripheryCoreplexLocalInterrupterModule
|
||||
with PeripheryMasterMemModule with PeripherySerialModule
|
||||
with HardwiredResetVector with DirectConnection with NoDebug
|
||||
Reference in New Issue
Block a user