Digital circuit realization of piecewise affine functions with non-uniform resolution: theory and FPGA implementation