-
Notifications
You must be signed in to change notification settings - Fork 639
Closed
Milestone
Description
Type of issue: feature request
Impact: API addition (no impact on existing code)
Development Phase: request | proposal
Other information
Bit tired of writing boiler plate to connect DecoupledIO for every tiny job, I started to feel it neccessary to have 'map' on DecoupledIO
What's just working is
object ChiselFunctor {
implicit class DecoupledFuntor[T1 <: Bundle](d: DecoupledIO[T1]) {
def map[T2 <: Data](f: T1 => T2) : DecoupledIO[T2] = {
val new_bits = f(d.bits)
val new_decoupled = Wire(Decoupled(chiselTypeOf(new_bits)))
new_decoupled.ready := d.ready
new_decoupled.valid := d.valid
new_decoupled.bits := new_bits
new_decoupled
}
}
}
And after writing, I thought It would be great if this kind of functionality can be integrated, managed, and supported officially.
thanks for reading!
azidar, jeehoonkang and CircuitCoder