From db24a14b57a7417b1613a9bf3ba466d107040f2f Mon Sep 17 00:00:00 2001 From: Emil J Date: Thu, 3 Nov 2022 12:51:26 +0100 Subject: [PATCH] lib.coding: remove GrayDecoder apparent comb loop for consistency --- amaranth/lib/coding.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/amaranth/lib/coding.py b/amaranth/lib/coding.py index aedff65..8813f70 100644 --- a/amaranth/lib/coding.py +++ b/amaranth/lib/coding.py @@ -178,7 +178,8 @@ class GrayDecoder(Elaboratable): def elaborate(self, platform): m = Module() - m.d.comb += self.o[-1].eq(self.i[-1]) - for i in reversed(range(self.width - 1)): - m.d.comb += self.o[i].eq(self.o[i + 1] ^ self.i[i]) + rhs = Const(0) + for i in reversed(range(self.width)): + rhs = rhs ^ self.i[i] + m.d.comb += self.o[i].eq(rhs) return m