Skip to content

Commit

Permalink
Implement internal LSU clear handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Kristopher38 committed Oct 29, 2023
1 parent 1f64606 commit 19f3339
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions coreblocks/lsu/dummyLsu.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,19 @@ def elaborate(self, platform):

m.d.sync += self.loadedData.eq(self.postprocess_load_data(m, fetched.data, addr))

with m.If(fetched.err):
cause = Mux(is_load, ExceptionCause.LOAD_ACCESS_FAULT, ExceptionCause.STORE_ACCESS_FAULT)
self.report(m, rob_id=self.current_instr.rob_id, cause=cause)
# no clear (synonymous with instruction valid signal) was asserted
with m.If(self.current_instr.valid):
with m.If(fetched.err):
cause = Mux(is_load, ExceptionCause.LOAD_ACCESS_FAULT, ExceptionCause.STORE_ACCESS_FAULT)
self.report(m, rob_id=self.current_instr.rob_id, cause=cause)

m.d.sync += self.op_exception.eq(fetched.err)
m.d.sync += self.result_ready.eq(1)
m.d.sync += self.op_exception.eq(fetched.err)
m.d.sync += self.result_ready.eq(1)
with m.Else():
m.next = "Start"

with m.If(self.get_result_ack):
# result read ack or clear asserted
with m.If(self.get_result_ack | (self.result_ready & ~self.current_instr.valid)):
m.d.sync += self.result_ready.eq(0)
m.d.sync += self.op_exception.eq(0)
m.next = "Start"
Expand Down Expand Up @@ -271,9 +276,9 @@ def _(rob_id: Value):

@def_method(m, self.clear)
def _():
# TODO: clearing internal lsu component ;)
m.d.sync += current_instr.eq(0)
m.d.sync += current_instr.valid.eq(0)
m.d.sync += reserved.eq(0)
m.d.comb += internal.execute.eq(0)

return m

Expand Down

0 comments on commit 19f3339

Please sign in to comment.