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

Allow invoke to use with statements to specify combinational connections #633

Closed
rachitnigam opened this issue Aug 27, 2021 · 2 comments · Fixed by #712
Closed

Allow invoke to use with statements to specify combinational connections #633

rachitnigam opened this issue Aug 27, 2021 · 2 comments · Fixed by #712
Labels
C: Calyx Extension or change to the Calyx IL S: Available Can be worked upon

Comments

@rachitnigam
Copy link
Contributor

One pattern that showed up while writing #632 is that while invoking a Calyx component, it would be useful to also have some other combinational connections active. For example, if you have two memories a_mem and b_mem and want to pass a value at index idx to an invoked component, your two choices are:

  1. Save the value a_mem[idx] in a register and pass the value of the register, or
  2. Don't use the invoke statement at all.

A cleaner solution is to allow invoke statements to enable a combinational group that activates some assignments when the invoke group is running:

comb group mem_idx {
  a_mem.addr0 = idx.out;
  b_mem.addr0 = idx.out;
}

control {
  invoke mac(a = a_mem.read_data, b = b_mem.read_data) with mem_idx;
}

The compilation for such groups would be straightforward--inline all assignments in the comb group into the group generated to implement the invoke. Additionally, since this is specifying things using with, only combinational groups. I'm not sure if normal groups should be allowed anywhere where with is used.

@rachitnigam rachitnigam added C: Calyx Extension or change to the Calyx IL S: Discussion needed Issues blocked on discussion labels Aug 27, 2021
@sampsyo
Copy link
Contributor

sampsyo commented Aug 27, 2021

Ah, this seems like a clear win! In retrospect, it seems like the natural way to pass "arguments" to "functions" using invoke. Good point!

@rachitnigam rachitnigam added S: Available Can be worked upon S: Blocked Issue is blocked and removed S: Discussion needed Issues blocked on discussion S: Available Can be worked upon S: Blocked Issue is blocked labels Aug 31, 2021
@rachitnigam
Copy link
Contributor Author

Requires #635 to be merged first.

@rachitnigam rachitnigam added S: Available Can be worked upon and removed S: Blocked Issue is blocked labels Sep 10, 2021
@rachitnigam rachitnigam linked a pull request Oct 6, 2021 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: Calyx Extension or change to the Calyx IL S: Available Can be worked upon
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants