ratio-to-digital converter