Physical and circuit modeling of HfO2 based ferroelectric memories and devices