/*RESISTOR MODEL The Designer's Guide (www.designers-guide.org). //*/ `include "disciplines.vams" `include "constants.vams" //crucial file need for electrcial call module res1(p, n); // positive and negative connections on res inout p; inout n; electrical p, n; parameter real r=1; //defining variable parameter for future operation; r cannot be 0 branch (p,n) resistor; //used with 3rd form of res analog begin //just like verilog begin signals start of functions I(p,n) <+ V(p,n)/r; //defining current through res (conductance form, large r) (r>1) end endmodule module res2(p, n); // positive and negative connections on res inout p; inout n; electrical p, n; parameter real r=1; //defining variable parameter for future operation; r cannot be 0 analog begin //just like verilog begin signals start of functions V(p,n) <+ I(p,n)*r; //defining voltage of res (resistance form, small r) (r<1) end endmodule module res3(p, n); // positive and negative connections on res inout p; inout n; electrical p, n; parameter real r=1; //defining variable parameter for future operation; r cannot be 0 branch (p,n) resistor; //used with 3rd form of res analog begin //just like verilog begin signals start of functions if(r>1e12*resistor.flow.abstol) //third version for both r>1 and r<1 I(resistor) <+ V(resistor)/r; else V(resistor) <+ r*I(resistor); end endmodule