Zorro wrote on Sep 3rd, 2016, 1:15am:If "in" is above 3V or below 2V then the digital signal "in_dig" should remain low.
Is this what you meant, or should the output be high when "in" is above 3V? It looks to me that your original post indicated the latter:
Code: always @(above(V(in, vss)-thr_high)) begin
in_dig = 1;
end
I don't understand what "in_dig" is supposed to be; you call it a digital signal and show values of 0 or 1, but then you talk about an analog to digital conversion, as though maybe it's not just a single bit.
I'm not sure you need the @above event; why not just have
Code: if (V(in,vss) > thr_high) begin
in_dig = 1;
end else if (V(in,vss) < thr_low) begin
in_dig = 0;
end else begin
// not sure if this is what you meant by "discretized" or "converted"
in_dig = (V(in,vss) - thr_low)/(thr_high-thr_low);
end