From d7d4d8c2219412a45f6f860cdc62d325a446bb36 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Mon, 22 Apr 2019 21:58:26 +0100 Subject: [PATCH] comment about max_exponent, remove its use: use python slice [:-1] slice [:-1] is the python way to not need explicit length it is already in self.state, so no need to do self.max_exponent-1 just use -1 --- TLB/src/LFSR.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/TLB/src/LFSR.py b/TLB/src/LFSR.py index c850d5fb..d0c63227 100644 --- a/TLB/src/LFSR.py +++ b/TLB/src/LFSR.py @@ -70,7 +70,8 @@ class LFSR(LFSRPolynomial): Outputs: ------- - :state: the LFSR state. length is taken from the polynomial + :state: the LFSR state. bitwidth is taken from the polynomial + maximum exponent. Note: if an LFSRPolynomial is passed in as the input, because LFSRPolynomial is derived from set() it's ok: @@ -95,7 +96,7 @@ class LFSR(LFSRPolynomial): # if enabled, shift-and-feedback with m.If(self.enable): # shift up lower bits by Cat'ing in a new bit zero (feedback) - newstate = Cat(feedback, self.state[0:self.max_exponent - 1]) + newstate = Cat(feedback, self.state[:-1]) m.d.sync += self.state.eq(newstate) return m -- 2.30.2