Skip to content

Commit

Permalink
Update src/main/scala/util/HeterogeneousBag.scala
Browse files Browse the repository at this point in the history
Co-authored-by: Jack Koenig <koenig@sifive.com>
  • Loading branch information
jerryz123 and jackkoenig authored May 10, 2023
1 parent 9a1d783 commit b969099
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/scala/util/HeterogeneousBag.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import scala.collection.immutable.VectorMap
final case class HeterogeneousBag[T <: Data](elts: Seq[T]) extends Record with collection.IndexedSeq[T] {
val elements = VectorMap(elts.zipWithIndex.map { case (n,i) => (i.toString, DataMirror.internal.chiselTypeClone(n)) }:_*)

def apply(x: Int): T = elements.values.toSeq(x)
def apply(x: Int): T = {
val key = elements.keys(x) // VectorMap.keys returns a Vector
elements(key)
}
def length = elts.length

override def className: String = super.className
Expand Down

0 comments on commit b969099

Please sign in to comment.