-
Notifications
You must be signed in to change notification settings - Fork 9
[BUGFIX] Fixing inconsistent check to classify Memory Type #106
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
There Is one potential Issue that CSR is declared in coredsl as a Memory Range "extern",
while the others are registers "register".
Also Alias were Memory objects before
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.
Sorry for being a bit imprecise. I was just referring to a piece of code that won't work together with the other PRs.
@PhilippvK and I still need to decide whether we want to merge your PR first or mine.
Uh oh!
There was an error while loading. Please reload this page.
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 have previously missed your comment on a global scope. Now it makes sense.
Here is an idea: I could refactor the checks to a Python - Mixin, which is then added to Alias, Registers, RegisterBank, Memory.
I think this would actually further improve consistency, especially, since I spotted that Register and RegisterBank both have i.e. is_pc as attribute. Would this solve your issue?
I'm however unsure if there is a proper OOP Solution, since this would imply the possibility of a Register being MainMemory... which is weird. What I could also do is refactor the functions as utils and put them into a seperate file?
Uh oh!
There was an error while loading. Please reload this page.
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 your approach with properties is still valid, and in my opinion it's an improvement over the current implementation. The main thing is to keep the responsibilities separated between the classes (
PC→Register,Main_reg/Floating_reg....→RegisterBank,Main_MEM/CSR→Memory).However, once you combine multiple dictionaries (e.g.
MemoryandAlias), you'll still need some form of type check, such asisinstance(...), before accessing class-specific attributes. Otherwise, you'll end up withAttributeErrors when an object doesn't define the expected attribute.Regarding moving the functions into a separate utility file, I don't think that's necessary. In some cases, it's useful to work with dictionaries containing multiple object types so the function can detect both
MemoryandAliasaccesses. In that scenario, a small amount of type discrimination seems reasonable and keeps the logic where it's actually needed.