2016-11-27 16:16:37 -08:00
|
|
|
// See LICENSE.SiFive for license details.
|
|
|
|
|
2016-10-11 22:27:01 -07:00
|
|
|
package uncore.axi4
|
|
|
|
|
|
|
|
import Chisel._
|
2016-12-01 17:46:52 -08:00
|
|
|
import config._
|
2016-10-11 22:27:01 -07:00
|
|
|
import diplomacy._
|
|
|
|
import uncore.tilelink2._
|
|
|
|
import unittest._
|
|
|
|
|
2016-12-01 17:46:52 -08:00
|
|
|
class RRTest0(address: BigInt)(implicit p: Parameters) extends AXI4RegisterRouter(address, 0, 32, 0, 4)(
|
2016-10-11 22:27:01 -07:00
|
|
|
new AXI4RegBundle((), _) with RRTest0Bundle)(
|
|
|
|
new AXI4RegModule((), _, _) with RRTest0Module)
|
|
|
|
|
2016-12-01 17:46:52 -08:00
|
|
|
class RRTest1(address: BigInt)(implicit p: Parameters) extends AXI4RegisterRouter(address, 0, 32, 6, 4, false)(
|
2016-10-11 22:27:01 -07:00
|
|
|
new AXI4RegBundle((), _) with RRTest1Bundle)(
|
|
|
|
new AXI4RegModule((), _, _) with RRTest1Module)
|
|
|
|
|
2016-12-01 17:46:52 -08:00
|
|
|
class AXI4LiteFuzzRAM()(implicit p: Parameters) extends LazyModule
|
2016-10-11 22:27:01 -07:00
|
|
|
{
|
|
|
|
val fuzz = LazyModule(new TLFuzzer(5000))
|
2016-10-11 22:32:06 -07:00
|
|
|
val model = LazyModule(new TLRAMModel("AXI4LiteFuzzRAM"))
|
2016-10-11 22:27:01 -07:00
|
|
|
val xbar = LazyModule(new TLXbar)
|
|
|
|
val gpio = LazyModule(new RRTest1(0x400))
|
|
|
|
val ram = LazyModule(new AXI4RAM(AddressSet(0x0, 0x3ff)))
|
|
|
|
|
|
|
|
model.node := fuzz.node
|
2017-03-16 15:19:36 -07:00
|
|
|
xbar.node := TLDelayer(0.1)(TLBuffer(BufferParams.flow)(TLDelayer(0.2)(model.node)))
|
2017-04-21 17:13:51 -07:00
|
|
|
ram.node := AXI4Fragmenter()(AXI4Deinterleaver(16)(TLToAXI4(0, true )(xbar.node)))
|
|
|
|
gpio.node := AXI4Fragmenter()(AXI4Deinterleaver(16)(TLToAXI4(0, false)(xbar.node)))
|
2016-10-11 22:27:01 -07:00
|
|
|
|
|
|
|
lazy val module = new LazyModuleImp(this) with HasUnitTestIO {
|
|
|
|
io.finished := fuzz.module.io.finished
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-01 17:46:52 -08:00
|
|
|
class AXI4LiteFuzzRAMTest()(implicit p: Parameters) extends UnitTest(500000) {
|
2016-10-11 22:27:01 -07:00
|
|
|
val dut = Module(LazyModule(new AXI4LiteFuzzRAM).module)
|
|
|
|
io.finished := dut.io.finished
|
|
|
|
}
|
|
|
|
|
2016-12-01 17:46:52 -08:00
|
|
|
class AXI4FullFuzzRAM()(implicit p: Parameters) extends LazyModule
|
2016-10-11 22:27:01 -07:00
|
|
|
{
|
|
|
|
val fuzz = LazyModule(new TLFuzzer(5000))
|
2016-10-11 22:32:06 -07:00
|
|
|
val model = LazyModule(new TLRAMModel("AXI4FullFuzzRAM"))
|
2016-10-11 22:27:01 -07:00
|
|
|
val xbar = LazyModule(new TLXbar)
|
|
|
|
val gpio = LazyModule(new RRTest0(0x400))
|
|
|
|
val ram = LazyModule(new AXI4RAM(AddressSet(0x0, 0x3ff)))
|
|
|
|
|
|
|
|
model.node := fuzz.node
|
2017-03-16 15:19:36 -07:00
|
|
|
xbar.node := TLDelayer(0.1)(TLBuffer(BufferParams.flow)(TLDelayer(0.2)(model.node)))
|
2017-04-21 17:13:51 -07:00
|
|
|
ram.node := AXI4Fragmenter()(AXI4Deinterleaver(16)(TLToAXI4(4,false)(xbar.node)))
|
|
|
|
gpio.node := AXI4Fragmenter()(AXI4Deinterleaver(16)(TLToAXI4(4,true )(xbar.node)))
|
2016-10-11 22:27:01 -07:00
|
|
|
|
|
|
|
lazy val module = new LazyModuleImp(this) with HasUnitTestIO {
|
|
|
|
io.finished := fuzz.module.io.finished
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-01 17:46:52 -08:00
|
|
|
class AXI4FullFuzzRAMTest(implicit p: Parameters) extends UnitTest(500000) {
|
2016-10-11 22:27:01 -07:00
|
|
|
val dut = Module(LazyModule(new AXI4FullFuzzRAM).module)
|
|
|
|
io.finished := dut.io.finished
|
|
|
|
}
|
2016-10-16 20:18:49 -07:00
|
|
|
|
2016-12-01 17:46:52 -08:00
|
|
|
class AXI4FuzzMaster()(implicit p: Parameters) extends LazyModule
|
2016-10-16 20:18:49 -07:00
|
|
|
{
|
|
|
|
val node = AXI4OutputNode()
|
|
|
|
val fuzz = LazyModule(new TLFuzzer(5000))
|
|
|
|
val model = LazyModule(new TLRAMModel("AXI4FuzzMaster"))
|
|
|
|
|
|
|
|
model.node := fuzz.node
|
2017-03-13 16:09:42 -07:00
|
|
|
node :=
|
2017-04-21 17:13:51 -07:00
|
|
|
// AXI4UserYanker()( ... once TLToAXI is updated
|
|
|
|
AXI4Deinterleaver(64)(
|
2017-03-13 16:09:42 -07:00
|
|
|
TLToAXI4(4)(
|
|
|
|
TLDelayer(0.1)(
|
2017-03-16 15:19:36 -07:00
|
|
|
TLBuffer(BufferParams.flow)(
|
2017-03-13 16:09:42 -07:00
|
|
|
TLDelayer(0.1)(
|
2017-04-21 17:13:51 -07:00
|
|
|
model.node)))))
|
2016-10-16 20:18:49 -07:00
|
|
|
|
|
|
|
lazy val module = new LazyModuleImp(this) {
|
|
|
|
val io = new Bundle {
|
|
|
|
val out = node.bundleOut
|
|
|
|
val finished = Bool(OUTPUT)
|
|
|
|
}
|
|
|
|
|
|
|
|
io.finished := fuzz.module.io.finished
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-01 17:46:52 -08:00
|
|
|
class AXI4FuzzSlave()(implicit p: Parameters) extends LazyModule
|
2016-10-16 20:18:49 -07:00
|
|
|
{
|
|
|
|
val node = AXI4InputNode()
|
2017-04-21 17:13:51 -07:00
|
|
|
val xbar = LazyModule(new TLXbar)
|
2017-03-13 16:09:42 -07:00
|
|
|
val ram = LazyModule(new TLTestRAM(AddressSet(0x0, 0xfff)))
|
2017-04-21 17:13:51 -07:00
|
|
|
val error= LazyModule(new TLError(Seq(AddressSet(0x1800, 0xff))))
|
2017-03-13 16:09:42 -07:00
|
|
|
|
2017-04-21 17:13:51 -07:00
|
|
|
ram.node := TLFragmenter(4, 16)(xbar.node)
|
|
|
|
error.node := TLFragmenter(4, 16)(xbar.node)
|
|
|
|
|
|
|
|
xbar.node :=
|
|
|
|
TLFIFOFixer()(
|
2017-03-13 16:09:42 -07:00
|
|
|
TLDelayer(0.1)(
|
2017-03-16 15:19:36 -07:00
|
|
|
TLBuffer(BufferParams.flow)(
|
2017-03-13 16:09:42 -07:00
|
|
|
TLDelayer(0.1)(
|
|
|
|
AXI4ToTL()(
|
2017-04-20 18:54:50 -07:00
|
|
|
AXI4UserYanker(4)(
|
2017-03-13 16:09:42 -07:00
|
|
|
AXI4Fragmenter()(
|
2017-04-21 17:13:51 -07:00
|
|
|
AXI4IdIndexer(2)(
|
2017-04-20 18:54:50 -07:00
|
|
|
node))))))))
|
2016-10-16 20:18:49 -07:00
|
|
|
|
|
|
|
lazy val module = new LazyModuleImp(this) {
|
|
|
|
val io = new Bundle {
|
|
|
|
val in = node.bundleIn
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-01 17:46:52 -08:00
|
|
|
class AXI4FuzzBridge()(implicit p: Parameters) extends LazyModule
|
2016-10-16 20:18:49 -07:00
|
|
|
{
|
|
|
|
val master = LazyModule(new AXI4FuzzMaster)
|
|
|
|
val slave = LazyModule(new AXI4FuzzSlave)
|
|
|
|
|
|
|
|
slave.node := master.node
|
|
|
|
|
|
|
|
lazy val module = new LazyModuleImp(this) with HasUnitTestIO {
|
|
|
|
io.finished := master.module.io.finished
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-01 17:46:52 -08:00
|
|
|
class AXI4BridgeTest()(implicit p: Parameters) extends UnitTest(500000) {
|
2016-10-16 20:18:49 -07:00
|
|
|
val dut = Module(LazyModule(new AXI4FuzzBridge).module)
|
|
|
|
io.finished := dut.io.finished
|
|
|
|
}
|