fix read_tag to use word_select correctly
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 30 Sep 2020 08:45:56 +0000 (09:45 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 30 Sep 2020 08:45:56 +0000 (09:45 +0100)
src/soc/experiment/icache.py

index 4fb56dcf3b6d6cc1ff66db4b00b7fcbe1de2d09e..bcaf9b2ed454ce491d188a87abbe3b862fd8fd14 100644 (file)
@@ -398,7 +398,7 @@ def get_tag(addr):
 #     end;
 # Read a tag from a tag memory row
 def read_tag(way, tagset):
-    return tagset.word_select(way, TAG_WIDTH)[:TAG_BITS]
+    return tagset.word_select(way, TAG_BITS)
 
 #     -- Write a tag to tag memory row
 #     procedure write_tag(way: in way_t;
@@ -408,7 +408,7 @@ def read_tag(way, tagset):
 #     end;
 # Write a tag to tag memory row
 def write_tag(way, tagset, tag):
-    return tagset[way * TAG_BITS:(way + 1) * TAG_BITS].eq(tag)
+    return read_tag(way, tagset).eq(tag)
 
 #     -- Simple hash for direct-mapped TLB index
 #     function hash_ea(addr: std_ulogic_vector(63 downto 0))