From 0149d55b0ce51d5da140ed56388734fa6f9f0326 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 11 Sep 2020 15:21:05 +0100 Subject: [PATCH] whoops new node not to be calculated at end --- src/soc/experiment/plru.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) 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 -- 2.30.2