Architecture and Circuit Design Optimization for Compute-In-Memory