Decoder
Function: sets exactly one of n outputs to 1, based on unsigned binary value
Input: ceil (lg n)
Output: n bits (exactly one is 1, rest are 0)
Example: 3-8 decoder
Inputs: 3 bits representing UB number
Output: 1 bit corresponding to the value of the UB number is set to 1
Black box:    
   
z0
x0
   
z1
   
z2
x1
   
z3
   
z4
x2
   
z5
   
z6
   
z7
   
Truth table:
x2 x1 x0 z7 z6 z5 z4 z3 z2 z1 z0
0 0 0 0 0 0 0 0 0 0 1
0 0 1 0 0 0 0 0 0 1 0
0 1 0 0 0 0 0 0 1 0 0
0 1 1 0 0 0 0 1 0 0 0
1 0 0 0 0 0 1 0 0 0 0
1 0 1 0 0 1 0 0 0 0 0
1 1 0 0 1 0 0 0 0 0 0
1 1 1 1 0 0 0 0 0 0 0
Boolean expressions for each output:
z0 = \x2\x1\x0 z4 = x2\x1\x0
z1 = \x2\x1x0 z5 = x2\x1x0
z2 = \x2x1\x0 z6 = x2x1\x0
z3 = \x2x1x0 z7 = x2x1x0