1
0

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:
Andrew Waterman 2016-04-27 14:52:05 -07:00
parent d3dee2c6c6
commit c8b1f0801b
3 changed files with 18 additions and 29 deletions

View File

@ -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,26 +84,20 @@ 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
pairs = (name, AddrHashMapEntry(ind, base, size, prot, cacheable)) +: pairs
base += size
ind += 1
am.foreach {
case AddrMapEntry(name, MemSize(size, prot, cacheable)) =>
pairs = (name, AddrHashMapEntry(ind, base, size, prot, cacheable)) +: pairs
base += size
ind += 1
case AddrMapEntry(name, MemSubmap(size, submap)) =>
val subpairs = genPairs(submap, base).map {
case (subname, AddrHashMapEntry(subind, subbase, subsize, prot, cacheable)) =>
(name + ":" + subname,
AddrHashMapEntry(ind + subind, subbase, subsize, prot, cacheable))
}
case MemSubmap(size, submap) => {
if (!startOpt.isEmpty) base = startOpt.get
val subpairs = genPairs(submap, base).map {
case (subname, AddrHashMapEntry(subind, subbase, subsize, prot, cacheable)) =>
(name + ":" + subname,
AddrHashMapEntry(ind + subind, subbase, subsize, prot, cacheable))
}
pairs = subpairs ++ pairs
ind += subpairs.size
base += size
}
}
pairs = subpairs ++ pairs
ind += subpairs.size
base += size
}
pairs
}

View File

@ -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) => {

View File

@ -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 {