From ce310769de64ce11566f7539192976948c1b3a0e Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 17 Dec 2021 22:43:53 +0000 Subject: [PATCH] cleanup chunk_size and list of steps in GRev --- src/nmutil/grev.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/nmutil/grev.py b/src/nmutil/grev.py index 250643d..18b2398 100644 --- a/src/nmutil/grev.py +++ b/src/nmutil/grev.py @@ -101,12 +101,13 @@ class GRev(Elaboratable): step_i = self.input # start with input as the first step - for i in range(self.log2_width): + # create (reversed?) list of steps + steps = list(range(self.log2_width)) + if self.reverse_order: steps.reverse() + + for i in steps: # each chunk is a power-2 jump. - if self.reverse_order: - chunk_size = 1 << (self.log2_width-i-1) - else: - chunk_size = 1 << i + chunk_size = 1 << i # prepare a list of XOR-swapped bits of this layer/step butterfly = [step_i[j ^ chunk_size] for j in range(self.width)] # create muxes here: 1 bit of chunk_sizes decides swap/no-swap -- 2.30.2