Arithmetic Optimization Techniques for Hardware and software Design