提交 e4ecf3b0 编写于 作者: J JinYue

ICache: fix physical tag bug

* Using get_phy_tag function instead of get_tag
* This bug happens when using VIPT ICache and setting lage set number
上级 31e152ef
...@@ -81,6 +81,7 @@ trait HasL1CacheParameters extends HasXSParameter ...@@ -81,6 +81,7 @@ trait HasL1CacheParameters extends HasXSParameter
def offsetlsb = wordOffBits def offsetlsb = wordOffBits
def get_tag(addr: UInt) = (addr >> untagBits).asUInt() def get_tag(addr: UInt) = (addr >> untagBits).asUInt()
def get_phy_tag(paddr: UInt) = (paddr >> pgUntagBits).asUInt()
def get_idx(addr: UInt) = addr(untagBits-1, blockOffBits) def get_idx(addr: UInt) = addr(untagBits-1, blockOffBits)
def get_block(addr: UInt) = addr >> blockOffBits def get_block(addr: UInt) = addr >> blockOffBits
def get_block_addr(addr: UInt) = (addr >> blockOffBits) << blockOffBits def get_block_addr(addr: UInt) = (addr >> blockOffBits) << blockOffBits
......
...@@ -268,7 +268,7 @@ class ICacheMissEntry(edge: TLEdgeOut)(implicit p: Parameters) extends ICacheMis ...@@ -268,7 +268,7 @@ class ICacheMissEntry(edge: TLEdgeOut)(implicit p: Parameters) extends ICacheMis
//req register //req register
val req = Reg(new ICacheMissReq) val req = Reg(new ICacheMissReq)
val req_idx = req.vSetIdx //virtual index val req_idx = req.vSetIdx //virtual index
val req_tag = get_tag(req.addr) //physical tag val req_tag = get_phy_tag(req.addr) //physical tag
val req_waymask = req.waymask val req_waymask = req.waymask
val (_, _, refill_done, refill_address_inc) = edge.addr_inc(io.mem_grant) val (_, _, refill_done, refill_address_inc) = edge.addr_inc(io.mem_grant)
......
...@@ -194,7 +194,7 @@ class NewIFU(implicit p: Parameters) extends XSModule with HasICacheParameters ...@@ -194,7 +194,7 @@ class NewIFU(implicit p: Parameters) extends XSModule with HasICacheParameters
tlbRespAllValid := tlbRespValid(0) && (tlbRespValid(1) || !f1_doubleLine) tlbRespAllValid := tlbRespValid(0) && (tlbRespValid(1) || !f1_doubleLine)
val f1_pAddrs = tlbRespPAddr //TODO: Temporary assignment val f1_pAddrs = tlbRespPAddr //TODO: Temporary assignment
val f1_pTags = VecInit(f1_pAddrs.map(get_tag(_))) val f1_pTags = VecInit(f1_pAddrs.map(get_phy_tag(_)))
val (f1_tags, f1_cacheline_valid, f1_datas) = (meta_resp.tags, meta_resp.valid, data_resp.datas) val (f1_tags, f1_cacheline_valid, f1_datas) = (meta_resp.tags, meta_resp.valid, data_resp.datas)
val bank0_hit_vec = VecInit(f1_tags(0).zipWithIndex.map{ case(way_tag,i) => f1_cacheline_valid(0)(i) && way_tag === f1_pTags(0) }) val bank0_hit_vec = VecInit(f1_tags(0).zipWithIndex.map{ case(way_tag,i) => f1_cacheline_valid(0)(i) && way_tag === f1_pTags(0) })
val bank1_hit_vec = VecInit(f1_tags(1).zipWithIndex.map{ case(way_tag,i) => f1_cacheline_valid(1)(i) && way_tag === f1_pTags(1) }) val bank1_hit_vec = VecInit(f1_tags(1).zipWithIndex.map{ case(way_tag,i) => f1_cacheline_valid(1)(i) && way_tag === f1_pTags(1) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册