Skip to content

Commit

Permalink
fix offset addressing
Browse files Browse the repository at this point in the history
  • Loading branch information
piotro888 committed Jun 25, 2024
1 parent 9d0bfea commit 5817f86
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions coreblocks/cache/icache.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,13 @@ def elaborate(self, platform):
):
req_addr = req_zipper.peek_arg(m)
refill_hit = (req_addr.tag == refill_tag) & (req_addr.index == refill_index)
refill_buffer_hit = refill_hit & refill_line_buffer[req_addr.offset].valid
refill_buffer_hit = refill_hit & refill_line_buffer[req_addr.offset[self.params.fetch_block_bytes_log :]].valid

with m.If(refill_buffer_hit | (refill_hit & refill_error_saved)):
m.d.comb += forwarding_response_now.eq(1)
m.d.sync += mem_read_output_valid.eq(0)
req_zipper.write_results(
m, fetch_block=refill_line_buffer[req_addr.offset].data, error=refill_error_saved
m, fetch_block=refill_line_buffer[req_addr.offset[self.params.fetch_block_bytes_log :]].data, error=refill_error_saved
)
m.d.sync += refill_error_saved.eq(0)

Expand Down Expand Up @@ -310,8 +311,8 @@ def _() -> None:
with m.If(ret.error):
m.d.sync += refill_error_saved.eq(1)

m.d.sync += refill_line_buffer[deserialized["offset"]].data.eq(ret.fetch_block)
m.d.sync += refill_line_buffer[deserialized["offset"]].valid.eq(~ret.error)
m.d.sync += refill_line_buffer[deserialized["offset"][self.params.fetch_block_bytes_log :]].data.eq(ret.fetch_block)
m.d.sync += refill_line_buffer[deserialized["offset"][self.params.fetch_block_bytes_log :]].valid.eq(~ret.error)

with m.If(fsm.ongoing("FLUSH")):
m.d.comb += [
Expand Down

0 comments on commit 5817f86

Please sign in to comment.