Cost-Driven Design of Smart Microsystems