Commit 77b40f09 authored by Jens Korinth's avatar Jens Korinth
Browse files

DecoupledDataSource: repeat and non-pow2 sizes

* repeat now also works with size which are not a power of 2
* more complex Mux logic is only generated in case size is not a power
  of 2, otherwise identical as before
* cleaned up a little and used new logging facilities to implement
  fine-grained info at each consumption
parent 0e19c7ff
......@@ -39,9 +39,18 @@ class DecoupledDataSource[T <: Data](gen: T,
i := 0.U
}
.otherwise {
if (repeat)
when (io.out.ready && io.out.valid) { i := i + 1.U }
else
when (io.out.ready && io.out.valid && i < size.U) { i := i + 1.U }
when (io.out.ready && io.out.valid) {
val next = if (repeat) {
if (math.pow(2, log2Ceil(size)).toInt == size) {
i + 1.U
} else {
Mux((i + 1.U) < size.U, i + 1.U, 0.U)
}
} else {
Mux(i < size.U, i + 1.U, i)
}
info(p"i = $i -> $next, bits = 0x${Hexadecimal(io.out.bits.asUInt())}")
i := next
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment