From 7ce0f10f6c4723b99e6fdf20b37b706c8ae51c2e Mon Sep 17 00:00:00 2001 From: Schuyler Eldridge Date: Mon, 6 May 2019 23:44:20 -0400 Subject: Add chisel3.util.random lib w/ LFSR generator Builds out PRNG and LFSR type hierarchy. PRNG is the base class of LFSR of which Galois and Fibonacci are concrete implementations. PRNGs contain state (a UInt) and an update (delta) function. They have a compile-time optional seed to set the PRNG state. The seed/state can also be set at run-time. PRNGs can be run-time parameterized based on how many updates they should do per cycle and whether or not to send the seed through step-count state updates before loading it. (h/t @jwright6323) LFSRs are parameterized in a reduction operation (XOR or XNOR). An LFSR that does NOT have a seed will be automatically initialized to a minimally safe state (set/reset one bit) based on their reduction operation. (h/t @aswaterman) Adds Galois and Fibonacci LFSRs that define appropriate update functions. Companion objects provide helpers to automatically generate maximal period variants. Taps are provide for a very large set of widths. The LFSR companion object provides an apply method to generate a Fibonacci LFSR random variable (like the old LFSR16). --- src/test/scala/chiselTests/InstanceNameSpec.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/test') diff --git a/src/test/scala/chiselTests/InstanceNameSpec.scala b/src/test/scala/chiselTests/InstanceNameSpec.scala index 30dc46ba..7bb91b94 100644 --- a/src/test/scala/chiselTests/InstanceNameSpec.scala +++ b/src/test/scala/chiselTests/InstanceNameSpec.scala @@ -3,6 +3,7 @@ package chiselTests import chisel3._ +import chisel3.util.Queue import chisel3.experimental.{DataMirror, FixedPoint} import chisel3.testers.BasicTester @@ -17,7 +18,7 @@ class InstanceNameModule extends Module { val foo = UInt(8.W) } - val q = Module(new util.Queue(UInt(32.W), 4)) + val q = Module(new Queue(UInt(32.W), 4)) io.bar := io.foo + x } -- cgit v1.2.3