Hi,
I have a small Veriolog-A code and I need to implement it as a subcircuit in PSpice.
Verilog-A code:
// 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
The netlist I wrote in PSpice:
.SUBCKT memr_f vp vn vout vref params:vth=1.0, vo=0.1, Io=1e-5
.func vd() {v(vp)-v(vn)}
.func id() {IF(vd >= vth, Io*(exp(vd/vo)-exp(vth/vo)), IF(vd <=- vth, -Io*(exp(-vd/vo)-exp(vth/vo)), 0))}
.func I(vout,vref) {id()}
.ENDS
But I couldn't proceed with the option 'Associate PSpice model'- it shows me an error-'Select a matching model in the grid to proceed'.
How to rectify it ?
I have a small Veriolog-A code and I need to implement it as a subcircuit in PSpice.
Verilog-A code:
// 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
The netlist I wrote in PSpice:
.SUBCKT memr_f vp vn vout vref params:vth=1.0, vo=0.1, Io=1e-5
.func vd() {v(vp)-v(vn)}
.func id() {IF(vd >= vth, Io*(exp(vd/vo)-exp(vth/vo)), IF(vd <=- vth, -Io*(exp(-vd/vo)-exp(vth/vo)), 0))}
.func I(vout,vref) {id()}
.ENDS
But I couldn't proceed with the option 'Associate PSpice model'- it shows me an error-'Select a matching model in the grid to proceed'.
How to rectify it ?