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

Generator instance that depends on other cores #682

Open
ivanvig opened this issue Mar 20, 2024 · 6 comments
Open

Generator instance that depends on other cores #682

ivanvig opened this issue Mar 20, 2024 · 6 comments

Comments

@ivanvig
Copy link

ivanvig commented Mar 20, 2024

Im using systemrdl to implement my cores CSRs, with a generator that consumes a rdl file and compiles it to systemverilog files and thats working fine.

Now lets say I have 3 cores: A, B and C. The C core rdl file includes A and B rdl files, in order to be able to compile the C core rdl file I need to provide the compiler the paths where it should search for the included files.

My first thought was using the generator's files_root and core_file fields to be able to find the core from which the generator is called and then use some internal fusesoc function to resolve all dependencies from the core and get all the files required. But in order to do that I need to create a new fusesoc instance with a config that I cant know from the generator scope.

So, is there a way to solve this problem where the generator instance requires files from other cores in order to produce source code?

@olofk
Copy link
Owner

olofk commented Mar 27, 2024

Generators can't use information from other cores. For tasks that affect several cores I would recommend doing this as an Edalize frontend instead. Perhaps look at the sv2v tool class which receives SV files and produces Verilog files, but in your case it would consume rdl files and create SV files instead.

@ivanvig
Copy link
Author

ivanvig commented Mar 28, 2024

Great! I will look into it. Once I have it, are you interested in a pull request with that feature in the edalize repo? Otherwise I think I can use it as an external plugin.

@olofk
Copy link
Owner

olofk commented Mar 28, 2024

That would be great. I'm likely to need something like that myself when I start some new project. But as you have noted, there is nothing preventing you from keeping it in an external plugin if you so wish. Btw, is this using @amykyta3's excellent PeakRDL tooling?

I also remembered that I did something similar to this but with IP-XACT not too long ago. Let me see if I can dig up an example of that for reference.

@jamesrbailey
Copy link

jamesrbailey commented May 1, 2024

I started writing a edalize plugin for PeakRDL today.

Any suggestion on whether there should be 1) a separate edalize tool for every peakrdl backend, or 2) a single edalize tool where the user defines the backend via a tool option?

@amykyta3
Copy link

amykyta3 commented May 5, 2024

I would probably lean more towards option 2.

The main PeakRDL command-line interface is definitely the more "productized" and user-oriented workflow. As I develop the PeakRDL tools, I will be pushing users more towards that interface as the primary and preferred way to interact with the various PeakRDL sub-tools. This will inevitably be more familiar to users as well. This also has the benefit of implementing the user/org configuration mechanism described here: https://peakrdl.readthedocs.io/en/latest/configuring.html

Sub-tools will still always have their own documented and stable API for power-users.

@amykyta3
Copy link

amykyta3 commented May 5, 2024

Now lets say I have 3 cores: A, B and C. The C core rdl file includes A and B rdl files, in order to be able to compile the C core rdl file I need to provide the compiler the paths where it should search for the included files.

I would recommend treating RDL as distinct target filesets in the fusesoc file manifests. I usually discourage users from using `include directives in the source RDL, and instead use multi-file compilation. But even so, it probably makes sense to provide a mechanism for users to specify include search paths for the RDL preprocessor too.

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

No branches or pull requests

4 participants