Reliability Modeling and Mitigation for Embedded Memories