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

OpenFASOC should expose the main generator flow as an importable python modules #38

Open
proppy opened this issue Mar 8, 2022 · 13 comments
Labels
enhancement New feature or request

Comments

@proppy
Copy link
Collaborator

proppy commented Mar 8, 2022

In order to be able to orchestrate generation from other python codebase (or jupyter notebooks) it would be nice if OpenFASOC exposed a python interface over the main generators flows that can be imported, https://github.com/idea-fasoc/OpenFASOC/blob/main/generators/temp-sense-gen/tools/temp-sense-gen.py

Note: https://github.com/idea-fasoc/OpenFASOC/blob/main/generators/temp-sense-gen/tools/TEMP_netlist.py seems to already exposes functions some lower level function that could be imported, but it seems that there is a fair amount of work also done from the outer scripts.

@msaligane
Copy link
Member

Thanks @proppy
This is really great!
So let's say if a generator is updated, what would be the procedure to re-package it as a python module? is there an automated way?

@proppy
Copy link
Collaborator Author

proppy commented Mar 8, 2022

for conda packages that could happen as part of hdl/conda-eda#192 (the project has a continuous integration environment that rebuild package from HEAD every night) or thru dedicated https://github.com/features/actions in this repo if we wanted to publish those package on PyPI too.

@msaligane
Copy link
Member

@erictaur has been working on github actions and somehow got it to work. @erictaur any updates?

@mithro
Copy link

mithro commented Mar 9, 2022

@mithro
Copy link

mithro commented Mar 9, 2022

I believe these are deployed on https://github.com/chipsalliance/fasm/actions

@joamatab
Copy link
Contributor

See PR #43 for this

I can also add some jupyter notebooks for the documentation

@msaligane
Copy link
Member

That would be great! let's schedule some time early this week. Thanks Joaquin!

@saicharan0112
Copy link
Collaborator

@proppy suggested a good idea to expose each stage inside the generator as a python module which can end up something like this
Eg:

from openfasoc import tempsense
netlist=tempsense.gen_netlist()
tempsense.run_synthesis(netllist...)

Next steps could be interesting after we have something. @proppy do you want to add something to this?

@msaligane
Copy link
Member

Sounds great to me!

@saicharan0112
Copy link
Collaborator

Here is the idea:

  1. Convert the three verilog netlists (TEMP_ANALOG_hv.v, TEMP_ANALOG_lv.v and counter_generic.v present in folder ) into python modules to generate TEMP_ANALOG_hv_nl.v, TEMP_ANALOG_lv_nl.v and counter.v files.. I could just think of using print statements to build these files because of their size. Any suggestions?

  2. Convert TEMP_netlist.py, which generates the tempsense netlist using the function gen_temp_netlist(), into importable python module.

In the end, I think we would be having something like this from openfasoc import gen_temp_netlist. We could add other netlists in the future. For eg: from openfasoc import gen_ldo_netlist or from openfasoc import gen_pll_netlist.

Just having the netlist, I think we could represent the tempsense flow in notebook.

Looks simple, does simple thing. Do you people think that this is worth?

@proppy
Copy link
Collaborator Author

proppy commented Oct 24, 2022

I could just think of using print statements to build these files because of their size. Any suggestions?

Curious if you're thinking of using an HDL for helping you maintain a structured view of the netlists, see: https://github.com/drom/awesome-hdl for some recommendations (https://github.com/amaranth-lang/amaranth, https://github.com/PyHDI/veriloggen comes to mind or https://github.com/PyHDI/Pyverilog and https://github.com/byuccl/spydrnet as lower leve option).

If you prefer to manipulate raw text, I would recommend to look at the templating language like https://jinja.palletsprojects.com/en/3.1.x/.

@saicharan0112
Copy link
Collaborator

Thanks.. Understood. I am not familiar with those projects who shared here though. I will take a look.

@saicharan0112 saicharan0112 added the enhancement New feature or request label Mar 10, 2023
@saicharan0112 saicharan0112 removed their assignment Dec 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants