Analysis and simulation of the multiple resistive switching modes occurring in HfO x -based resistive random access memories using memdiodes