From: Luke Kenneth Casson Leighton Date: Fri, 9 Sep 2022 15:25:31 +0000 (+0100) Subject: add seek/tell on load in pysvp64dis so that generator can be reused X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=99e01e99414d0e7c1c1a60dcc174a88001726fa9;p=openpower-isa.git add seek/tell on load in pysvp64dis so that generator can be reused --- diff --git a/src/openpower/sv/trans/pysvp64dis.py b/src/openpower/sv/trans/pysvp64dis.py index 38b4017d..135d9c0c 100644 --- a/src/openpower/sv/trans/pysvp64dis.py +++ b/src/openpower/sv/trans/pysvp64dis.py @@ -24,6 +24,7 @@ class ByteOrder(_enum.Enum): def load(ifile, byteorder=ByteOrder.LITTLE, **_): byteorder = str(byteorder) + curpos = ifile.tell() # get file position while True: insn = ifile.read(4) @@ -49,6 +50,8 @@ def load(ifile, byteorder=ByteOrder.LITTLE, **_): insn = _PrefixedInstruction.pair(prefix=prefix, suffix=suffix) yield insn + ifile.seek(curpos) # restore position so that generator can be reused + def dump(insns, verbose, short=False, **_): db = _Database(_find_wiki_dir())