Skip to content

Commit

Permalink
Correct iterative naming for io's generated by Vec's apply(s: Seq) fa…
Browse files Browse the repository at this point in the history
…ctory method
  • Loading branch information
Henry Cook authored and Henry Cook committed Jan 7, 2013
1 parent 69a7ce5 commit 713523f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/main/scala/Vec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,15 @@ object Vec {
}

def apply[T <: Data](elts: Seq[T])(gen: => T): Vec[T] = {
val res =
if (elts.forall(_.litOf != null)) new ROM(elts.map(_.litOf), () => gen)
else new Vec[T](() => gen)
elts.foreach(res += _)
val res = if (elts.forall(_.litOf != null)) {
new ROM(elts.map(_.litOf), () => gen)
} else {
new Vec[T](() => gen)
}
elts.zipWithIndex.foreach{ case (e,i) =>
e.name += i
res += e
}
res
}

Expand Down

0 comments on commit 713523f

Please sign in to comment.