summaryrefslogtreecommitdiff
path: root/src/main/scala/chisel3/util/random/FibonacciLFSR.scala
diff options
context:
space:
mode:
authorJack Koenig2022-01-10 16:32:51 -0800
committerGitHub2022-01-10 16:32:51 -0800
commit2b48fd15a7711dcd44334fbbc538667a102a581a (patch)
tree4b4766347c3943d65c13e5de2d139b14821eec61 /src/main/scala/chisel3/util/random/FibonacciLFSR.scala
parent92e77a97af986629766ac9038f0ebc8ab9a48fa1 (diff)
parentbff8dc0738adafa1176f6959a33ad86f6373c558 (diff)
Merge pull request #2246 from chipsalliance/scalafmt
Add scalafmt configuration and apply it.
Diffstat (limited to 'src/main/scala/chisel3/util/random/FibonacciLFSR.scala')
-rw-r--r--src/main/scala/chisel3/util/random/FibonacciLFSR.scala30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/main/scala/chisel3/util/random/FibonacciLFSR.scala b/src/main/scala/chisel3/util/random/FibonacciLFSR.scala
index 32f5caa8..4da51a4e 100644
--- a/src/main/scala/chisel3/util/random/FibonacciLFSR.scala
+++ b/src/main/scala/chisel3/util/random/FibonacciLFSR.scala
@@ -40,14 +40,16 @@ import chisel3._
* $paramUpdateSeed
*/
class FibonacciLFSR(
- width: Int,
- taps: Set[Int],
- seed: Option[BigInt] = Some(1),
+ width: Int,
+ taps: Set[Int],
+ seed: Option[BigInt] = Some(1),
val reduction: LFSRReduce = XOR,
- step: Int = 1,
- updateSeed: Boolean = false) extends PRNG(width, seed, step, updateSeed) with LFSR {
+ step: Int = 1,
+ updateSeed: Boolean = false)
+ extends PRNG(width, seed, step, updateSeed)
+ with LFSR {
- def delta(s: Seq[Bool]): Seq[Bool] = taps.map{ case i => s(i - 1) }.reduce(reduction) +: s.dropRight(1)
+ def delta(s: Seq[Bool]): Seq[Bool] = taps.map { case i => s(i - 1) }.reduce(reduction) +: s.dropRight(1)
}
@@ -87,11 +89,12 @@ object FibonacciLFSR {
* $paramReduction
*/
def apply(
- width: Int,
- taps: Set[Int],
+ width: Int,
+ taps: Set[Int],
increment: Bool = true.B,
- seed: Option[BigInt] = Some(1),
- reduction: LFSRReduce = XOR): UInt = PRNG(new FibonacciLFSR(width, taps, seed, reduction), increment)
+ seed: Option[BigInt] = Some(1),
+ reduction: LFSRReduce = XOR
+ ): UInt = PRNG(new FibonacciLFSR(width, taps, seed, reduction), increment)
/** Return a pseudorandom [[UInt]] generated using a maximal period [[FibonacciLFSR]]
* $paramWidth
@@ -100,9 +103,10 @@ object FibonacciLFSR {
* $paramReduction
*/
def maxPeriod(
- width: Int,
+ width: Int,
increment: Bool = true.B,
- seed: Option[BigInt] = Some(1),
- reduction: LFSRReduce = XOR): UInt = PRNG(new MaxPeriodFibonacciLFSR(width, seed, reduction), increment)
+ seed: Option[BigInt] = Some(1),
+ reduction: LFSRReduce = XOR
+ ): UInt = PRNG(new MaxPeriodFibonacciLFSR(width, seed, reduction), increment)
}