Compacted total and sqtotal logic