Self-Motivated Wu
Self-Motivated Wu

Reputation: 407

How to convert Seq bool to UInt value in chisel?

I want to convert Seq[Bool] into a UInt value. I try asUInt method, but it report an error that asUInt is not a member of IndexedSeq.

For example:

val valid = Wire(Vec(4, Bool()))
val ready = Wire(Vec(4, Bool()))
val fire = (valid zip ready).map{case (vld, rdy) => vld && rdy}
val fire_mask = fire.asUInt()

Upvotes: 1

Views: 713

Answers (1)

FabienM
FabienM

Reputation: 3761

You should convert fire to Chisel Vec instead of Scala Vector:

val fire = VecInit((valid zip ready).map{case (vld, rdy) => vld && rdy})

Upvotes: 3

Related Questions