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

When implementing a Platform, how should I add Python code as part of the build? #597

Closed
RobertBaruch opened this issue Feb 20, 2021 · 4 comments
Labels

Comments

@RobertBaruch
Copy link
Contributor

RobertBaruch commented Feb 20, 2021

It'd be nice if I could just add functions to the platform and pass files through it somehow. Is that not the Done Thing? Should I instead just write standalone Python tools and invoke them? Using TemplatedPlatform?

@whitequark
Copy link
Member

I don't really understand the scenario you're describing. Can you add more detail? In general, build outputs are not expected to include any code other than the code contained in the host Python process that produces the build outputs; adding code to build outputs complicates remote builds.

@anuejn
Copy link
Contributor

anuejn commented Feb 20, 2021

I have a somewhat related issue in #515

@RobertBaruch
Copy link
Contributor Author

One scenario could be, as part of the build process:

  1. Generate the RTLIL from source (done in TemplatedPlatform.toolchain_prepare)
  2. Run yosys on it to generate an optimized or altered RTLIL
  3. Read the RTLIL from Python and modify some cells (say, via pyosys), writing the result to another RTLIL file.
  4. Run the resulting RTLIL through other platform-specific standalone tools

I guess it makes sense that this shouldn't be done, considering the requirement for remote build capability. In my scenario, since I've already got pyosys, I could run steps 2 and 3 all in toolchain_prepare.

@whitequark
Copy link
Member

Yes. Altnernatively, you could implement a build tool that is called in the normal way via $PATH, in which case it's irrelevant what language the tool is written in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants