Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

Fix subaccess #1984

Merged
merged 3 commits into from
Dec 2, 2020
Merged

Fix subaccess #1984

merged 3 commits into from
Dec 2, 2020

Conversation

sequencer
Copy link
Member

@sequencer sequencer commented Nov 22, 2020

Contributor Checklist

  • Did you add Scaladoc to every public function/method?
  • Did you update the FIRRTL spec to include every new feature/behavior?
  • Did you add at least one test demonstrating the PR?
  • Did you delete any extraneous printlns/debugging code?
  • Did you specify the type of improvement?
  • Did you state the API impact?
  • Did you specify the code generation impact?
  • Did you request a desired merge strategy?
  • Did you add text to be included in the Release Notes for this change?

Type of Improvement

  • bug fix

API Impact

None

Backend Code Generation Impact

Bug fix for nested SubAccess, introduce one more And in firrtl.passes.RemoveAccesses, but should be eliminated in next optimization passes.
In nested SubAccess, fix the bug in #1959

Desired Merge Strategy

  • Rebase: You will rebase the PR onto master and it will be merged with a merge commit.

Release Notes

Bug fix for nested SubAccesses

Reviewer Checklist (only modified by reviewer)

  • Did you add the appropriate labels?
  • Did you mark the proper milestone (1.2.x, 1.3.0, 1.4.0) ?
  • Did you review?
  • Did you check whether all relevant Contributor checkboxes have been checked?
  • Did you mark as Please Merge?

@ekiwi
Copy link
Contributor

ekiwi commented Nov 22, 2020

Have you considered creating a node for the index expression?
I am just wondering, whether it would make for better firrtl and for a simpler compiler if we would generate nodes for all non-trivial index expressions and then visit them.

@sequencer
Copy link
Member Author

I got your point. That would be much better and reasonable to give most of FIRRTL generated expression with a readable name. It will much benefit generated verilog.
Just peek the original implementation before go to bed, I think there is still lacking of a infrastructure to get context for an Expression.
For example, most functions in a transform are directly manipulating a small FirrtlNode, which don't know where it is, and thus it still lack of enough information to construct its desired name for creating a DefNode.
I think we can have a global context cache, something like CircuitGraph. Or give every FirrtlNode a parents and children to reflect its own location in the AST, and add another pass to analyse AST, if we need to use the hierarchy of AST tree.

@ekiwi
Copy link
Contributor

ekiwi commented Nov 23, 2020

That would be much better and reasonable to give most of FIRRTL generated expression with a readable name.

I wasn't too concerned about readable names, for now, adding a new _GEN_... node should be fine.

@sequencer
Copy link
Member Author

I see, but what benefits can be provided, if this node have no readable name?

indexGuard,
exprGuard
),
EQV(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this expression could be cached, but IMO this is such a rare occurrence I don't think its too bad.

@jackkoenig jackkoenig added this to the 1.4.x milestone Dec 2, 2020
@jackkoenig jackkoenig added the Please Merge Accepted PRs that are ready to be merged. Useful when waiting on CI. label Dec 2, 2020
@mergify mergify bot merged commit 6c5ce83 into master Dec 2, 2020
mergify bot pushed a commit that referenced this pull request Dec 2, 2020
* add test for RemoveAccessesSpec.

* fix nested SubAccess bug.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit 6c5ce83)
@mergify mergify bot mentioned this pull request Dec 2, 2020
@mergify mergify bot added the Backported This PR has been backported to marked stable branch label Dec 2, 2020
mergify bot added a commit that referenced this pull request Dec 2, 2020
* add test for RemoveAccessesSpec.

* fix nested SubAccess bug.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit 6c5ce83)

Co-authored-by: Jiuyang Liu <[email protected]>
@jackkoenig jackkoenig deleted the fix_subaccess branch December 2, 2020 18:10
@ekiwi ekiwi mentioned this pull request Dec 2, 2020
5 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Backported This PR has been backported to marked stable branch bugfix Please Merge Accepted PRs that are ready to be merged. Useful when waiting on CI.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants