Skip to content

Commit

Permalink
Make SimAXIMem start at expected memory boundary instead of zero
Browse files Browse the repository at this point in the history
  • Loading branch information
KireinaHoro committed Sep 4, 2020
1 parent 55058a6 commit f8fd601
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main/scala/system/SimAXIMem.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ package freechips.rocketchip.system // TODO this should really be in a testharne
import chisel3._
import freechips.rocketchip.amba._
import freechips.rocketchip.amba.axi4._
import freechips.rocketchip.config.{Parameters}
import freechips.rocketchip.config.Parameters
import freechips.rocketchip.diplomacy._
import freechips.rocketchip.subsystem.{CanHaveMasterAXI4MMIOPort, CanHaveMasterAXI4MemPort, ExtMem}
import freechips.rocketchip.subsystem.{CanHaveMasterAXI4MMIOPort, CanHaveMasterAXI4MemPort, ExtBus, ExtMem}

/** Memory with AXI port for use in elaboratable test harnesses. */
class SimAXIMem(edge: AXI4EdgeParameters, size: BigInt)(implicit p: Parameters) extends SimpleLazyModule {
class SimAXIMem(edge: AXI4EdgeParameters, base: BigInt, size: BigInt)(implicit p: Parameters) extends SimpleLazyModule {
val node = AXI4MasterNode(List(edge.master))
val srams = AddressSet.misaligned(0, size).map { aSet =>
val srams = AddressSet.misaligned(base, size).map { aSet =>
LazyModule(new AXI4RAM(
address = aSet,
beatBytes = edge.bundle.dataBits/8,
Expand All @@ -28,7 +28,7 @@ object SimAXIMem {
def connectMMIO(dut: CanHaveMasterAXI4MMIOPort)(implicit p: Parameters): Seq[SimAXIMem] = {
dut.mmio_axi4.zip(dut.mmioAXI4Node.in).map { case (io, (_, edge)) =>
// test harness size capped to 4KB (ignoring p(ExtMem).get.master.size)
val mmio_mem = LazyModule(new SimAXIMem(edge, size = 4096))
val mmio_mem = LazyModule(new SimAXIMem(edge, base = p(ExtBus).get.base, size = 4096))
Module(mmio_mem.module).suggestName("mmio_mem")
mmio_mem.io_axi4.head <> io
mmio_mem
Expand All @@ -37,7 +37,7 @@ object SimAXIMem {

def connectMem(dut: CanHaveMasterAXI4MemPort)(implicit p: Parameters): Seq[SimAXIMem] = {
dut.mem_axi4.zip(dut.memAXI4Node.in).map { case (io, (_, edge)) =>
val mem = LazyModule(new SimAXIMem(edge, size = p(ExtMem).get.master.size))
val mem = LazyModule(new SimAXIMem(edge, base = p(ExtMem).get.master.base, size = p(ExtMem).get.master.size))
Module(mem.module).suggestName("mem")
mem.io_axi4.head <> io
mem
Expand Down

0 comments on commit f8fd601

Please sign in to comment.