From: Sebastien Bourdeauducq Date: Thu, 8 Mar 2012 14:34:08 +0000 (+0100) Subject: sim: fix zero encoding X-Git-Tag: 24jan2021_ls180~2099^2~985 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=678a89d5722fe9eb1f36aa6733c0f50076841615;p=litex.git sim: fix zero encoding --- diff --git a/migen/sim/ipc.py b/migen/sim/ipc.py index 5d9f9eb6..f463dcff 100644 --- a/migen/sim/ipc.py +++ b/migen/sim/ipc.py @@ -51,11 +51,14 @@ message_classes = [MessageTick, MessageGo, MessageWrite, MessageRead, MessageRea # def _pack_int(v): - p = [] - while v != 0: - p.append(v & 0xff) - v >>= 8 - p.insert(0, len(p)) + if v == 0: + p = [1, 0] + else: + p = [] + while v != 0: + p.append(v & 0xff) + v >>= 8 + p.insert(0, len(p)) return p def _pack_str(v):