Skip to content
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

soc/interconnect/wishbone: Add incrementing address burst mode to SRAM #1267

Merged
merged 8 commits into from
Apr 15, 2022

Conversation

koluckirafal
Copy link
Contributor

This pull request adds support for incrementing address burst cycles to SRAM module. Both linear and wrapped increments are supported.
Because for some designs burst might be unnecessary (e.g. no cache in CPU core), it is disabled by default. It can be turned on by passing parameter burst=True in SoCCore.add_ram() function, with shortcut available for integrated *RAM/ROM modules in the form of integrated_{rom,sram,main_ram}_burst parameters in SoCCore class.

Implementation was tested by writing a test suite and an example SoC for measuring speed difference: https://github.com/antmicro/wishbone-interconnect-burst-mode-benchmark (README contains results and instructions how to run tests).

Wishbone burst cycle documentation: https://wishbone-interconnect.readthedocs.io/en/latest/04_registered.html

@tmichalak tmichalak requested a review from enjoy-digital April 5, 2022 12:22
Copy link
Owner

@enjoy-digital enjoy-digital left a comment

Choose a reason for hiding this comment

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

Thanks @koluckirafal. I just did a quick first review:

  • Burst support should probably be enabled at the bus level (through bus_bursting parameter that would then be propagated to memories).
  • To be able to maintain this feature we'll need a unit-tests that cover the different burst mode/corner cases and would be run in LiteX-CI. Would it be possible to add it?

@koluckirafal koluckirafal force-pushed the wb-sram-inc-burst branch 3 times, most recently from e8ce171 to 3c5fad5 Compare April 6, 2022 13:19
@koluckirafal
Copy link
Contributor Author

  • Burst support should probably be enabled at the bus level (through bus_bursting parameter that would then be propagated to memories).

Done, burst cycles support can be now enabled with bus_bursting optional parameter in SoCBusHandler. Corresponding argument in soc_core_args() is also now available.

  • To be able to maintain this feature we'll need a unit-tests that cover the different burst mode/corner cases and would be run in LiteX-CI. Would it be possible to add it?

I couldn't find any tests in LiteX for Wishbone modules other than {Up,Down}Converter. Should I write tests only for SRAM or also for all other Wishbone modules?

@enjoy-digital
Copy link
Owner

Thanks for the update. The unit-tests are indeed minimal on Wishbone and that's clearly something we should improve in the future. I'm of course not asking you to write unit-tests for the other Wishbone modules but would like to have a unit-test for the SRAM that exercise the burst support (to be able to rework/maintain this code more easily in the future) Thanks!

@koluckirafal koluckirafal force-pushed the wb-sram-inc-burst branch 3 times, most recently from e578c42 to d7b1aff Compare April 11, 2022 15:20
@koluckirafal
Copy link
Contributor Author

I added a basic unit test for SRAM write and read operations, should be enough for testing incrementing address burst cycle support - currently only linear and 4-beat wrap increments are tested.

@enjoy-digital
Copy link
Owner

enjoy-digital commented Apr 11, 2022

Thanks for the update. I added a few review comments in the code. We should really try to simplify it when possible (otherwise it's difficult to do maintenance/support). Can you also add a test for Constant bursts? After addressing this it will be fine and I'll do the other improvement I can see myself. Thanks!

@koluckirafal
Copy link
Contributor Author

Test for constant address burst cycle added - it works despite the lack of constant address burst support in wishbone.SRAM, because unsupported cycle types are treated as classic cycle.
About review comments, I couldn't find them, probably due to rebasing I did previously.

@enjoy-digital
Copy link
Owner

Thanks for the additional test, sorry the comments were still pending. This should be good now.

This commit adds support for incrementing burst cycles in SRAM peripheral.
By default it's enabled, but can be disabled by passing `burst=False`
to the class while initializing, if it won't be useful for created design
(e.g. no Wishbone bus masters with burst support).
This commit also replaces hardcoded CTI signal values with constants.
Tests incrementing address burst cycle with linear and wrapped increments.
Only 4-beat wrap burst is tested in `test_sram_burst_wrap` test.
@koluckirafal koluckirafal force-pushed the wb-sram-inc-burst branch 2 times, most recently from e153821 to 77ff57e Compare April 12, 2022 13:14
Copy link
Owner

@enjoy-digital enjoy-digital left a comment

Choose a reason for hiding this comment

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

Thanks @koluckirafal for the updates/changes. This now looks good and can be merged. I'll maybe do another review or some changes on the burst logic, now that this is integrated correctly and with tests, it will be be easy to do this.

@enjoy-digital enjoy-digital merged commit 9c4778b into enjoy-digital:master Apr 15, 2022
@enjoy-digital
Copy link
Owner

Sorry, while reading the code it's not clear to me which exact type of bursts should be supported can you list them?. It seems that adr_burst_wrap is not used, so how is done the differentiation between a Incrementing Linear Burst and Wrapped Burst?

@koluckirafal
Copy link
Contributor Author

Differentation between linear and wrapped incrementing address bursts is done by BTE signal - it's used to select the wrap mask, which then is being used for separating the first address into initial counter value and offset.
If BTE is equal 0, then the first addess is loaded "as is" to the counter and offset register is unused; otherwise up to 4 least significant address bits (BTE == 0b11) are loaded to the offset register and are also set to 0 when setting initial counter value.
This way the same address counter logic can support both linear and {4, 8, 16}-beat wrapped increments.

adr_burst_wrap signal is probably a leftover from earlier experiments and can be removed.

koluckirafal added a commit to antmicro/CFU-Playground that referenced this pull request Apr 19, 2022
This commit adds support for incrementing address burst cycles
in NXLRAM Wishbone interface.
Ported from enjoy-digital/litex#1267
koluckirafal added a commit to antmicro/CFU-Playground that referenced this pull request Apr 20, 2022
This commit adds support for incrementing address burst cycles
in NXLRAM Wishbone interface.
Ported from enjoy-digital/litex#1267

Signed-off-by: Rafal Kolucki <[email protected]>
koluckirafal added a commit to antmicro/CFU-Playground that referenced this pull request Apr 28, 2022
This commit adds support for incrementing address burst cycles
in NXLRAM Wishbone interface.
Ported from enjoy-digital/litex#1267

Signed-off-by: Rafal Kolucki <[email protected]>
koluckirafal added a commit to antmicro/CFU-Playground that referenced this pull request May 9, 2022
This commit adds support for incrementing address burst cycles
in NXLRAM Wishbone interface.
Ported from enjoy-digital/litex#1267

Signed-off-by: Rafal Kolucki <[email protected]>
koluckirafal added a commit to antmicro/CFU-Playground that referenced this pull request May 9, 2022
This commit adds support for incrementing address burst cycles
in NXLRAM Wishbone interface.
Ported from enjoy-digital/litex#1267

Signed-off-by: Rafal Kolucki <[email protected]>
@tmichalak tmichalak deleted the wb-sram-inc-burst branch October 13, 2022 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants