-
Notifications
You must be signed in to change notification settings - Fork 637
Add property support to SRAMInterface-based SRAM #4298
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
Conversation
3878620
to
1a7e329
Compare
f6fa892
to
2fb0879
Compare
2fb0879
to
cf9833c
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.
I took a look through this, and I don't have any major concerns with the implementation.
This is opening an interesting door though...now that Chisel can support such information, what APIs merit having Objects built in within Chisel? Should this always be added in SRAM, or maybe there is a subclass or some other class that users can pick if they want the description.
I'm also keenly aware that CIRCT produces this information as it compiles memories. We have actually recently added support for this same information to be added automatically within CIRCT and bubbled up to the compilation unit's top level for all SRAMS. So there are a couple things to think about:
- This shouldn't conflict with that, but it would be good to confirm
- This could potentially replace the CIRCT pass adding the information
The last point it a worthy goal, but the CIRCT pass has some...peculiar requirements. And due to Hyrum's Law, those have now become entrenched. To fully replace the existing CIRCT pass that's already adding basically this information, we'd need to work out all the weird uses downstream. Specifically, there is a behavior in CIRCT that the hierarchy
field is the hierarchical path before any SRAM extraction has happened, whereas if this is implemented in Chisel, it will always point to the final hierarchical path of the SRAM. That's arguably the right thing, but I know of downstream users who depend on the previous, non-intuitive behavior.
a64f9df
to
53359cb
Compare
In my team, I was proposing:
I do agree we should replace the |
53359cb
to
8520726
Compare
cc @debs-sifive and @jackkoenig, I reverted #4364 in a8cdaf4: since I think exposing the |
@sequencer thanks for looking at this — I think your approach is definitely safer and more user-friendly than using
|
If we are construction another standalone OM, e.g. My concern is: a |
The problem is that there is currently no way in Chisel to access the fields of the
It's not |
private val descriptionDefinition: Definition[SRAMDescription] = Instantiate.definition(new SRAMDescription) | ||
private val descriptionType: ClassType = descriptionDefinition.getClassType | ||
val description: Property[ClassType] = Property[descriptionType.Type]() |
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.
The Definition
should not be a field of the Bundle
, it should possibly be a field of the companion object (if we're saying there's only 1 definition for all SRAMDescriptions
), or possibly an argument to the constructor. I'm thinking maybe we should go with argument to constructor because I suspect users are going to want to optionally add their own metadata to SRAMs which implies there may not be a single definition for all of them.
One thing to note is this is a very backwards incompatible change, anyone using
We also want the description to be typed, Property[SRAMDescription]
, otherwise this is weird and erased and not useful as a Chisel API (e.g. our use case of accessing the hierarchy
field from 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.
it should possibly be a field of the companion object
Sounds good, I will do it later. For user adding their own metadata, Explicitly instantiating the SRAMDescription
and connect sounds dangerous, I think we should consider what to add and how to add. e.g. SRAM description string, Initial ROM, UPF fields, etc.
accessing the hierarchy field from it
yes if you need to access the hierarchy
field, we need add new API to Class
to extract it.
@instantiable | ||
private[chisel3] class SRAMDescription extends Class { |
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.
@instantiable | |
private[chisel3] class SRAMDescription extends Class { | |
@instantiable | |
final class SRAMDescription extends Class { |
This should be public and should be used in the type of the description
property in the SRAMInterface
.
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.
Yes, if you are going to use hierarchy: Property[Path]
in Chisel, this should be public, but if not, private it will be better.
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.
If we are telling people to use it via CIRCT API (as the ScalaDoc suggests, ScalaDoc that will not be published if it's private by the way), then this is a public API and should be public.
Marked API Modification because this will break any use of |
Yes, That's a problem, in our side, we just throw the entire Property to another Property rather than filter out some internal property LOL, the output Top OM might be verbosity though... |
I pushed a commit showing what I want to see, I thought we could get by with |
I see. this is another key feature I also need, |
Or possible the issue is that instances of classes aren't the right API, but perhaps it really should be a of Properties... I'm playing around with the PR I promised but it does feel weird that classes are Module-like but I'm basically trying to use them as a struct of properties. I think this is a question for @mikeurbach and @albertchen-sifive about what really is the intended usage model here. |
I was confused by this for a long time. But this is the only way I made it successfully work😅 |
I changed |
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'm happy with this using a Bundle
, we can revisit if any issues come up though.
cc @jackkoenig, |
This PR adds Property support for
SRAMInterface
, instantiating theSRAMOM
when usingSRAMInterface
. In our flow this is intend to replace the repl-sram and provide a unified Verilog for both synthesis tool and simulation tools.Contributor Checklist
docs/src
?Type of Improvement
Desired Merge Strategy
Release Notes
add property to SRAMInterface
Reviewer Checklist (only modified by reviewer)
3.6.x
,5.x
, or6.x
depending on impact, API modification or big change:7.0
)?Enable auto-merge (squash)
, clean up the commit message, and label withPlease Merge
.Create a merge commit
.