Theory, synthesis and implementation of current-mode CMOS piecewise-linear circuits using margin propagation