Code for RRAM Compact Model