When to use Seq or Vec in Chisel?
Use Seq
if you just need a Scala array or container. Use Vec
if you want a multiplexer.
scala.collection.immutable.Seq
is purely a Scala-land concept. You can index into it via a Int
thanks to its apply
function.
chisel3.Vec
is a hardware container that can be indexed by Scala-land Int
s and hardware UInt
s. It has two apply
overloads: apply(idx: Int): T
and apply(p: UInt): T
. It also have connection operators like :=
, allowing for element-wise connection.
Always refer to the (scarce) Chisel documentation when in doubt. If the API in question is not documented (which is very likely), read the source code for its exact behavior.