From: Luke Kenneth Casson Leighton Date: Fri, 11 Sep 2020 14:21:05 +0000 (+0100) Subject: whoops new node not to be calculated at end X-Git-Tag: semi_working_ecp5~102 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0149d55b0ce51d5da140ed56388734fa6f9f0326;p=soc.git whoops new node not to be calculated at end --- diff --git a/src/soc/experiment/plru.py b/src/soc/experiment/plru.py index 9699694f..3400f8cd 100644 --- a/src/soc/experiment/plru.py +++ b/src/soc/experiment/plru.py @@ -30,11 +30,12 @@ class PLRU(Elaboratable): comb += node2.eq(node << 1) else: comb += node2.eq(node) - with m.If(tree[node]): - comb += node_next.eq(node2 + 2) - with m.Else(): - comb += node_next.eq(node2 + 1) - node = node_next + if i != self.BITS-1: + with m.If(tree[node]): + comb += node_next.eq(node2 + 2) + with m.Else(): + comb += node_next.eq(node2 + 1) + node = node_next with m.If(self.acc_en): node = Signal(self.BITS) @@ -49,10 +50,11 @@ class PLRU(Elaboratable): comb += node2.eq(node << 1) else: comb += node2.eq(node) - with m.If(abit): - comb += node_next.eq(node2 + 2) - with m.Else(): - comb += node_next.eq(node2 + 1) - node = node_next + if i != self.BITS-1: + with m.If(abit): + comb += node_next.eq(node2 + 2) + with m.Else(): + comb += node_next.eq(node2 + 1) + node = node_next return m