- Its behavior is similar to:
```py
def multiplexor(S, A, B):
if S == 1:
return A
else:
return B
```
-
Complete the truth table
-
Now let's implement the truth table as a circuit
S | A | B | | C |
0 | 0 | 0 | | |
0 | 0 | 1 | | |
0 | 1 | 0 | | |
0 | 1 | 1 | | |
1 | 0 | 0 | | |
1 | 0 | 1 | | |
1 | 1 | 0 | | |
1 | 1 | 1 | | |
## Decoder
- A **decoder** is another common circuit that has $n$ inputs and $2^n$ outputs
-
Only one output is a 1 at any given time (one for each possible combination of inputs)
-
If the input encodes the number 7, then the output bit for 7 is asserted and all others are zeros
## Decoder Truth Table
- Below is a 3-bit decoder truth table
![Decoder Truth Table](../../assets/images/COD/decoder.png)
# Assignment 3