-
Notifications
You must be signed in to change notification settings - Fork 32
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
[WIP]wishbone.Connector class #21
base: main
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #21 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 7 6 -1
Lines 693 725 +32
Branches 145 160 +15
=========================================
+ Hits 693 725 +32
Continue to review full report at Codecov.
|
Reason I ask is that I don't need this feature for my use case and implementation of it may take some time. |
In general my preference is to have a complete solution even if it takes a bit longer, but let's get the review started before you put more time into that. |
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.
We should also add support for memory maps. If the subordinate bus has a memory map, it should be exposed to the initiator bus. Something like this:
try:
sub_map = sub_bus.memory_map
intr_map = MemoryMap(...)
intr_map.add_window(sub_map, addr=0, sparse=False)
self.intr_bus.memory_map = intr_map
except NotImplementedError:
# Subordinate bus does not have a memory map.
pass
nmigen_soc/wishbone/bus.py
Outdated
@@ -166,6 +167,147 @@ def memory_map(self, memory_map): | |||
self._map = memory_map | |||
|
|||
|
|||
class Connector(Elaboratable): |
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.
Connector
seems too generic for a width up-converter. How about Upconverter
?
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.
As discussed in #18 I did use Connector because the functionality is broader then upconverting, it's functionality is to connect a single initiator to a single subordinate. Upconverting will be done when necessary.
You will need to agree with @whitequark what to go for.
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.
Could the Connector
class be composed internally of two separate up- and down-converter classes ?
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 can see during implementation of the feature if it makes sense to do that but current feeling is that it will cause unnecessary code duplication with negligible improvement in code clarity or maintainability.
nmigen_soc/wishbone/bus.py
Outdated
raise NotImplementedError( | ||
"Support for multi-cycle bus operation when initiator data_width is" | ||
"bigger than the subordinate one is not implemented." | ||
) |
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 should be a ValueError
.
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.
Plan is to later also implement downsizing in this class therefor NotImlementedError. This is thus alsot related to discussion in #18.
nmigen_soc/wishbone/bus.py
Outdated
|
||
m = Module() | ||
|
||
common_addr_width = min(intr_bus.addr_width, sub_bus.addr_width) |
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.
Could this be simplified to sub_bus.addr_width
? intr_bus.addr_width >= sub_bus.addr_width
is asserted later is the code.
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 removed the assert now, it was planned to be removed if multi-cycle bus was implemented.
Kept the common_addr_width definition as it is already future proof.
Actually in the first version I even enforced a memory map on subordinate bus like the Decoder does. But I removed all memory map code after I got problems with the unit test for different granularity. I based the data_width of the memory maps on the granularity of each bus. Then you get an error when adding the subordinate memorymap to the initiator one due to different data_width. |
280890c
to
ec94f31
Compare
ec94f31
to
3db2a83
Compare
Implementation of a module that allows to connect one initiator to one subordinate.bus. Currently connecting initiator bus with data width greater than the subordinate bus is not implemented. Implementation of that feature will need to instantiate multiple subordinate bus cycles for one initiator bus cycle.
3db2a83
to
1c7e14f
Compare
Codecov Report
@@ Coverage Diff @@
## main #21 +/- ##
========================================
Coverage ? 100.00%
========================================
Files ? 6
Lines ? 725
Branches ? 160
========================================
Hits ? 725
Misses ? 0
Partials ? 0 Continue to review full report at Codecov.
|
Currently pull request as WIP: