| Encoder | ||||||||||||||
| Encoder is reverse of decoder | ||||||||||||||
| 8-3 encoder | ||||||||||||||
| 8 inputs, exactly one has value 1 | ||||||||||||||
| 3 output bits, representing which input was equal to 1 (binary representation of input) | ||||||||||||||
| Example: | input: | x5 = 1 | output: | z2z1z0 = 101 | ||||||||||
| Simplified truth table: | ||||||||||||||
| Input == 1 | z2 | z1 | z0 | |||||||||||
| x0 | 0 | 0 | 0 | Minterms are rather large | ||||||||||
| x1 | 0 | 0 | 1 | (from full truth table): | ||||||||||
| x2 | 0 | 1 | 0 | z2 = \x0\x1\x2\x3x4\x5\x6\x7 + | ||||||||||
| x3 | 0 | 1 | 1 | \x0\x1\x2\x3\x4x5\x6\x7 + | ||||||||||
| x4 | 1 | 0 | 0 | \x0\x1\x2\x3\x4\x5x6\x7 + | ||||||||||
| x5 | 1 | 0 | 1 | \x0\x1\x2\x3\x4\x5\x6x7 | ||||||||||
| x6 | 1 | 1 | 0 | |||||||||||
| x7 | 1 | 1 | 1 | |||||||||||
| However, we can take advantage of the fact that exactly one input is 1: | ||||||||||||||
| z2 = x4 + x5 + x6 + x7 | Example: | x5 = 1 | ||||||||||||
| z1 = x2 + x3 + x6 + x7 | z2z1z0 = 101 | |||||||||||||
| z0 = x1 + x3 + x5 + x7 | (UB for 5) | |||||||||||||