-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ready for review. Solves #2460. Depends on #2469. Prior bug fixed (due to an error in the `bus.asm` code update when unwrapping the new `BusInteraction` enum type.
- Loading branch information
Showing
13 changed files
with
103 additions
and
91 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,21 @@ | ||
use std::protocols::bus::bus_receive; | ||
use std::protocols::bus::bus_multi_receive; | ||
use std::protocols::bus::BusInteraction; | ||
use std::array; | ||
|
||
/// Given an ID, selector, and tuple, receives (ID, ...tuple) tuple from the bus | ||
/// with multiplicity 1 if the selector is 1. | ||
let permutation_receive: expr, expr, expr[] -> () = constr |id, selector, tuple| { | ||
bus_receive(id, tuple, selector, selector); | ||
bus_receive(BusInteraction::Receive(id, tuple, selector, selector)); | ||
}; | ||
|
||
/// Batched version of `permutation_receive` that uses the more column-saving `bus_multi_receive`. | ||
/// Ideally, should use `bus_multi_receive` to batch both lookup and permutation receives. | ||
/// Note that we cannot input BusInteraction::Receive, which is defined differently. | ||
let permutation_multi_receive: (expr, expr, expr[])[] -> () = constr |inputs| { | ||
let inputs_inner: (expr, expr[], expr, expr)[] = array::fold(inputs, [], |acc, input| { | ||
let inputs_inner = array::fold(inputs, [], |acc, input| { | ||
let (id, selector, tuple) = input; | ||
acc + [(id, tuple, selector, selector)] | ||
acc + [BusInteraction::Receive(id, tuple, selector, selector)] | ||
}); | ||
bus_multi_receive(inputs_inner); | ||
}; |
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.