Electronic – Constructing an Encoder

digital-logicencoder

I understand an Encoder is 2^n input lines and n output lines`.

I want to construct an Encoder from scratch so I can understand how it works, so that I can construct any other Encoder in the future.

I believe that the Input lines are an address to the output lines. So for a 4 by 2 encoder we would first construct a truth table. My biggest problem is I can't construct the output part of the truth table for an encoder. I don't know how to get the output, if I knew the logic I could build it.

Encoder Truth table with what I think the output is.
http://www.flickr.com/photos/76226081@N08/8931456484/

Every time the input lines are x x 0 0 I put a 1 for O0.
Every time the input lines are x x 0 1 I put a 1 for O1

Best Answer

The solution is found by searching for "encoder" on Wikipedia:

enter image description here

Key point, the only valid inputs are when exactly one of the inputs is high. That means there are lots of don't cares in the output columns of the truth table.