From b01ab17fcb948edb4dda903195a6b3a2f688371e Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 9 May 2019 11:37:59 +0100 Subject: [PATCH] reduce ANDing chain (using NOR) in group picker --- src/scoreboard/group_picker.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/scoreboard/group_picker.py b/src/scoreboard/group_picker.py index 333d5b1b..022543f0 100644 --- a/src/scoreboard/group_picker.py +++ b/src/scoreboard/group_picker.py @@ -16,14 +16,15 @@ class PriorityPicker(Elaboratable): m = Module() res = [] + ni = Signal(self.wid, reset_less = True) + m.d.comb += ni.eq(~self.i) for i in range(0, self.wid): t = Signal(reset_less = True) res.append(t) if i == 0: - m.d.comb += t.eq(self.i[0]) + m.d.comb += t.eq(self.i[i]) else: - m.d.comb += t.eq((~res[-2]) & self.i[i]) - res.append(t) + m.d.comb += t.eq(~Cat(ni[i], *self.i[:i]).bool()) # we like Cat(*xxx). turn lists into concatenated bits m.d.comb += self.o.eq(Cat(*res)) -- 2.30.2