diff options
| author | Jim Lawson | 2016-09-23 08:19:43 -0700 |
|---|---|---|
| committer | GitHub | 2016-09-23 08:19:43 -0700 |
| commit | 785620b1403d827986bf60c2a001d8d6f71eed72 (patch) | |
| tree | 1c1a0b14b041e544da3ff8176aba200604a131b3 /src/main/scala/chisel3/util/LFSR.scala | |
| parent | b18e98ba2d058c7dd24f96f005486b70c856aeca (diff) | |
| parent | decb2ee0f0bb8223f0b2b067b88ed90b71473a28 (diff) | |
Merge pull request #291 from ucb-bar/utilscaladocs
Scaladocs for utils
Diffstat (limited to 'src/main/scala/chisel3/util/LFSR.scala')
| -rw-r--r-- | src/main/scala/chisel3/util/LFSR.scala | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/main/scala/chisel3/util/LFSR.scala b/src/main/scala/chisel3/util/LFSR.scala index a30c276f..e4261c20 100644 --- a/src/main/scala/chisel3/util/LFSR.scala +++ b/src/main/scala/chisel3/util/LFSR.scala @@ -8,12 +8,13 @@ package chisel3.util import chisel3._ // scalastyle:off magic.number -/** linear feedback shift register - */ -object LFSR16 -{ - def apply(increment: Bool = Bool(true)): UInt = - { +object LFSR16 { + /** Generates a 16-bit linear feedback shift register, returning the register contents. + * May be useful for generating a pseudorandom sequence. + * + * @param increment optional control to gate when the LFSR updates. + */ + def apply(increment: Bool = Bool(true)): UInt = { val width = 16 val lfsr = Reg(init=UInt(1, width)) when (increment) { lfsr := Cat(lfsr(0)^lfsr(2)^lfsr(3)^lfsr(5), lfsr(width-1,1)) } |
