Logic and arithmetic computation-in-memory accelerators