Well it all deppends on the speed/precision of conversion.
Obviously the ladder comparator is the best way...
But supose you just want to know battery level or some
other low profile value.
The easyest way is to use a capacitor on the cpld input
and a resistor in series to the voltage source.
You keep the capacitor grounded by setting pin to output and gnd
Then you reset a counter, set pin to input and start counting
until input reaches high level. then you read the count
and you can use some formula to get value=a*count+b
with known cap and resistor, you may get curve.
the highest the input voltage is from digital high level
more linear it will be.
You may also place a resistor to vcc but then you will have 2 curves
but sometimes needed to check for no connected value
This is the method used by pic microcontrolers
hope this helps also
Pads