Hey,
I have the following verilog-A coded component that defines a simple nonlinear function:
// VerilogA for memr, memr_f, veriloga
`include "constants.vams"
`include "disciplines.vams"
module memr_f(vp,vn,vout,vref);
electrical vp,vn,vout,vref;
parameter real vth=1,vo=1,Io=1e-9;
real vd,id;
analog begin
vd = V(vp) - V(vn);
if (vd>vth) begin
id = Io*(exp(vd/vo)-exp(vth/vo));
end else if (vd<-vth) begin
id = -Io*(exp(-vd/vo)-exp(vth/vo));
end else begin
id=0;
end
I(vout,vref) <+ -id;
end
endmodule
I want to make this as a sub-circuit in Orcad. So, I wrote the below code and saved it as .lib and created a new library with a new part with ports vp, vn, vout and vref.
.SUBCKT memr_f vp vn vout vref
.func vd() {v(vp)-v(vn)}
.func id() {IF(vd >= 1.0, 1e-5*(exp(vd/0.1)-exp(vd/0.1)), IF(vd <=- 1.0, -1e-5*(exp(-vd/0.1)-exp(1.0/0.1)), 0))}
Is vout vref {id()}
.ENDS
When running this, I get an error 'File does not exist' and when I click ok, I get 'Ocad contains an invalid path'. I want to know if there are any errors in the netlist I wrote which is equivalent to the above verilog-A code. Can you help me in this