gray2bin.comp
1 component gray2bin "convert a gray-code input to binary"; 2 description """Converts a gray-coded number into the corresponding binary value"""; 3 pin in unsigned in "gray code in"; 4 pin out unsigned out "binary code out"; 5 license "GPL"; 6 author "andy pugh"; 7 function _ nofp; 8 ;; 9 unsigned int mask; 10 out = in; 11 for(mask = in >> 1 ; mask != 0 ; mask = mask >> 1){ 12 out ^= mask; 13 }