Analysis and design of high density RRAM arrays