1
0

util: AsyncQueue detect power-down/reset of non-empty queue

This commit is contained in:
Wesley W. Terpstra 2016-10-06 22:41:27 -07:00
parent 75bb94017b
commit 609fd97a71

View File

@ -58,6 +58,9 @@ class AsyncQueueSource[T <: Data](gen: T, depth: Int, sync: Int) extends Module
io.widx := widx_reg
io.mem := mem
// It is a fatal error to reset half a Queue while it still has data
assert (reset_n || widx === ridx)
}
class AsyncQueueSink[T <: Data](gen: T, depth: Int, sync: Int) extends Module {
@ -96,6 +99,9 @@ class AsyncQueueSink[T <: Data](gen: T, depth: Int, sync: Int) extends Module {
val ridx_reg = AsyncResetReg(ridx)
io.ridx := ridx_reg
// It is a fatal error to reset half a Queue while it still has data
assert (reset_n || widx === ridx)
}
class AsyncQueue[T <: Data](gen: T, depth: Int = 8, sync: Int = 3) extends Crossing[T] {