From ac641fb183e3a8866e6bd72123801cfb04a0c893 Mon Sep 17 00:00:00 2001 From: Schuyler Eldridge Date: Mon, 19 Oct 2020 12:35:26 -0400 Subject: Enable Cat of Zero Element Vec (#1623) * Return 0.U for asUInt of a zero-element Seq Add a condition to SeqUtils.asUInt to have it return an unspecified width 0.U when applied to an empty sequence. This enables the ability to do a Cat of a zero-element sequence. Signed-off-by: Schuyler Eldridge * Test elaboration of Cat on zero-element Seq Signed-off-by: Schuyler Eldridge --- src/main/scala/chisel3/util/Cat.scala | 1 + 1 file changed, 1 insertion(+) (limited to 'src/main') diff --git a/src/main/scala/chisel3/util/Cat.scala b/src/main/scala/chisel3/util/Cat.scala index 793a5463..3369eb18 100644 --- a/src/main/scala/chisel3/util/Cat.scala +++ b/src/main/scala/chisel3/util/Cat.scala @@ -25,6 +25,7 @@ object Cat { * in the sequence forms the least significant bits. * * Equivalent to r(0) ## r(1) ## ... ## r(n-1). + * @note This returns a `0.U` if applied to a zero-element `Vec`. */ def apply[T <: Bits](r: Seq[T]): UInt = SeqUtils.asUInt(r.reverse) } -- cgit v1.2.3