Skip to content

Commit

Permalink
cache: add a wait state to avoid a livelock on line refills.
Browse files Browse the repository at this point in the history
  • Loading branch information
jfng committed Oct 4, 2024
1 parent 17b4b5d commit d8de00e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions minerva/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def elaborate(self, platform):
way.tag_wp.data.eq(0),
]
with m.If(flush_done):
m.next = "CHECK"
m.next = "DONE"
with m.Else():
m.d.sync += flush_line.eq(flush_line - 1)

Expand All @@ -169,7 +169,7 @@ def elaborate(self, platform):
way.tag_wp.en .eq(way_hit[i]),
way.tag_wp.data.eq(0),
]
m.next = "CHECK"
m.next = "DONE"

with m.State("REFILL"):
m.d.comb += [
Expand All @@ -188,10 +188,13 @@ def elaborate(self, platform):
with m.If(self.bus_ack):
with m.If(self.bus_last):
m.d.sync += way_lru.eq(~way_lru)
m.next = "CHECK"
m.next = "DONE"
with m.Else():
m.d.sync += self.bus_addr.word.eq(self.bus_addr.word + 1)

with m.State("DONE"):
m.next = "CHECK"

if platform == "formal":
with m.If(Initial()):
m.d.comb += Assume(fsm.ongoing("CHECK"))
Expand Down

0 comments on commit d8de00e

Please sign in to comment.