For |x-y| < z
Let's take x/y/z as 8 bits signed number as example:
wire [8:0] sub_xy; //signed nnumber
wire [8:0] abs_xy; //unsigned number
wire [9:0] sub_abs_z; //signed number
wire res; //1'b0: |x-y| < z is false; 1'b1: true
assign sub_xy = {x[7], x[7:0]} + ~{y[7], y[7:0]} + 1'b1; //do x-y
assign abs_xy = (sub_xy[8])? (~{sub_xy[8:0} + 1'b1) : sub_xy[8:0];
assign sub_abs_z = {1'b0, abs_xy} + ~{z[7], z[7], z[7:0]} + 1'b1;
assign res = sub_abs_z[9];
Added after 42 seconds:
For:f(x,z) = -x ; z <-x
x ; z > x
x ; otherwise
It's may simplified to: if(z < -x)
res = -x;
else res = x;
Then simplified to: if(z + x < 0)
res = -x;
else res = x;
Let's also take x/z as 8 bits signd number as example:
wire [8:0] x_bar; //signed number
wire [8:0] add_zx; //signed number
wire [8:0] res; //singed number
assign x_bar = (x[7])? (~{x[7], x[7:0]} + 1'b1) : {1'b0, x[7:0]};
assign add_zx = {1'b0, z[7:0]} + {1'b0, x[7:0]};
assign res = (add_zx[8])? x_bar : {x[7], x[7:0]};