2016-12-08 05:56:28 +01:00
|
|
|
// See LICENSE.SiFive for license details.
|
|
|
|
|
|
|
|
package uncore.ahb
|
|
|
|
|
|
|
|
import Chisel._
|
|
|
|
import config._
|
|
|
|
import diplomacy._
|
|
|
|
import uncore.tilelink2._
|
|
|
|
import unittest._
|
|
|
|
|
|
|
|
class RRTest0(address: BigInt)(implicit p: Parameters) extends AHBRegisterRouter(address, 0, 32, 0, 4)(
|
|
|
|
new AHBRegBundle((), _) with RRTest0Bundle)(
|
|
|
|
new AHBRegModule((), _, _) with RRTest0Module)
|
|
|
|
|
|
|
|
class RRTest1(address: BigInt)(implicit p: Parameters) extends AHBRegisterRouter(address, 0, 32, 1, 4, false)(
|
|
|
|
new AHBRegBundle((), _) with RRTest1Bundle)(
|
|
|
|
new AHBRegModule((), _, _) with RRTest1Module)
|
|
|
|
|
|
|
|
class AHBFuzzBridge()(implicit p: Parameters) extends LazyModule
|
|
|
|
{
|
|
|
|
val fuzz = LazyModule(new TLFuzzer(5000))
|
|
|
|
val model = LazyModule(new TLRAMModel("AHBFuzzMaster"))
|
2016-12-08 09:06:32 +01:00
|
|
|
var xbar = LazyModule(new AHBFanout)
|
2016-12-08 05:56:28 +01:00
|
|
|
val ram = LazyModule(new AHBRAM(AddressSet(0x0, 0xff)))
|
2016-12-08 09:06:32 +01:00
|
|
|
val gpio = LazyModule(new RRTest0(0x100))
|
2016-12-08 05:56:28 +01:00
|
|
|
|
|
|
|
model.node := fuzz.node
|
2016-12-08 09:06:32 +01:00
|
|
|
xbar.node := TLToAHB()(model.node)
|
|
|
|
ram.node := xbar.node
|
|
|
|
gpio.node := xbar.node
|
2016-12-08 05:56:28 +01:00
|
|
|
|
|
|
|
lazy val module = new LazyModuleImp(this) with HasUnitTestIO {
|
|
|
|
io.finished := fuzz.module.io.finished
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class AHBBridgeTest()(implicit p: Parameters) extends UnitTest(500000) {
|
|
|
|
val dut = Module(LazyModule(new AHBFuzzBridge).module)
|
|
|
|
io.finished := dut.io.finished
|
|
|
|
}
|