-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make groups created in
compile_invoke
only drive signals that are a…
…ctually used in an `invoke` (#2216) These changes make it so that only signals used by a component are turned into assignments when said component is `invoke`d. I added some comments trying to point out what changes were made as the naming and keeping track of what is held in which data structure can be a bit confusing. For example, consider this reader component, which manually drives a `manually_driven_ref_reg_out` signal ``` component reader() -> (manually_driven_ref_reg_out : 32) { cells { ref ref_reg = std_reg(32); } wires { //reads from the ref register group read_from_ref_reg { manually_driven_ref_reg_out = ref_reg.out; read_from_ref_reg[done] = ref_reg.done; } } control { read_from_ref_reg; } } ``` If we invoke this component in main and pass in a `concrete_cell`: `invoke reader[ref_reg=concrete_reg]()();` This control statement will now get compiled to a group that only assigns to the ports used in `reader`. So in this case, `concrete_reg.out`. Notably, `concrete_reg`'s `write_en` and `in` signals do not appear here. Before this PR, they would have. ``` group invoke0 { reader.manually_driven_ref_reg_out = concrete_reg.out; reader.go = 1'd1; invoke0[done] = reader.done; } ``` This partially address the issue of [passing in `ref` cells in parallel](https://calyx.zulipchat.com/#narrow/stream/423433-general/topic/parallel.20ref.20passing). In particular, correctly models behavior in verilog in cases where ports driven/accessed by components that are passed in the same concrete cell in parallel are mutually exclusive. (i.e. a write component that only drive a register's `in` and `write_en` ports.) So one could now imagine the following control block valid: ``` control { par { invoke reader[ref_reg = concrete_reg]()(); invoke writer[ref_reg = concrete_reg]()(); } } ``` --- PS: Worth noting that the `reader` component as written above would currently run into issues due to #2198
- Loading branch information
1 parent
0ed827f
commit a4da816
Showing
10 changed files
with
3,779 additions
and
4,013 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.