Add initial Golang generation support. - #526
Conversation
Signed-off-by: Afonso Oliveira <Afonso.Oliveira@synopsys.com>
|
Mark Ryan (@markdryan) I'll tag you like this since I can't ask for review in any other way. This is still only "All" the RV64 ISA, I'll make compartimentalized on Monday |
Mark Ryan (markdryan)
left a comment
There was a problem hiding this comment.
I've had a quick look. Note my comments are based on the version of inst.go generated by the first commit. It doesn't look like you re-generated inst.go when pushing the second commit, so the comments might not all be relevant.
They are, I did not change much other than filtering yet, thanks! |
…ne set of extensions that GO currently supports. Signed-off-by: Afonso Oliveira <Afonso.Oliveira@synopsys.com>
Signed-off-by: Afonso Oliveira <Afonso.Oliveira@synopsys.com>
…generator.py may be used to generate. Signed-off-by: Afonso Oliveira <Afonso.Oliveira@synopsys.com>
|
I don't have any particular concerns after quickly looking at the code. Is the generated artifact for For Spike, same question. I don't think there's a relationship between Golang and Spike... should this be a separate PR? |
Afonso Oliveira (AFOliveira)
left a comment
There was a problem hiding this comment.
I think my answers did not show because I did not comment here, can you see them Mark Ryan (@markdryan)?
So, for Golang I think we are there or, at least super close (some order may be changed, but that is it). Same for Spike, but I agree, I will remove Spike out of the branch since it just adds confusion, wait for this to be merged and then get Spike on board as well. |
Derek Hower (dhower-qc)
left a comment
There was a problem hiding this comment.
Can you add a tasks.rake in backends/generators/Go with a task that will be displayed with ./do --tasks?
I already did locally actually :) Let me just remove Spike, and solve the commit history and I will change this PR from draft to ready to review. Unfortunately, it seems CSRs information in the UDB is the weak-point ATM, although I think we will change this in a matter of weeks |
Signed-off-by: Afonso Oliveira <Afonso.Oliveira@synopsys.com>
Signed-off-by: Afonso Oliveira <Afonso.Oliveira@synopsys.com>
891783b to
f92f410
Compare
It looks like you are stuck in the middle here. GitHub thinks it needs to check for C# files, which is true in main. But your branch doesn't have any C# files, which is why I think it's failing. Hopefully after you merge with main the error will resolve. |
Signed-off-by: Afonso Oliveira <Afonso.Oliveira@synopsys.com>
Signed-off-by: Afonso Oliveira <Afonso.Oliveira@synopsys.com>
|
I think this is ready to merge - only problems are:
|
Could you post a diff here, so we have a reference?
OK |
Signed-off-by: Afonso Oliveira <Afonso.Oliveira@synopsys.com>
https://www.diffchecker.com/srkhmI0D/
|
…all. Signed-off-by: Afonso Oliveira <Afonso.Oliveira@synopsys.com>
|
Cool. The instructions look pretty good. We have pretty good issue coverage for the CSRs. I notice that the riscv-opcodes version isn't correct for pmpcfgODD; if I understand correctly, this is supposed to be for RV64, and those CSRs don't exist in RV64. I'd vote to approve this PR since the generation looks great. We can work on the missing data. |
Nice, let me just add this to the regression test then, just to ensure it is not broken along the way |
Signed-off-by: Afonso Oliveira <Afonso.Oliveira@synopsys.com>
Signed-off-by: Afonso Oliveira <Afonso.Oliveira@synopsys.com>
| runs-on: ubuntu-latest | ||
| env: | ||
| SINGULARITY: 1 | ||
| steps: | ||
| - name: Clone Github Repo Action | ||
| uses: actions/checkout@v4 | ||
| - name: Setup apptainer | ||
| uses: eWaterCycle/setup-apptainer@v2.0.0 | ||
| - name: Get container from cache | ||
| id: cache-sif | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: .singularity/image.sif | ||
| key: ${{ hashFiles('container.def', 'bin/.container-tag') }} | ||
| - name: Get gems and node files from cache | ||
| id: cache-bundle-npm | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| .home/.gems | ||
| node_modules | ||
| key: ${{ hashFiles('Gemfile.lock') }}-${{ hashFiles('package-lock.json') }} | ||
| - if: ${{ steps.cache-sif.outputs.cache-hit != 'true' }} | ||
| name: Build container | ||
| run: ./bin/build_container | ||
| - name: Generate Go code | ||
| run: ./do gen:go |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions
|
Is there any dependency for this PR Derek Hower (@dhower-qc)? Or can we merge this and then I'll start the rest of riscv-opcodes outputs? |
Derek Hower (dhower-qc)
left a comment
There was a problem hiding this comment.
Looks good to me. We might want to eventually elevate the python interface into the db data to lib, but let's do that later
* Add initial Golang generation support. Signed-off-by: Afonso Oliveira <Afonso.Oliveira@synopsys.com> * Enhance go generator to allow filtering by extensions * Enhance Go CSR generation by filtering out unused extensions and define set of extensions that GO currently supports. Signed-off-by: Afonso Oliveira <Afonso.Oliveira@synopsys.com> * update checked out version of inst.go changed by latest commits. Signed-off-by: Afonso Oliveira <Afonso.Oliveira@synopsys.com> * Refactor to ensure reusable code, given the extensibility of outputs generator.py may be used to generate. Signed-off-by: Afonso Oliveira <Afonso.Oliveira@synopsys.com> * Fix Go awkward struct spacing. Signed-off-by: Afonso Oliveira <Afonso.Oliveira@synopsys.com> * Add rake task to generate Golang input - inst.go Signed-off-by: Afonso Oliveira <Afonso.Oliveira@synopsys.com> * Add CSR ordering to match riscv-opcodes. Signed-off-by: Afonso Oliveira <Afonso.Oliveira@synopsys.com> * Remove checked out inst.go Signed-off-by: Afonso Oliveira <Afonso.Oliveira@synopsys.com> * Update all spacing to exactly match riscv-opcodes. Signed-off-by: Afonso Oliveira <Afonso.Oliveira@synopsys.com> * Change check_requirement due to being out of scope for go_generator call. Signed-off-by: Afonso Oliveira <Afonso.Oliveira@synopsys.com> * Add gen:go to CI regression. Signed-off-by: Afonso Oliveira <Afonso.Oliveira@synopsys.com> * Add gen:go to local regression test. Signed-off-by: Afonso Oliveira <Afonso.Oliveira@synopsys.com> --------- Signed-off-by: Afonso Oliveira <Afonso.Oliveira@synopsys.com> Co-authored-by: Your Name <your.email@example.com>
This PR aims to generate inst.go - currently checked out for reviewing purposes. It doesn't yet allow for subsets of the ISA, but serves as an example that it is much easier to generate the outputs than the riscv-opcodes.
Also, I think I found some CSRs that we are missing, I'll open a issue on that.