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

Complete AXI wrapper generator #1934

Merged
merged 30 commits into from
Feb 28, 2024
Merged

Complete AXI wrapper generator #1934

merged 30 commits into from
Feb 28, 2024

Conversation

nathanielnrn
Copy link
Contributor

This PR introduces a working axi-generator.py which takes in anyxi specification for a Calyx program and generates an AXI wrapper that can be integrated with said program.

The AXI wrapper uses a read -> compute -> write scheme in that it reads all of its data via AXI, populating internal ref memories, before invoking some main module that is expected to perform a computation on those memories, and then writing the results back to the host via AXI.

This PR adds some concrete examples to be used as a working example to make changes off of.
Namely, a wrapped version of vec_add is added at yxi/axi-calyx/generated-axi-with-vec-add.futil.
This is the result of concatenating a fixed (some bit width adjustments) vec_add at fixed-vec-add.futil to the wrapper generated by passing the following yxi to axi-generator.py:

{
  "toplevel": "main",
  "memories": [
    {
      "name": "A0",
      "width": 32,
      "size": 8
    },
    {
      "name": "B0",
      "width": 32,
      "size": 8
    },
    {
      "name": "Sum0",
      "width": 32,
      "size": 8
    }
  ]
}

It seems to me like the immediate next step should be getting this integrated to work with fud2 and ensure that this wrapper works on more programs than just vec_add. #1932 #1933 and #1918 work towards that goal.

We will also need to eventually figure out the subordinate control scheme to eventually work with XRT, but I think it can make sense for that to happen after the fud2 integration is done. Happy to hear other thoughts, though.

Done with input/output, cells, wires, and groups (there are none)
TODO: Control sequence
TBD If the spec is implemented properly (probably not)

TODO:
1. Get AXI working with cocotb tests
2. Hook up runt tests
3. Refactor/minimize generator code
4... Fud2 integration?
This reverts commit a9628ce, reversing
changes made to 7a28be6.
Issue before was the vec_add was wrong, we need 4 bits instead of 3,
even though we're counting 0-7 because of the presence of a <=
check (so we need to get to 8 for our while loop to terminate)
Copy link
Contributor

@sampsyo sampsyo left a comment

Choose a reason for hiding this comment

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

Wahoo!! This looks great! I say go right ahead and merge as is.

On the subject of next steps and making end-to-end runs of arbitrary programs easy: I can think of one other thing we will need to do which does not already have an issue associated with it. Namely, I believe that axi-combined-tests.py will need to be extended a bit to take in an YXI JSON file. (It currently hard-codes the memory sizes/names, I think?) That is, the same YXI file can go into both this testbench and also the wrapper generator.

paths = ["yxi/axi-calyx/axi-generator.py"]
cmd = """
python3 {}
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good for now! In the future, you can imagine this using a set of YXI inputs as the test files, so we see different AXI-wrapper code generated for each one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mentioned this in #1928, which is not very fleshed out currently, but I think(?) points to what you're getting at.

@nathanielnrn nathanielnrn merged commit 897914c into main Feb 28, 2024
7 checks passed
@nathanielnrn nathanielnrn deleted the py-axi-gen-main branch February 28, 2024 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants