-
Notifications
You must be signed in to change notification settings - Fork 49
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
Unable to use concat with InPort #279
Comments
How does this relate to your recent pull request? I am not so sure about this general trend ... I think in general
But in retrospect I think it is just not worth it. I kind of think we should deprecate lambda's with |
I want to achieve something like the following:
I have tried to use
I would say doing |
I think there are many different questions/issues here. First, is does
I am actually not sure ... Second, is should we support list comprehensions inside a concat. I think these are orthogonal issues because I don't think this works either?
Third, what does it mean to concat interfaces? I am not sure that is reasonable ... interfaces can and do include ports going in different directions so you cannot concatenate them ... |
This works (with my pull request):
This does not:
I think concat on an interface does not make sense since it is difficult to tell how concat aligns the interface. However, I think contacting signals within the interface makes sense, as it is common to pick out specific signals within the interface to do specific operations. |
Lambda with |
Is the limitation caused by an older version of Python or something else? |
It is really just a constraint of the underlying framework ...
|
However with
It is still not working at the moment and yielding the following error:
I like the |
Will the recent Typing system help with the problem? Pymtl will perform type-checking to force things to be evaluated based on the given type. |
no ... the problem is you would have to create an update block on the fly to do the concat operation ... it would be very hard to do ... |
If I understand correctly, the on-the-fly update block creation might be difficult to support in a pure Python simulation environment. If that's the problem, is there a way for me to bypass this constraint and go for a verilator-based simulation or any other way such I can describe what I would like to write rather than something like the following?
|
Actually it is not really even the pure-Python simulation part ... the RTL translation pass does not parse Maybe you can create your own custom connect function? That is definitely doable and very much in the spirit of what you are trying to do here ... you can use a function to encapsulate this connection operation.
maybe something like that? Not sure if that will work though ... |
I will also need to add something to search for specific signals within the interface I want to connect. So I will need something like:
and this will translate to:
which works. |
The power of python! |
It works, but I dislike how it needs to be done this way... At least I can keep working on what is important... |
we are open to pull requests! if you can figure out some kind of slick way to make this cleaner please do let us know ... it just does not seem like a simple feature request. glad you are finding PyMTL3 useful! |
I think what needs to be done is to update the concat function (or all helper functions) to operate based on signals. Then, we update the lambda update block creation logic to copy the whole body of the called functions, making the on-the-fly creation of any update block possible. Something like:
should also be possible if what I am thinking works. Other constraints will also probably be necessary, like confirming that the return value is a signal, avoiding recursive function calls, and finding ways to handle external functions. I will need to learn how to play with the AST to extract the right information and probably a lot of small details that I am not sure about. This is probably about a week of work... I will leave this here for future me or someone who is interested in dealing with this... |
By the way, I noticed that some of the AST features pymtl uses will be removed in python3.14, like |
The following example,
is giving me
Is there any way I can work around this?
The text was updated successfully, but these errors were encountered: