Resolver-to-digital converter with synchronous demodulation for FPGA based low-latency control loops