Your question is Python Lists, Gates, and Interrupts. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Arm firmware often manipulates compact signal arrays and selects logic paths through multiplexers. Implement a simulator that applies requested swaps to an integer list and evaluates Boolean gates using only a 2:1 MUX abstraction.
Write process_signals(values, swaps, gates).
values is a list of integers.[i, j, method], where method is either "temp" or "xor". Swap values[i] and values[j] in place. The "temp" method must use a temporary variable. The "xor" method must swap using XOR without a third variable. Assume i != j.[name, a, b], where name is "NOT", "AND", "OR", or "XOR", and a and b are Boolean integers, either 0 or 1. For NOT, ignore b.mux(select, input0, input1), which returns input0 when select == 0 and input1 when select == 1."values" and gate results, in input order, under "gates".def process_signals(values, swaps, gates):