Skip to content

Commit

Permalink
fix: check if an EOF has been set without an SOF in the Cocotb MFB mo…
Browse files Browse the repository at this point in the history
…nitor
  • Loading branch information
danielkondys committed Nov 8, 2024
1 parent 9251cc2 commit 84a975b
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions python/cocotbext/cocotbext/ofm/mfb/monitors.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,19 @@ async def _monitor_recv(self):
self.log.debug(f"ee_idx {str(ee_idx)}")
self.log.debug(f"ss_idx {str(ss_idx)}")

if (self._eof_arr[rr] == 1) and (in_frame):
# Checks if there is a packet that is being processed and if it ends in this region.
self.log.debug("Frame End")
in_frame = False
eof_done = True
frame += data_bytes[rs_inx:ee_idx]
self.item_cnt += len(data_bytes[rs_inx:ee_idx])*8 // self._item_width
self.log.debug(f"frame done {frame.hex()}")
self._recv(frame)
self.frame_cnt += 1
if self._eof_arr[rr] == 1:
if in_frame:
# Checks if there is a packet that is being processed and if it ends in this region.
self.log.debug("Frame End")
in_frame = False
eof_done = True
frame += data_bytes[rs_inx:ee_idx]
self.item_cnt += len(data_bytes[rs_inx:ee_idx])*8 // self._item_width
self.log.debug(f"frame done {frame.hex()}")
self._recv(frame)
self.frame_cnt += 1
elif self._sof_arr[rr] == 1 and (self._eof_pos_arr[rr] < self._sof_pos_arr[rr]):
raise MFBProtocolError("MFB error: an end-of-frame received before a start-of-frame!")

if in_frame:
# Region with a valid 'middle of packet'.
Expand Down

0 comments on commit 84a975b

Please sign in to comment.