An Efficient Approach to On-Chip Logic Minimization