Algorithm-hardware co-design for Energy-Efficient A/D conversion in ReRAM-based accelerators