Remove start address option from AddrMapEntries
It appears to never be used, and clutters things. The new invariant is that AddrMaps are relative and AddrHashMaps are absolute.
This commit is contained in:
parent
d3dee2c6c6
commit
c8b1f0801b
@ -59,7 +59,7 @@ class AddrMapProt extends Bundle {
|
||||
val r = Bool()
|
||||
}
|
||||
|
||||
case class AddrMapEntry(name: String, start: Option[BigInt], region: MemRegion)
|
||||
case class AddrMapEntry(name: String, region: MemRegion)
|
||||
|
||||
case class AddrHashMapEntry(port: Int, start: BigInt, size: BigInt, prot: Int, cacheable: Boolean)
|
||||
|
||||
@ -84,16 +84,12 @@ class AddrHashMap(addrmap: AddrMap, start: BigInt = BigInt(0)) {
|
||||
var ind = 0
|
||||
var base = start
|
||||
var pairs = Seq[(String, AddrHashMapEntry)]()
|
||||
am.foreach { case AddrMapEntry(name, startOpt, region) =>
|
||||
region match {
|
||||
case MemSize(size, prot, cacheable) => {
|
||||
if (!startOpt.isEmpty) base = startOpt.get
|
||||
am.foreach {
|
||||
case AddrMapEntry(name, MemSize(size, prot, cacheable)) =>
|
||||
pairs = (name, AddrHashMapEntry(ind, base, size, prot, cacheable)) +: pairs
|
||||
base += size
|
||||
ind += 1
|
||||
}
|
||||
case MemSubmap(size, submap) => {
|
||||
if (!startOpt.isEmpty) base = startOpt.get
|
||||
case AddrMapEntry(name, MemSubmap(size, submap)) =>
|
||||
val subpairs = genPairs(submap, base).map {
|
||||
case (subname, AddrHashMapEntry(subind, subbase, subsize, prot, cacheable)) =>
|
||||
(name + ":" + subname,
|
||||
@ -103,8 +99,6 @@ class AddrHashMap(addrmap: AddrMap, start: BigInt = BigInt(0)) {
|
||||
ind += subpairs.size
|
||||
base += size
|
||||
}
|
||||
}
|
||||
}
|
||||
pairs
|
||||
}
|
||||
|
||||
|
@ -505,21 +505,20 @@ class NastiRecursiveInterconnect(
|
||||
var lastEnd = base
|
||||
var slaveInd = 0
|
||||
val levelSize = addrmap.size
|
||||
val realAddrMap = new ArraySeq[(BigInt, BigInt)](addrmap.size)
|
||||
|
||||
addrmap.zipWithIndex.foreach { case (AddrMapEntry(name, startOpt, region), i) =>
|
||||
val start = startOpt.getOrElse(lastEnd)
|
||||
val realAddrMap = addrmap map { case AddrMapEntry(name, region) =>
|
||||
val start = lastEnd
|
||||
val size = region.size
|
||||
|
||||
require(bigIntPow2(size),
|
||||
require(isPow2(size),
|
||||
s"Region $name size $size is not a power of 2")
|
||||
require(start % size == 0,
|
||||
f"Region $name start address 0x$start%x not divisible by 0x$size%x" )
|
||||
require(start >= lastEnd,
|
||||
f"Region $name start address 0x$start%x before previous region end")
|
||||
|
||||
realAddrMap(i) = (start, size)
|
||||
lastEnd = start + size
|
||||
(start, size)
|
||||
}
|
||||
|
||||
val routeSel = (addr: UInt) => {
|
||||
|
@ -3,10 +3,6 @@ package junctions
|
||||
import Chisel._
|
||||
import cde.Parameters
|
||||
|
||||
object bigIntPow2 {
|
||||
def apply(in: BigInt): Boolean = in > 0 && ((in & (in-1)) == 0)
|
||||
}
|
||||
|
||||
class ParameterizedBundle(implicit p: Parameters) extends Bundle {
|
||||
override def cloneType = {
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user