Skip to content

Commit

Permalink
collectLeafElements should also return probes
Browse files Browse the repository at this point in the history
  • Loading branch information
rwy7 committed Oct 5, 2023
1 parent edd4660 commit fc51f56
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions core/src/main/scala/chisel3/reflect/DataMirror.scala
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,20 @@ object DataMirror {
def getIntermediateAndLeafs(d: Data): Seq[Data] = collectAllMembers(d)

/** Recursively collect just the leaf components of a data component's children
* (i.e. anything that isn't a `Record` or a `Vec`, but an `Element`)
* (i.e. anything that isn't a `Record` or a `Vec`, but an `Element`).
* Probes of aggregates are also considered leaves.
*
* @param d Data component to recursively collect leaf components.
*
* @return All `Element` components; intermediate fields/indices are not included
*/
def collectLeafMembers(d: Data): Seq[Data] =
DataMirror.collectMembers(d) { case x: Element => x }.toVector
DataMirror
.collectMembers(d) {
case x: Element => x
case x if hasProbeTypeModifier(x) => x
}
.toVector

/** Recursively collect all expanded member components of a data component, including
* intermediate aggregate nodes
Expand Down

0 comments on commit fc51f56

Please sign in to comment.