I am trying to use the chisel Queue class and want to be able to flush it on reset. It seems that in the past there was an option for a reset in the Class constructor
@deprecated("Module constructor with override _reset deprecated, use withReset", "chisel3")
def this(gen: T, entries: Int, pipe: Boolean, flow: Boolean, _reset: Bool)
However, as the deprecation message implies I should use withReset.
how do I do that ?
this question from 3 years ago is similar but the answer suggest to use _reset argumnet which is now deprecated.
That deprecation method is referring to withReset
. The (Spartan) API documentation can be found here and the source code is located here. Additionally, there's a discussion of multiple clock domains on the Chisel3 Wiki that gives some example usages.
These methods enable you to change which clock, reset, or clock and reset are used within a block of code. If you want to change which reset is used, something like the following will do that:
import chisel3.experimental.withReset
// ...
withReset(myReset) {
// Anything in here will be reset to myReset
}
For a more detailed example, the MultiClockSpec
tests provide some concrete examples. See: src/test/scala/chiselTests/MultiClockSpec.scala.