SimMMIOTest.scala 1.2 KB
Newer Older
L
linjiawei 已提交
1 2 3 4 5 6 7 8
package device

import chipsalliance.rocketchip.config._
import chisel3._
import chiseltest._
import freechips.rocketchip.amba.axi4.{AXI4Deinterleaver, AXI4UserYanker, AXI4Xbar}
import freechips.rocketchip.tilelink._
import freechips.rocketchip.diplomacy._
J
Jiuyang liu 已提交
9 10
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.must.Matchers
L
linjiawei 已提交
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
import top.SimMMIO
import utils.DebugIdentityNode

class SimMMIOTestTop()(implicit p: Parameters) extends LazyModule {

  val addressSet = AddressSet(0x40600000L, 0xf)

  val fuzz = LazyModule(new TLFuzzer(nOperations = 10, inFlight = 1, overrideAddress = Some(addressSet)))
  val simMMIO = LazyModule(new SimMMIO())

  simMMIO.axiBus :=
    AXI4UserYanker() :=
    TLToAXI4() :=
    DebugIdentityNode() :=
    fuzz.node

  lazy val module = new LazyModuleImp(this){
    val finished = IO(Output(Bool()))
    finished := fuzz.module.io.finished
  }
}

J
Jiuyang liu 已提交
33
class SimMMIOTest extends AnyFlatSpec with ChiselScalatestTester with Matchers {
L
linjiawei 已提交
34 35 36 37 38 39 40 41 42 43 44
  it should "run" in {
    implicit val p = Parameters.empty
    test(LazyModule(new SimMMIOTestTop()).module){c =>
      while (!c.finished.peek().litToBoolean){
        c.clock.step(1)
      }
    }
  }
}