1
0

make sure conf address map scales with number of cores

This commit is contained in:
Howard Mao 2015-09-25 09:41:19 -07:00
parent 5e3f9115d3
commit 0d763524ef

View File

@ -15,6 +15,16 @@ class DefaultConfig extends ChiselConfig (
topDefinitions = { (pname,site,here) => topDefinitions = { (pname,site,here) =>
type PF = PartialFunction[Any,Any] type PF = PartialFunction[Any,Any]
def findBy(sname:Any):Any = here[PF](site[Any](sname))(pname) def findBy(sname:Any):Any = here[PF](site[Any](sname))(pname)
def genCsrAddrMap() = {
val xLen = site(XLen)
val nSCR = site(HTIFNSCR)
val csrSize = (1 << 12) * (xLen / 8)
val nTiles = site(NTiles)
(0 until nTiles)
.map(i => (s"csr$i", None, MemSize(csrSize, AddrMap.RW))) :+
("scr", None, MemSize(nSCR * xLen / 8, AddrMap.RW))
}
pname match { pname match {
// //
case UseZscale => false case UseZscale => false
@ -159,9 +169,8 @@ class DefaultConfig extends ChiselConfig (
case ExternalIOStart => 2 * site(MMIOBase) case ExternalIOStart => 2 * site(MMIOBase)
case NASTIAddrMap => Seq( case NASTIAddrMap => Seq(
("mem", None, MemSize(site(MMIOBase), AddrMap.RWX)), ("mem", None, MemSize(site(MMIOBase), AddrMap.RWX)),
("conf", None, Submap(site(ExternalIOStart) - site(MMIOBase), ("conf", None, MemSubmap(site(ExternalIOStart) - site(MMIOBase),
("csr0", None, MemSize(1 << 15, AddrMap.RW)), genCsrAddrMap())),
("scr", None, MemSize(site(HTIFNSCR) * 8, AddrMap.RW)))),
("io", Some(site(ExternalIOStart)), ("io", Some(site(ExternalIOStart)),
MemSize(2 * site(MMIOBase), AddrMap.RW))) MemSize(2 * site(MMIOBase), AddrMap.RW)))
case NASTIAddrHashMap => new AddrHashMap(site(NASTIAddrMap)) case NASTIAddrHashMap => new AddrHashMap(site(NASTIAddrMap))