my guess attempt of successive approximation a/d conversion. this version bit slow for now.. may work out a faster/efficient way to implement this
this version: starts with all bits low, cycles through 7 bits from msb to lsb, toggles bit on and compares analogue output to target input, toggles bit back off if greater than target, repeats for next bit. Results will be lower (or equal) to input
you can slow down the sim speed to visually see how the circuit is getting a 'feel' for the analogue input and adjusting itself as it decrements its values along, that's what the scope and the right 7 segment display is showing. fun to watch me thinks :)