From: Luke Kenneth Casson Leighton Date: Mon, 22 Apr 2019 20:58:26 +0000 (+0100) Subject: comment about max_exponent, remove its use: use python slice [:-1] X-Git-Tag: div_pipeline~2147 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d7d4d8c2219412a45f6f860cdc62d325a446bb36;p=soc.git 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 --- 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