summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorEdward Wang2018-08-21 18:36:13 -0700
committeredwardcwang2018-08-22 11:55:38 -0700
commit3491ba89859e4b45b557485025ffe8cf5e298b54 (patch)
treed3c089f62313993d7c20e3fbf78866c1a43d40fc /src/main
parentadfdebc920530199a3a4473b7a1230088fec3f5e (diff)
Implement varargs MixedVec API
Diffstat (limited to 'src/main')
-rw-r--r--src/main/scala/chisel3/util/MixedVec.scala20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/main/scala/chisel3/util/MixedVec.scala b/src/main/scala/chisel3/util/MixedVec.scala
index a687c4cd..ec15e23a 100644
--- a/src/main/scala/chisel3/util/MixedVec.scala
+++ b/src/main/scala/chisel3/util/MixedVec.scala
@@ -24,6 +24,13 @@ object MixedVecInit {
}
hetVecWire
}
+
+ /**
+ * Construct a new wire with the given bound values.
+ * This is analogous to [[chisel3.core.VecInit]].
+ * @return MixedVec with given values assigned
+ */
+ def apply[T <: Data](val0: T, vals: T*): MixedVec[T] = apply(val0 +: vals.toSeq)
}
object MixedVec {
@@ -35,6 +42,19 @@ object MixedVec {
def apply[T <: Data](eltsIn: Seq[T]): MixedVec[T] = new MixedVec(eltsIn)
/**
+ * Create a MixedVec from that holds the given types.
+ * The types passed to this constructor must be Chisel types.
+ * @return MixedVec with the given types.
+ */
+ def apply[T <: Data](val0: T, vals: T*): MixedVec[T] = new MixedVec(val0 +: vals.toSeq)
+
+ /**
+ * Create a new MixedVec from an unbound MixedVec type.
+ * @return MixedVec with the given types.
+ */
+ def apply[T <: Data](mixedVec: MixedVec[T]): MixedVec[T] = new MixedVec(mixedVec.elts)
+
+ /**
* Create a MixedVec from the type of the given Vec.
* For example, given a Vec(2, UInt(8.W)), this creates MixedVec(Seq.fill(2){UInt(8.W)}).
* @param vec Vec to use as template