From: Dmitry Selyutin Date: Wed, 14 Sep 2022 23:04:12 +0000 (+0300) Subject: power_insn: support instruction bytes conversion X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e8b3cfcdd47efe6a9641d85c784703181bc760f1;p=openpower-isa.git power_insn: support instruction bytes conversion --- diff --git a/src/openpower/decoder/power_insn.py b/src/openpower/decoder/power_insn.py index c57ec57a..c6bb65d8 100644 --- a/src/openpower/decoder/power_insn.py +++ b/src/openpower/decoder/power_insn.py @@ -1064,6 +1064,10 @@ class Instruction(_Mapping): def __setitem__(self, key, value): return self.storage.__setitem__(key, value) + def bytes(self, byteorder="little"): + nr_bytes = (self.storage.bits // 8) + return int(self).to_bytes(nr_bytes, byteorder=byteorder) + def record(self, db): record = db[self] if record is None: