summaryrefslogtreecommitdiff
path: root/src/main/scala/chisel3/util/Cat.scala
diff options
context:
space:
mode:
authorJim Lawson2016-10-06 08:57:10 -0700
committerJim Lawson2016-10-06 08:57:10 -0700
commit82625071405672eb4a19363d6f73f359ac28a7f5 (patch)
treedee5beff0e7333fa86c1cdcdb79c0d111114b8c9 /src/main/scala/chisel3/util/Cat.scala
parentb7c6e0d1a2098b545938a5a8dfce2b1d9294532f (diff)
parent7de30c2b893a3f24d43f2e131557430eb64f6bc8 (diff)
Merge branch 'master' into tobits-deprecation
Diffstat (limited to 'src/main/scala/chisel3/util/Cat.scala')
-rw-r--r--src/main/scala/chisel3/util/Cat.scala20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/main/scala/chisel3/util/Cat.scala b/src/main/scala/chisel3/util/Cat.scala
new file mode 100644
index 00000000..ba12a7d4
--- /dev/null
+++ b/src/main/scala/chisel3/util/Cat.scala
@@ -0,0 +1,20 @@
+// See LICENSE for license details.
+
+package chisel3.util
+
+import chisel3._
+import chisel3.core.SeqUtils
+
+object Cat {
+ /** Concatenates the argument data elements, in argument order, together.
+ */
+ def apply[T <: Bits](a: T, r: T*): UInt = apply(a :: r.toList)
+
+ /** Concatenates the data elements of the input sequence, in reverse sequence order, together.
+ * The first element of the sequence forms the most significant bits, while the last element
+ * in the sequence forms the least significant bits.
+ *
+ * Equivalent to r(0) ## r(1) ## ... ## r(n-1).
+ */
+ def apply[T <: Bits](r: Seq[T]): UInt = SeqUtils.asUInt(r.reverse)
+}