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

Wishbone adapter to access flash through a movable window #2134

Open
NateMeyer opened this issue Dec 3, 2024 · 2 comments
Open

Wishbone adapter to access flash through a movable window #2134

NateMeyer opened this issue Dec 3, 2024 · 2 comments

Comments

@NateMeyer
Copy link

I am trying to integrate the LiteSPI core as a flash controller to be accessible to a host through LitePCIe.

I do not want to map the entire flash region to the LitePCIe BAR0 but would rather create an adapter that maps several KB of address space of the BAR to the SPI flash and have a CSR that can set the upper address bits in the flash address to create a movable window for accessing the mmap of LiteSPI from the host.

I haven't been able to find any documentation or example that explains how I could create this adapter. Is this something the Wishbone Remapper can do? Can you help point me in the right direction for creating this adapter?

@enjoy-digital
Copy link
Owner

Hi @NateMeyer,

Yes, you can probably place a Wishbone Remapper between the LitePCIe master and the SoC to do this:

Start with a simple static remap: map addresses above your CSR region to the flash region and test this first.

Then extend the Remapper to support a runtime-configurable offset, allowing you to dynamically shift the accessible portion of flash.

For a simple example of remapping logic, see the LiteICLink demo: github.com/enjoy-digital/liteiclink/blob/af56f11e6ca41905aec2c77575c36d0cb21d374f/bench/serwb/demo/icebreaker.py#L85-L94

@NateMeyer
Copy link
Author

Thanks, that helps. I was trying to put the remapper between the SoC bus and the litespi and couldn't get anything working. I can read from the first part of the spiflash now.

I'll try extending the Remapper this week and let you know if I run into any more issues.

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

2 participants