Is there a one-liner that takes a Vec[Bool] and creates an inverted version of it?
Here is an example of taking 37 bits, inverting them, then doing an OR reduction across all of them. Is there a one-liner that can replace the assignment of inv_a?
class MyModule extends Module {
val io = IO(new Bundle {
val a = Input(Vec(37, Bool()))
val b = Output(Bool())
})
val inv_a = Wire(Vec(37, Bool()))
for (i <- 0 until 37) {
inv_a(i) := ~io.a(i)
}
io.b := inv_a.reduce((a, b) => (a | b))
}
I think this does what you want.
val inv_a = (~ io.a.asUInt).asBools()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With