提交 bb386a64 编写于 作者: L linjiawei

ParallelMux: assert inputs are not empty

上级 32e651b5
......@@ -5,6 +5,7 @@ import chisel3.util._
object ParallelOperation {
def apply[T <: Data](xs: Seq[T], func: (T, T) => T): T = {
require(xs.nonEmpty)
xs match {
case Seq(a) => a
case Seq(a, b) => func(a, b)
......@@ -37,4 +38,4 @@ object ParallelLookUp {
def apply[T<:Data](key: UInt, mapping:Seq[(UInt,T)]): T = {
ParallelMux(mapping.map(m => (m._1===key) -> m._2))
}
}
\ No newline at end of file
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册