-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Queues: remove duplicate components (#2306)
Here's a snippet from [`complex_tree_test.py`](https://github.com/calyxir/calyx/blob/49fbc2a2e5a962b33380a6d7f2c339b841e7bd2f/frontends/queues/tests/complex_tree_test.py) ```python def build(): """Top-level function to build the program.""" num_cmds = int(sys.argv[1]) keepgoing = "--keepgoing" in sys.argv prog = cb.Builder() fifo_A = fifo.insert_fifo(prog, "fifo_A") fifo_B = fifo.insert_fifo(prog, "fifo_B") fifo_C = fifo.insert_fifo(prog, "fifo_C") fifo_D = fifo.insert_fifo(prog, "fifo_D") fifo_E = fifo.insert_fifo(prog, "fifo_E") fifo_F = fifo.insert_fifo(prog, "fifo_F") fifo_G = fifo.insert_fifo(prog, "fifo_G") fifo_H = fifo.insert_fifo(prog, "fifo_H") pifo_strict1 = strict_or_rr.insert_queue( prog, "pifo_strict1", [fifo_A, fifo_B, fifo_C], [0, 44, 88, 133], 3, [0, 1, 2], False, ) ... ``` In particular, notice our eight calls to `insert_fifo`; this puts eight identical fifo components into our `.futil` file: ``` import "primitives/core.futil"; import "primitives/memories/seq.futil"; import "primitives/binary_operators.futil"; component fifo_A(cmd: 1, value: 32) -> () { ... } component fifo_B(cmd: 1, value: 32) -> () { ... } component fifo_C(cmd: 1, value: 32) -> () { ... } component fifo_D(cmd: 1, value: 32) -> () { ... } ... ``` At first, this sounds like the right idea since our PIFO tree has eight FIFOs at the leaves. However, remember merely declaring non-main components in Calyx doesn't insert anything into hardware! Instead, these act more like blueprints. To put them into hardware, we use these blueprints by instantiating cells of these components. This means we should have one FIFO blueprint (component) and build eight different cells from it: these eights cells would be completely separate, with no shared state, as desired. This PR makes this change across `complex_tree_test`, `strict_or_rr` related tests, `pifo_tree_test`, and `sdn_test`. All credit to @ayakayorihiro for noticing this issue!
- Loading branch information
1 parent
49fbc2a
commit 074df16
Showing
6 changed files
with
21 additions
and
27 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