-
Notifications
You must be signed in to change notification settings - Fork 574
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement asTypeOf, refactor internal APIs (#450)
- Loading branch information
Showing
8 changed files
with
289 additions
and
137 deletions.
There are no files selected for viewing
This file contains 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 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
Oops, something went wrong.
375e2b6
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.
This is causing chisel-testers failures in peek/poke which assume that there is an API ( the old flatten method) that pulls apart a structured signal into its basic components.
375e2b6
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 you need flatten there is a version in Data (though private, because it's probably really not the best API). Another option might be to refactor things to work more locally (getElements), one layer at a time?
375e2b6
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.
375e2b6
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.
getElements is essentially the flatten replacement. I'm not really sure what to do with flatten, since it really doesn't belong in Data. Also, if we further expand the amount of types Chisel has (like Analog, which can't flatten), flatten looks more and more like a broken, brittle API.
375e2b6
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.
This breaks chisel-tutorial.examples.AdderTester. The problem area appears to be:
Before this commit, the generated firrtl was:
With this commit, the generated firrtl is:
375e2b6
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 generated FIRRTL with this commit looks more sane? The only thing I see is that the directionality of the assign of cin, a, b is flipped, and more consistent with the input Chisel?
375e2b6
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 the broken firrtl, all the FA elements are on the same side of the
<=
operator. In the original chisel, some are sources and some are sinks. I don't think they should all be on the same side of the<=
in the generated firrtl.375e2b6
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.
Are you sure the previous code was sane? For example, there's a bit slice operation in the Chisel (io.A, io.B) that I don't see in the generated FIRRTL. And the new directionality of cin, a, b makes sense (compared to the input Chisel) while cout and sum doesn't match the old FIRRTL either...
375e2b6
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'll see if I can spot another culprit ...
375e2b6
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.
My initial analysis of the location of the error was incorrect. The failing source line is:
and the problem is due to the wiring up of the vector.
loses the directionality of the
elts
so the following test indoConnect()
returns false for theFAs
vector:and we take the
sink connect source
branch instead of thesink bulkConnect source
which we took in the old code.375e2b6
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.
This is something we should keep an eye on and revisit once the directionality / vec / binding refactors happen, I don't think it's desirable that this doesn't work.
375e2b6
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.
Filed issue #522.