forked from chipsalliance/rocket-chip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request chipsalliance#2178 from chipsalliance/diplomatic-i…
…o-creation-2 Modernize Port Creation
- Loading branch information
Showing
6 changed files
with
99 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// See LICENSE.SiFive for license details. | ||
|
||
package freechips.rocketchip.system // TODO this should really be in a testharness package | ||
|
||
import chisel3._ | ||
import freechips.rocketchip.amba.axi4._ | ||
import freechips.rocketchip.config.{Parameters} | ||
import freechips.rocketchip.diplomacy._ | ||
import freechips.rocketchip.subsystem.{CanHaveMasterAXI4MMIOPort, CanHaveMasterAXI4MemPort, ExtMem} | ||
|
||
/** Memory with AXI port for use in elaboratable test harnesses. */ | ||
class SimAXIMem(edge: AXI4EdgeParameters, size: BigInt)(implicit p: Parameters) extends SimpleLazyModule { | ||
val node = AXI4MasterNode(List(edge.master)) | ||
val srams = AddressSet.misaligned(0, size).map{ aSet => LazyModule(new AXI4RAM(aSet, beatBytes = edge.bundle.dataBits/8))} | ||
val xbar = AXI4Xbar() | ||
srams.foreach{ s => s.node := AXI4Buffer() := AXI4Fragmenter() := xbar } | ||
xbar := node | ||
val io_axi4 = InModuleBody { node.makeIOs() } | ||
} | ||
|
||
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)) | ||
Module(mmio_mem.module).suggestName("mmio_mem") | ||
mmio_mem.io_axi4.head <> io | ||
mmio_mem | ||
} | ||
} | ||
|
||
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)) | ||
Module(mem.module).suggestName("mem") | ||
mem.io_axi4.head <> io | ||
mem | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters