-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add Select combinators #2674
add Select combinators #2674
Conversation
case class InwardEdge[Bundle <: Data, EdgeInParams]( | ||
params: Parameters, | ||
bundle: Bundle, | ||
edge: EdgeInParams, | ||
node: OutwardNode[_, _, Bundle], | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see a lot of wildcard type parameters here. Is it possible someone may someday want to care about the first two type parameters of node
? If so, we should probably go ahead and add them because adding them later will be very painful for anyone using this type.
That being said I don't know much about best practices and maintaining backwards compatibility in using type parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, those parameters are kind of implicitly captured by the EdgeInParams
type member, which inevitably will have members of the "missing" DI
and UI
types. So I guess I don't see much immediate practical value in offering those through this API. I do wonder whether since these classes are part of the public collect
interface, should they become part of top-level diplomacy API instead of embedded in this object Select
?
This claim is appealing and interesting. Ideally we would actually retire the baked-in monitor injection infrastructure and use the new methodology, rather than having two ways of doing the same thing. I wonder about applying the technique in practice. Specifically, can you demonstrate how one would replace the extant examples of What I am getting at is, while having to "modify any design code" to provide the |
3969026
to
cff70d5
Compare
cff70d5
to
cad41fe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, except for a few minor changes.
`LazyModule`s have a `getNodes` method that return all the nodes instantiated | ||
within that module. This can be combined with the `Select.collectInwardEdges` | ||
to select `LazyModule`s based on their connectivity. | ||
`Select.collectInwardEdges` takes a `BaseNode` and a parital function. It |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`Select.collectInwardEdges` takes a `BaseNode` and a parital function. It | |
`Select.collectInwardEdges` takes a `BaseNode` and a partial function. It |
src/main/scala/aop/Select.scala
Outdated
package freechips.rocketchip.aop | ||
|
||
import chisel3.{Data, RawModule} | ||
import chisel3.experimental.BaseModule |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is an unused import.
I added some mdoc examples https://github.com/chipsalliance/rocket-chip/blob/select-helpers/docs/src/diplomacy/select_tutorial.md. do you think the examples cover this use case or should there be more examples and/or select methods? |
@albertchen-sifive Nice! I love these examples, they are very cool. I don't think they quite hit the (admittedly-high) bar I am setting, which requires targeting specific pieces of a diplomatic graph at an even finer granularity. See this function for an example. We only disable monitoring for the connections coming into the tile that treat tile devices as slaves; we don't deactivate monitoring for the connections going out of the tile where the tile is the master device; these pieces of the graph are both put inside the same module hierarchy. This different treatment is because the slaves might have unique names and address ranges, checking of which by a Monitor breaks tile deduplication. I will freely admit that this is a bit of an esoteric use case that we might be able to avoid entirely with better test code extraction. And maybe a solution like a (later-inlined) LazyModule wrapper scope that can serve as the target of your Select would be an appropriate solution? @azidar @jackkoenig Any thoughts? Another example I would be interested in seeing is the equivalent of this You don't have to answer either of these questions now in order to merge in this PR, but I'd consider them the next phase of development in terms of deploying these capabilities in the wild. |
@hcook thanks for the examples. I'll leave those for another PR. |
This is a sketch of a Select library for diplomatic nodes and
LazyModules
. The motivation behind this is to enable fine-grained selection of node bundles for things like monitoring, without having to override theNodeImp.monitor
method or change aLazyModule
'sParameters
or modify any design code.Related issue:
Type of change: feature request
Impact: API addition (no impact on existing code)
Development Phase: proposal
Release Notes