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

Improve resources usage. #54

Open
enjoy-digital opened this issue Jul 30, 2021 · 6 comments
Open

Improve resources usage. #54

enjoy-digital opened this issue Jul 30, 2021 · 6 comments

Comments

@enjoy-digital
Copy link
Member

LiteSPI is working correctly with good performance on the different boards it has been tested but uses more resources than the LiteX SPIFlash core that was used previously.

When testing different configurations on the iCEBreaker (with python3 -m litex_boards.targets.1bitsquared_icebreaker --cpu-type=serv --build) we get the following resource usage:

No SPIFlash LiteX's SPIFlash LiteSPI (no Master) LiteSPI (with Master (depth=1)))
1883 LCs 2036 LCs 2353 LCs 2921 LCs
Ref +153 LCs +470 LCs +1038 LCs
- Ref +317 LCs + 885 LCs

The LiteX's SPIFlash core was equivalent to LiteSPI with Master enabled, so we should reduce resource usage to be able to do efficient designs on small FPGAs.

@zyp
Copy link
Collaborator

zyp commented Jul 30, 2021

I've been thinking that the PHY can be simplified a lot by removing the CMD and READ special casing and having LiteSPIMMAP use the USER interface instead. There doesn't seem to be any performance benefit in the special casing. While some of the resource usage would just move from the PHY core to the MMAP core, I believe the net total should be lower.

@enjoy-digital
Copy link
Member Author

@zyp: This architecture change could indeed make senses, it would probably reduce complexity and then resource usage.

Without modifying the architecture, I did some simplifications in the code and the current resource usage status now is:

No SPIFlash LiteX's SPIFlash LiteSPI (no Master) LiteSPI (with Master (depth=1)))
1883 LCs 2036 LCs 2318 LCs 2892 LCs
Ref +153 LCs +435 LCs +1009 LCs
- Ref +282 LCs +856 LCs

@zyp
Copy link
Collaborator

zyp commented Jul 30, 2021

Out of curiosity, have you checked the resource usage with only the master module enabled, not MMAP?

@enjoy-digital
Copy link
Member Author

With self.add_spi_flash(mode="4x", module=W25Q128JV(Codes.READ_1_1_4), with_mmap=False, with_master=True) (and minor tweaks in the code to allow the design to compile) I get 2673 LCs.

@mithro
Copy link
Contributor

mithro commented Jul 30, 2021

@kgugala - Can you please get someone to take a look at this?

@tmichalak
Copy link

@pawelsag please take a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants