mem-cache: Protect tag from being mishandled
authorDaniel R. Carvalho <odanrc@yahoo.com.br>
Thu, 20 Feb 2020 15:23:16 +0000 (16:23 +0100)
committerDaniel Carvalho <odanrc@yahoo.com.br>
Tue, 6 Oct 2020 09:05:49 +0000 (09:05 +0000)
commitcbf530c33809803ac3eabc56176c521047a0882d
tree4cf938937fc9d7b770e59ec99035a782e92e4b06
parentea8bceb5933efb5880c44502cca9423c1d1d6f7f
mem-cache: Protect tag from being mishandled

Make the tag variable private, so that every access to it must pass
through a getter and a setter. This protects it from being incorrectly
updated when there is no direct match between a tag and a data entry,
as is the case of sector, compressed, decoupled, and many other table
layouts.

As a side effect, a block matching function has been created, which
also depends directly on the mapping between tag and data entries.

Change-Id: I848a154404feb5cbcea8d0fd2509bf49e1d73bd0
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/34955
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/mem/cache/cache_blk.cc
src/mem/cache/cache_blk.hh
src/mem/cache/tags/base.cc
src/mem/cache/tags/base_set_assoc.hh
src/mem/cache/tags/compressed_tags.cc
src/mem/cache/tags/fa_lru.cc
src/mem/cache/tags/fa_lru.hh
src/mem/cache/tags/sector_blk.cc
src/mem/cache/tags/sector_blk.hh
src/mem/cache/tags/sector_tags.cc