Rather than two cross statements, trying to catch it as it goes one way or the other, I'd use one cross statement for timestep control:
Code: @(cross((V(inp, inm) - vthres/comp_gain)))
; // null statement
and then have a plain if statement to set out_val and del:
Code: if (V(inp, inm) > vthres/comp_gain) begin
out_val = 1;
del = comp_delay_r;
end else begin
out_val = 0;
del = comp_delay_f;
end
I'd have to read up on what the LRM says happens if you happen to hit the threshold exactly: is this a cross event? in which direction? And then I'd have to wonder if the simulator implemented it correctly.