-
Notifications
You must be signed in to change notification settings - Fork 19
LFSR
Snoopy87 edited this page Nov 14, 2017
·
3 revisions
There are two type of Linear-feedback-shift-register (LFSR) :
- Fibonacci
- Galois
import spinal.crypto.misc.LFSR
// LFSR with XOR and period (2^n-1)
val reg = Reg(Bits(8 bits)) init(10)
reg := LFSR.Fibonacci(reg, p"x^8 + x^6 + x^5 + x^4 + 1") // feedback polynomial
reg := LFSR.Fibonacci(reg, Seq(8, 6, 5, 4)) // taps
// LFSR with XNOR and the periods extended (2^n)
val reg1 = Reg(Bits(8 bits)) init(10)
reg1 := LFSR.Fibonacci(reg1, p"x^8 + x^6 + x^5 + x^4 + 1", LFSR.XNOR, extendsPeriod = true)
import spinal.crypto.misc.LFSR
// LFSR with XOR and period (2^n-1)
val reg = Reg(Bits(8 bits)) init(10)
reg := LFSR.Galois(reg, p"x^8 + x^6 + x^5 + x^4 + 1") // feedback polynomial
reg := LFSR.Galois(reg, Seq(8, 6, 5, 4)) // taps
// LFSR with XNOR and the periods extended (2^n)
val reg1 = Reg(Bits(8 bits)) init(10)
reg1 := LFSR.Galois(reg1, p"x^8 + x^6 + x^5 + x^4 + 1", LFSR.XNOR, extendsPeriod = true)