Modeling NAND Flash memories for circuit simulations