A generic compact model for resistive memories and switches | Synapse