add MultiChannel routing to Nasti interconnect generator

This commit is contained in:
Howard Mao committed 2015-10-26 12:16:17 -07:00
1 parent 8fe4917d8e
commit 3270d17ad3
2 files changed
+88 -53

No files matched your search

+13 -1
View File
@@ -36,8 +36,8 @@ trait HasAddrMapParameters {
abstract class MemRegion { def size: BigInt }
case class MemSize(size: BigInt, prot: Int) extends MemRegion
case class MemSubmap(size: BigInt, entries: AddrMap) extends MemRegion
case class MemChannels(size: BigInt, nchannels: Int, prot: Int) extends MemRegion
object AddrMapConsts {
val R = 0x4
@@ -68,6 +68,7 @@ class AddrMap(entries: Seq[AddrMapEntry]) extends scala.collection.IndexedSeq[Ad
this map { entry: AddrMapEntry => entry.region match {
case MemSize(_, _) => 1
case MemSubmap(_, submap) => submap.countSlaves
case MemChannels(_, nchannels, _) => nchannels
}} reduceLeft(_ + _)
}
}
@@ -102,6 +103,17 @@ class AddrHashMap(addrmap: AddrMap) {
ind += subpairs.size
base += size
}
// every channel gets the same base and size
case MemChannels(size, nchannels, prot) => {
if (!startOpt.isEmpty) base = startOpt.get
val subpairs = (0 until nchannels).map { i =>
val chname = name + ":" + i.toString
(chname, AddrHashMapEntry(ind + i, base, size, prot))
}
pairs = subpairs ++ pairs
ind += nchannels
base += size
}
}
}
pairs