celebrevida
Member level 2
Hello:
I am trying to create a voltage controlled resistor in Verilog-A with the following behavior:
if V(res) <= 0.3 resistance = 5k;
if V(res) >0.3 && V(res) < 0.5 resistance = 2k;
if V(res) >= 0.5 resistance = 10k;
I haven't been able to get this to work.
I can't get the second part to work at all.
For the first and third part, I can't get it to transition from sharply and very close to the thresholds.
Here is my code:
I am aware that it is possible to use SPICE E-elements to do this but I really need to get this working under Verilog-A.
Thanks for any help in getting this to work using Verilog-A!
I am trying to create a voltage controlled resistor in Verilog-A with the following behavior:
if V(res) <= 0.3 resistance = 5k;
if V(res) >0.3 && V(res) < 0.5 resistance = 2k;
if V(res) >= 0.5 resistance = 10k;
I haven't been able to get this to work.
I can't get the second part to work at all.
For the first and third part, I can't get it to transition from sharply and very close to the thresholds.
Here is my code:
Code:
module vcr_model (p, n);
inout p,n;
electrical p, n;
analog begin
if (V(p,n) <= 0.300 ) res=5k;
if ((V(p,n) > 0.3) && (V(p,n) < 0.5)) res=2k;
if (V(p,n) >= 0.5) res=10k;
end
analog begin
V(p,n) <+ I(p,n)*res;
end
endmodule
I am aware that it is possible to use SPICE E-elements to do this but I really need to get this working under Verilog-A.
Thanks for any help in getting this to work using Verilog-A!
Last edited by a moderator: