Automated synthesis of compact crossbars for sneak-path based in-memory computing