-
Notifications
You must be signed in to change notification settings - Fork 14
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
Add def_one_caller_wrapper #536
base: master
Are you sure you want to change the base?
Add def_one_caller_wrapper #536
Conversation
Do we need this anywhere now? Isn't a function returning a module something weird? |
I have the plan to port switching networks from #395 and it is needed there. |
@@ -250,3 +251,37 @@ def elaborate(self, platform): | |||
m.submodules[f"ManyToOneConnectTrans_input_{i}"] = ConnectTrans(self.m_put_result, self.get_results[i]) | |||
|
|||
return m | |||
|
|||
|
|||
def def_one_caller_wrapper(method_to_wrap: Method, wrapper: Method) -> TModule: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why isn't this an Elaboratable
(or, alternatively, why does this not have a module argument)? It's kinda weird in Amaranth to return a module from a function.
raise ValueError("def_one_caller_wrapper support only wrapping of methods which don't return data.") | ||
|
||
m = TModule() | ||
buffer = FIFO(method_to_wrap.data_in.layout, 2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the connector should be parametrized?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No test.
@@ -8,6 +8,7 @@ | |||
"Connect", | |||
"ConnectTrans", | |||
"ManyToOneConnectTrans", | |||
"def_one_caller_wrapper", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename one
to single
, to be consistent with Transactron core.
This PR ports from #395 a
def_one_caller_wrapper
. Function which is a syntax sugar for introducing a Fifo which collect all incoming data and pass them to the one_caller method.Examples of usage:
coreblocks/coreblocks/fu/vector_unit/v_executor.py
Line 109 in ddb21b5
coreblocks/coreblocks/transactions/lib.py
Line 1444 in ddb21b5