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

Add support for Avalon memory mapped peripherals #40

Closed
Jan-Snoeijs opened this issue May 13, 2023 · 8 comments
Closed

Add support for Avalon memory mapped peripherals #40

Jan-Snoeijs opened this issue May 13, 2023 · 8 comments
Assignees
Labels
feature request New feature or request

Comments

@Jan-Snoeijs
Copy link

The protocol is popular in Intel FPGAs. I am happy to help building support for this

@Jan-Snoeijs Jan-Snoeijs changed the title Support for Avalon memory mapped peripherals Add support for Avalon memory mapped peripherals May 13, 2023
@amykyta3 amykyta3 self-assigned this May 13, 2023
@amykyta3 amykyta3 added the feature request New feature or request label May 13, 2023
@amykyta3
Copy link
Member

I was actually wondering about Avalon and whether it was still popular with Intel devices. I primarily work with ARM-based ASICs and Xilinx FPGAs so am not as familiar with Intel's ecosystem. Seems like a very reasonable thing to add support for.

At first glance, it looks like the Avalon protocol has several different variants based on what interface properties are selected. Can you help me understand which permutations are more "popular"?

The basic handshake looks quite similar to AMBA's APB which is quite simple.
Additional modes appear to be similar to a subset of AMBA's AXI in some ways, so they look quite familiar to me already.

Specifically:

  • How prevalent is the use of the waitrequestAllowance property? This is doable, but I would have to implement a skid buffer to adapt. If not too popular, I'd prefer to skip this one.
  • How about pipelined transfers? The mode with variable latency would fit well with the internal PeakRDL architecture. I basically support something similar with AXI4-Lite.
  • Burst transfers do not seem particularly useful for the regblock generator since these are better suited for large memories/caches. Will probably not support.

My initial hunch is that I would add this as two Avalon variants:

  • Simple non-pipelined agent
  • Agent with pipelined support

I still need to study it a bit more - it's possible the pipelined implementation will be quite simple and the non-pipelined one is not necessary. Unlike AXI, Avalon does not seem to require wait states on the responses, so that simplifies things quite a bit.

Let me know what you think!

@Jan-Snoeijs
Copy link
Author

Jan-Snoeijs commented May 13, 2023

Thanks for the detailed analysis. The most common variants I have seen are:

I have also seen and used burst transfers, but can definitely be skipped.

I dont think waitrequestAllowance is very popular. I've never used that before

Implementing the agent with fixed wait-states should be the easiest as it's just a single handshake unlike AXI-lite's multiple handshakes for address, data and response

@amykyta3
Copy link
Member

Great! Thanks for confirming. This doesn't seem too difficult to add.

amykyta3 added a commit that referenced this issue May 14, 2023
@amykyta3
Copy link
Member

Turns out that Avalon adapts very cleanly to the internal protocol I use, so it was very quick to implement (see commit above)

I still need to put together some proper testcases and documentation, but that should be pretty quick work.

@Jan-Snoeijs
Copy link
Author

That was quick! Thank you so much

I have left a comment on the commit

amykyta3 added a commit that referenced this issue May 15, 2023
@amykyta3
Copy link
Member

amykyta3 commented May 15, 2023

Had to make a minor change to support proper pipelining, but it has been merged.

Would be nice to have an example agent.sv file this would produce to validate it.

If you want to try it on your end, do the following:

# Install PeakRDL first
python3 -m pip install peakrdl

# Replace the regblock generator installation with the pre-release
git clone git@github.com:SystemRDL/PeakRDL-regblock.git
python3 -m pip install ./PeakRDL-regblock/

# Generate an Avalon regblock from a SystemRDL definition
peakrdl regblock <your_rdl_file> --cpuif avalon-mm-flat -o output_dir/

Here is a simple RDL file you can use as a testcase: https://github.com/SystemRDL/PeakRDL-regblock/blob/main/tests/test_structural_sw_rw/regblock.rdl

Will the agent generated code be synchronous or purely combinational logic?

It depends. By default the Avalon interface will have zero latency and therefore be very combinational.
If you enable more re-timing stages via command-line args (see peakrdl regblock --help), there will be added access latency.

@Jan-Snoeijs
Copy link
Author

Thanks a lot! Will try on my end and let you know if there is anything odd

@amykyta3
Copy link
Member

Published in v0.14.0.

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

No branches or pull requests

2 participants