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

eDSL: reserved names, nonexistent ports #2017

Open
anshumanmohan opened this issue Apr 23, 2024 · 2 comments
Open

eDSL: reserved names, nonexistent ports #2017

anshumanmohan opened this issue Apr 23, 2024 · 2 comments
Labels
C: calyx-py Items that have to do with the builder library Status: Available Can be worked upon

Comments

@anshumanmohan
Copy link
Contributor

anshumanmohan commented Apr 23, 2024

Right now the eDSL lets you generate pretty free-wheeling Calyx, even if that Calyx is clearly wrong. I wonder how people feel about making the eDSL a little cleverer.

Below I refer to mwe.py; it generates mwe.yx.

Reserved Names

As we know, Calyx adds go and done ports to components so that they may be used as cells in multi-component designs. However, the eDSL happily lets you add ports with those very names.

def insert_dummy_component(prog):
comp = prog.component("dummy")
comp.input("go", 1)
comp.output("done", 1)

I don't know what Calyx would make of this; hopefully it would catch it and stop you from proceeding. However, I kinda think that the eDSL could just weed out some of this stuff if we teach it some rules.

Nonexistent Ports

The eDSL lets you assign to ports that don't exist.

comp.this().flamingo = cb.HI

I regret to share that I don't actually have a port called flamingo on that component. Similarly, the eDSL lets you define a std_add called adder and then read/write to a port called adder.penguin. I think, when someone uses the {thing}.{port_name} notation to read from or write to a port, the eDSL could just check if thing actually has a port by that name. Another example of a thing that Calyx probably catches later on, but the eDSL is totally equipped to catch early on.

@rachitnigam
Copy link
Contributor

Sounds like a good idea to me! Also, do you mind adding relevant labels to the issue ("calyx-py", "need triage / available")

@anshumanmohan anshumanmohan added Status: Needs Triage Issue needs some thinking C: calyx-py Items that have to do with the builder library labels Apr 23, 2024
@anshumanmohan
Copy link
Contributor Author

Whoops mis-click...

@anshumanmohan anshumanmohan reopened this Apr 24, 2024
@anshumanmohan anshumanmohan added Status: Available Can be worked upon and removed Status: Needs Triage Issue needs some thinking labels Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: calyx-py Items that have to do with the builder library Status: Available Can be worked upon
Projects
None yet
Development

No branches or pull requests

2 participants