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

Asymmetry in controlling how inputs/outputs are registered #125

Open
sylefeb opened this issue Apr 17, 2021 · 3 comments
Open

Asymmetry in controlling how inputs/outputs are registered #125

sylefeb opened this issue Apr 17, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@sylefeb
Copy link
Owner

sylefeb commented Apr 17, 2021

Issue

There is currently an asymmetry in the fact that the behavior of outputs are controlled in the algorithm definition (output or output!), while the behavior of the inputs is controlled at instantiation time (<: or <::). This reflects the fact that input flip-flops are indeed in the parent, while output flip-flops are indeed in the instance. However, this is not as convenient as if this could be controlled at instantiation time.

Possible approach

Now that algorithms are truly instanced by Silice, we could implement the following: input would remain as is and outputs would all become output! (see note below on backward compatibility). Adding registers would become solely controlled from binding using <:, <:: for inputs, and :>, ::> (new) for outputs. This would only change, for the outputs, whether the wire connects to the D or Q side ; as is is the case currently using output/output!. But this choice would now be made from the parent.

Open question: When binding groups what is then the meaning of <::>? registers on both input and outputs? We might want to control these separately ... introduce a separator? e.g. <:|:>, <::|:>, etc.?

Open question: Behavior in calls of the form () <- ... <- (), and in 'dot' syntax access of ins/outs?

Ensuring backward compatibility

There would be little choice but to change the keywords input/output for (e.g.) in/out so that we can preserve the previous behavior, not break any code, and provide a deprecation warning. This is also a shorter syntax, fits better with inout, so might not be a big issue.

@sylefeb sylefeb added the enhancement New feature or request label Apr 17, 2021
@rob-ng15
Copy link
Contributor

rob-ng15 commented Apr 17, 2021 via email

@sylefeb
Copy link
Owner Author

sylefeb commented Apr 17, 2021

Thanks! This will be the focus of the next changes I think, and should resolve a couple other open issues in passing (e.g. #49, #126). I'll make sure not to break any existing code.

@sylefeb
Copy link
Owner Author

sylefeb commented Jun 7, 2021

One difficulty with this idea, is how it interacts with interfaces. Right now, an interface can specify how the user should deal with its output wrt. the inputs. For instance here is the user interface for a BRAM:

interface bram_port {
  output! addr,
  output! wenable,
  input   rdata,
  output! wdata,
}

Here it ensures the users output are immediate (not registered) so that the input from BRAM is available next cycle. The user is free to register the input internally, but the interface defines a clear contract on how the BRAM should be used and this gets applied upon binding using <:> (the interface can also freely mix output! and output).

This capability of letting the interface specify the type of binding seems important to preserve...

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

2 participants