A pulse-based memristor programming circuit