1
0

Use a better iterator inside the DCache

This commit is contained in:
Ben Keller 2016-08-25 15:49:44 -07:00 committed by Howard Mao
parent 93c801f598
commit 79293f4fa2

View File

@ -755,13 +755,13 @@ class DataArray(implicit p: Parameters) extends L1HellaCacheModule()(p) {
val rway_en = io.read.bits.way_en(w+rowWords-1,w) val rway_en = io.read.bits.way_en(w+rowWords-1,w)
val resp = Wire(Vec(rowWords, Bits(width = encRowBits))) val resp = Wire(Vec(rowWords, Bits(width = encRowBits)))
val r_raddr = RegEnable(io.read.bits.addr, io.read.valid) val r_raddr = RegEnable(io.read.bits.addr, io.read.valid)
for (p <- 0 until resp.size) { for (i <- 0 until resp.size) {
val array = SeqMem(nSets*refillCycles, Vec(rowWords, Bits(width=encDataBits))) val array = SeqMem(nSets*refillCycles, Vec(rowWords, Bits(width=encDataBits)))
when (wway_en.orR && io.write.valid && io.write.bits.wmask(p)) { when (wway_en.orR && io.write.valid && io.write.bits.wmask(i)) {
val data = Vec.fill(rowWords)(io.write.bits.data(encDataBits*(p+1)-1,encDataBits*p)) val data = Vec.fill(rowWords)(io.write.bits.data(encDataBits*(i+1)-1,encDataBits*i))
array.write(waddr, data, wway_en.toBools) array.write(waddr, data, wway_en.toBools)
} }
resp(p) := array.read(raddr, rway_en.orR && io.read.valid).asUInt resp(i) := array.read(raddr, rway_en.orR && io.read.valid).asUInt
} }
for (dw <- 0 until rowWords) { for (dw <- 0 until rowWords) {
val r = Vec(resp.map(_(encDataBits*(dw+1)-1,encDataBits*dw))) val r = Vec(resp.map(_(encDataBits*(dw+1)-1,encDataBits*dw)))