wang159
Newbie level 2
I write a verilog-A script for a simple resistor. The resistor has several identical segments, the number of which is defined as a parameter. The script is as follows
The circuit script is
This resistor simulation works fine in SPECTRE, but it fails in HSPICE, citing a convergence issue. Any suggestions for making the code converge in HSPICE? Am I doing anything that is undesired in Verilog-A?
Thanks for the help!
Code:
`include "disciplines.vams"
module Rloop(n,p);
parameter integer total= 9 from [1:100];
electrical p,n;
electrical [0:total] in;
parameter real R=1;
genvar index;
analog begin
for (index = 1; index <=total; index=index+1) begin
if (index == 1) begin
// first segment next to p contact
I(p,in[0]) <+ V(p,in[0])/R;
$strobe("p > 0");
end
if (index == total) begin
// last segment next to n contact
I(in[index],n) <+ V(in[index],n)/R;
$strobe("%d > n", index);
end
I(in[index-1], in[index]) <+ V(in[index-1], in[index])/R;
$strobe("%d > %d", index-1, index);
end
end
endmodule
The circuit script is
Code:
Resistor test example
.hdl rloop.va
Vin in 0 DC 0
X1 in2 0 Rloop
R1 in2 in 1e-1
.DC Vin 0 0.1 0.002
.print V(in) I(Vin)
.end
This resistor simulation works fine in SPECTRE, but it fails in HSPICE, citing a convergence issue. Any suggestions for making the code converge in HSPICE? Am I doing anything that is undesired in Verilog-A?
Thanks for the help!