BCD to binary decoder?[SOLVED]
You are familiar with Double Dabble (shift-add-three):



The nice thing about this algorithm is that it is 100% reversible. You can use the same algorithm to convert from BCD to binary by reversing the operations.

The typical steps are:


Check each group of digits:


If >= 5, then Add 3
Else stay the same

Left shift the input into the digits


To reverse these operations, you perform them in the reverse order


Right shift the digits into the output
Check each group of digits:


If >= 8, then Minus 3
Else stay the same



So the example becomes: