1. ## finaltimeOP error in cadence

I am trying to design a magnetic tunnel junction. I got the following error. can any one please help?

•

2. ## Re: finaltimeOP error in cadence

Something is not converging but information you gave just tells this nothing more. So I can't pin down what exactly is problematic.

A very easy way out of DC convergence issues, if you are using an unknown model, is assigning initial conditions for your circuit. It's probable that the model you are using has open circuits at initial step so those nodes are having trouble during DC op analysis. Set up initial conditions and try again if this is all the information you can provide.

Some other things that you can look at are the model itself and checking if you are putting the magnetic tunnel junction under sane conditions.

•

3. ## Re: finaltimeOP error in cadence

i did not understand properly as i know only basics of cadence . I found the following code of MTJ in net and i have attached the schematic diagram used. I just dont know where it has gone wrong.

Code:
````resetall
`include "constants.vams"
`include "disciplines.vams"
`define explimit 85.0
`define exp(x) exp(min(max((x),-`explimit),`explimit))
`define sqrt(x) pow( (x), 0.5)

//Shape definition
`define rec 1
`define ellipse 2
`define circle 3

/*-------------------------------------------
Electrical Constants
---------------------------------------------*/

/*----------Elementary Charge---------------*/
`define e 1.6e-19
/*----------Bohr Magnetron Costant----------*/
`define ub 9.27e-28
/*----------Boltzmann Constant------------- */
`define Kb 1.38e-23
/*----------Electron Mass------------- */
`define m 9.10e-31
/*----------Euler's constant---------------*/
`define C 0.577

module Model(T1,T2,x,Ttrans,PI,Temp);

inout T1, T2;
electrical T1, T2;
electrical n1,n2;
//virtual terminals of RC circuit for time modelisation for temperature

/*----------X=store the state of the MTJ, non-volatile way------------- */
/*----------Ttrans=store the state of the MTJ with time influence, non-volatile way------------- */
/*----------PI=switching probability------------- */
/*----------Temp=store the temperature------------- */

inout x,Ttrans,PI,Temp;
electrical x,Ttrans,PI,Temp;

/*------------------------------------------
MTJ Technology Parameters
(Corresponds to the HITACHI MTJ Process)
-------------------------------------------*/

/*----------Gilbert Damping Coefficient---------------*/
parameter real  alpha=0.027;
/*----------GyroMagnetic Constant in Hz/Oe---------------*/
parameter real  gamma=1.76e7;
/*----------Electron Polarization Percentage % ---------------*/
parameter real  P=0.52;
/*----------Out of plane Magnetic Anisotropy in Oersteds---------------*/
parameter real  Hk=1433;
/*----------Saturation Field in the Free Layer in Oersteds---------------*/
parameter real  Ms=15800;
/*----------The Energy Barrier Height for MgO in electron-volt---------------*/
parameter real  PhiBas=0.4;
/*----------Voltage bias when the TMR(real) is 1/2TMR(0) in Volt---------------*/
parameter real  Vh=0.5;		//experiental value with MgO barrier

/*------------------------------------------
Device Parameters
(Corresponds to the HITACHI 240 x 80 MTJ)
-------------------------------------------*/
/*----------Height of the Free Layer  in nm---------------*/
parameter real  tsl=1.3e-9 from[0.7e-9:3.0e-9];
/*----------Length in nm---------------*/
parameter real  a=40e-9;
/*----------Width in nm---------------*/
parameter real  b=40e-9;
parameter real  r=20e-9;
/*----------Height of the Oxide Barrier in nm---------------*/
parameter real  tox=8.5e-10 from[8e-10:15e-10];
/*----------TMR(0) with Zero Volt Bias Voltage ---------------*/
parameter real  TMR=0.7;

/*----------Shape of MTJ---------------*/
parameter real 	SHAPE=2  from[1:3];  //SQUARE

/*----------Neel-Brown model parameter ---------------*/
parameter real 	tau0=8.7e-10;	//experiental value, prototype Hitachi 2007m with CoFe layer

/*----------Error probability Ps=1-Pr(t) ----------------*/
parameter real	Ps=0.999999;

/*----------Threshold for Neel-Brown model----------------*/
parameter real brown_threshold=0.0;

/*----------MTJ State Parameters----------------*/
/*----------Initial state of the MTJ, 0 = parallele, 1 = anti-parallele----*/
parameter integer 	PAP=1 from[0:1];
/*----------Room temperature in Kelvin----------------*/
parameter real 		T= 300;//\$random % 50 +323;

/*----------Resistance area product in ohmum2----------------*/
parameter real 		RA=5 from[5:15];

parameter real Pwidth=2e-8;

/*----------Parameters of RC circuit for time modelisation for temperature---------------*/
/*----------Heat capacity per unit volume in J/m3*K----------------*/
parameter real 		Cv= 2.74e6  from[2.735e6:2.7805e6];
/*----------Thermal conductivity of the thermal barrier(MgO) in W/m*K----------------*/
parameter real 		lam= 84.897 from [84.8912:84.9449];//

/*----------Total thickness of MTJ nanopillar in nm----------------*/
parameter real 		thick_s= 3.355e-8;//
/*----------RC circuit for time modelisation for temperature---------------*/
parameter real resistor=100e6; //R=100M
parameter real coeff_tau=12; //Coefficient to increase tau_th

real capacitor;   //virtual capacitor
real tau_th;        //characteristic heating/cooling time
real temp;    //real temperature of MTJ
real temp_init;   //temperature initialised
real R;		//resistance of MTJ
real delay;

parameter real p=1.0;

parameter integer STO=0 from[0:2];         //choice of stochastic dynamic, 0 no stochastic, 1 random exponential distribution,2 random gauss distribution

parameter integer RV=0 from[0:2];          //choice of stochastic static intrinsically, 0 no stochastic, 1 random uniform distribution,2 random gauss distribution

parameter integer Temp_var=0 from[0:1];     //choice of time modelisation for temperature

parameter real DEV_tox=0.03;        //choice of standard deviation of stochastic static gauss distribution for tox when RV=2
parameter real DEV_tsl=0.03;        //choice of standard deviation of stochastic static gauss distribution for tsl when RV=2
parameter real DEV_TMR=0.03;        //choice of standard deviation of stochastic static gauss distribution for TMRwhen RV=2

parameter real STO_dev=0.03;        //choice of standard deviation of stochastic dynamic gauss distribution when STO=2

//variables

//Polaristion constant for the two states of STT-MTJ
real PolaP; 	//Polarization state parallel of STT-MTJ
real PolaAP; 	//Polarization state anti-parallel of STT-MTJ

real surface;	//Surface of MTJ

//Critical current density for the two states of STT-MTJ
real gp; 	//Critical current density for P state
real gap;	//Critical current density for AP state

real Em,EE; 	//Variable of the Slonczewski model

//TMR real value for the two states of STT-MTJ
real TMRR;	//TMR real value for P state
real TMRRT;	//TMR real value for AP state

//Resistance of MTJ
real Ro;	//Resistance of MTJ when bias voltage = 0V
real Rap;	//Resistance value for AP state
real Rp;	//Resistance value for P state

//Voltage of MTJ
real Vb;	//V(T1,T2)
real Vc;	//V(T2,T1)

real Id;	//Current of MTJ

//critial current for the two states of STT-MTJ
real IcAP; 	//Critial current for AP state
real IcP;	//Critial current for P state

real ix;	//Current used to store the state of the MTJ

real tau;	//Probability parameter

real FA; //Factor for calculating the resistance based on RA

integer seed;	//Used to initialize the random number generator

//Stochastic effects
real durationstatic,duration;	//time needed to be sure that the switching is effected

real toxreal;   //real thickness of oxide layer
real tslreal;	//real thickness of free layer
real TMRreal;	//real TMR

real pp;

(*cds_inherited_parameter*)parameter real seedin = 0;  //generation of a real random value of seed for random distribution function modified 20140223

real VPI;

real P_APt;
real AP_Pt;
real NP_APt,NAP_Pt;
integer counter;

analog begin

if (SHAPE==1)
begin
surface=a*b;	//SQUARE
end
else if (SHAPE==2)
begin
surface=`M_PI*a*b/4;	//ELLIPSE
end
else
begin
surface=r*r;    //ROUND
end

Vc=V(T2,T1);	//potential between T2 and T1
Vb=V(T1,T2);	//potential between T2 and T1

//initial conditions
@(initial_step)
begin
counter=0;
seed=1000000000*seedin;	//initialization of seed modified 20140516

FA=3322.53/RA;	//initialization of resistance factor according to RA product

if (RV==1)
begin
//real thinkness of oxide layer, free layer and real TMR considering the random distribution(uniform distribution)
toxreal=\$rdist_uniform(seed,(tox-tox*DEV_tox),(tox+tox*DEV_tox));
tslreal=\$rdist_uniform(seed,(tsl-tsl*DEV_tsl),(tsl+tsl*DEV_tsl));
TMRreal=\$rdist_uniform(seed,(TMR-TMR*DEV_TMR),(TMR+TMR*DEV_TMR));
end
else if (RV==2)
begin
//real thinkness of oxide layer, free layer and real TMR considering the random distribution(gauss distribution)
toxreal=abs(\$rdist_normal(seed,tox,tox*DEV_tox/3));
tslreal=abs(\$rdist_normal(seed,tsl,tsl*DEV_tsl/3));
TMRreal=abs(\$rdist_normal(seed,TMR,TMR*DEV_TMR/3));
end
else
begin
toxreal=tox;
tslreal=tsl;
TMRreal=TMR;
end
temp=T;
temp_init=T;

tau_th= Cv*thick_s / (lam/thick_s);

capacitor=coeff_tau*tau_th/resistor;	//tau_th=resistor*capacitor

Ro=(toxreal*1.0e10/(FA*`sqrt(PhiBas)*surface*1.0e12))*exp(1.025*toxreal*1.0e10*`sqrt(PhiBas));	//resistance

Em=Ms*tslreal*surface*Hk/2;

duration=0.0;

if(analysis("dc"))
begin
//States inititialisation
ix=PAP;
end
else
begin
ix=-PAP;
I(x)<+ PAP;
VPI=p;
I(PI)<+p;
end

I(Ttrans)<+ -PAP;

// I(T1,T2)<+ Id;	//Actualisation of the current of MTJ with the value calculated
end

if(Temp_var==0)
begin
temp=temp_init;        //temperature constant
end
else
begin
temp=V(Temp);          //time modelisation for temperature
end

EE=Em/(`Kb*temp*40*`M_PI);  //result of E/kbT

if(analysis("dc"))

begin
if(ix==0)	//Case which the magnetizations of the two layers are parallel
begin
TMRR=TMRreal/(1+Vb*Vb/(Vh*Vh));

//Parallel resistance
Rp=Ro;
R=Rp;
Id=Vb/Rp;

//Calcul of critical current
PolaP=`sqrt(TMRreal*(TMRreal+2))/(2*(TMRreal+1));  	//Polarization state parallel

gp=alpha*gamma*`e*Ms*tslreal*Hk/(40*`M_PI*(`ub*PolaP)); 	//Critical current density
IcP=gp*surface;
//\$display("gp=%g",gp);
if(Vb<(IcP*Rp))
begin
ix=0.0;

end
else
begin
ix=1.0;

end
end
else
begin
//TMR real
TMRRT=TMRreal/(1+Vb*Vb/(Vh*Vh));

// Antiparallel resistance
Rap=Ro*(1+TMRRT);
Rp=Ro;
R=Rap;
Id=Vb/(Rap);
PolaAP=`sqrt(TMRreal*(TMRreal+2))/(2*(TMRreal+1));  	//Polarization state anti parallel
gap=alpha*gamma*`e*Ms*tslreal*Hk/(40*`M_PI*(`ub*PolaAP));  	//Critical current density
IcAP=gap*surface; 	// Critical current

if(Vc>=(IcAP*Rap))
begin
ix=0.0;
end
end

V(Ttrans)<+ix;
I(T1,T2)<+Id;	//Actualisation of the current of MTJ with the value calculated
end
else
begin
if(STO==1||STO==2)    //considering the stochastic behaviors
begin

if(I(Ttrans)>-0.5)	//Case which the magnetizations of the two layers are parallel
begin

if (pp==1)
begin
VPI=1;
pp=0;
end

//TMR real
TMRR=TMRreal/(1+Vb*Vb/(Vh*Vh));

//Parallel resistance
Rp=Ro;
R=Rp;
Id=Vb/Rp;

if(ix==0)		//Dynamic=parallel state,static=parallel state
begin

//Calcul of critical current
PolaP=`sqrt(TMRreal*(TMRreal+2))/(2*(TMRreal+1));  	//Polarization state parallel

gp=alpha*gamma*`e*Ms*tslreal*Hk/(40*`M_PI*(`ub*PolaP)); 	//Critical current density
IcP=gp*surface;		// Critical current

if(Vb>=IcP*Rp)
begin	//Current higher than critical current

//STT-MTJ dynamic behavior : Sun model

//Time needed to be sure that the switching is effected
durationstatic=(`C+ln(`M_PI*`M_PI*(Em/(`Kb*temp*40*`M_PI))/4))*`e*1000*Ms*surface*tslreal*(1+P*P)/(4*`M_PI*2*`ub*P*10000*abs(Id-IcP));
\$display("durationstatic=",durationstatic);
if(STO==1)
begin
duration=abs(\$rdist_exponential(seed, durationstatic));	//stochastic effect(exponential distribution)

end
else if(STO==2)
begin

duration=abs(\$rdist_normal(seed,0.995*durationstatic,durationstatic*STO_dev/3));	//stochastic effect(gauss distribution)

end

else
begin
duration=durationstatic;
end

if(duration<=Pwidth)
begin	//Switching of the free layer always occurs

if(duration>VPI)
begin
ix=-1.0;   //change the current state of MTJ
pp=1;
end
else
begin
VPI=duration;
duration= 100000000;
end

end
end

else
begin	//Current smaller than critical current

ix=0.0;	//save the current state of MTJ
//STT-MTJ dynamic behavior : Neel-Brown model
tau=tau0*exp(Em*(1-abs(Id/IcP))/(`Kb*temp*40*`M_PI));

if(Vb>brown_threshold)
begin
if (Vb<0.8*IcP*Rp)
begin

if(STO==1||STO==2)
begin
duration=abs(\$rdist_exponential(seed, tau));	//stochastic effect
end

else
begin
duration=tau;
end

if (Pwidth >= duration)
begin
if(VPI<=duration)
begin
ix=-1.0;   //change the current state of MTJ
end
else
begin
VPI=duration;
duration= 100000000;
end
end
end
end
end
end

end

else if(I(Ttrans)<-0.5)  	//Case which the magnetizations of the two layers are antiparallel
begin

if (pp==1)
begin
VPI=1;
pp=0;
end

//TMR real
TMRRT=TMRreal/(1+Vb*Vb/(Vh*Vh));

// Antiparallel resistance
Rap=Ro*(1+TMRRT);
Rp=Ro;
R=Rap;
Id=Vb/(Rap);

if(ix==0)
begin

PolaAP=`sqrt(TMRreal*(TMRreal+2))/(2*(TMRreal+1));  	//Polarization state anti parallel
gap=alpha*gamma*`e*Ms*tslreal*Hk/(40*`M_PI*(`ub*PolaAP));  	//Critical current density
IcAP=gap*surface; 	// Critical current

if(Vc>=(IcAP*Rap))
begin	//Current higher than critical current

//STT-MTJ dynamic behavior : Sun model
durationstatic=(`C+ln(`M_PI*`M_PI*(Em/(`Kb*temp*40*`M_PI))/4))*`e*1000*Ms*surface*tslreal*(1+P*P)/(4*`M_PI*2*`ub*P*10000*abs(-Id-IcAP));

//time needed to be sure that the switching is effected
if(STO==1)
begin
duration=abs(\$rdist_exponential(seed, durationstatic));	//stochastic effect
end
else if(STO==2)
begin
duration=abs(\$rdist_normal(seed,0.995*durationstatic,durationstatic*STO_dev/3));	//stochastic effect(gauss distribution)

end
else
begin
duration=durationstatic;
end

if(duration<=Pwidth)
begin	//Switching of the free layer always occurs

if(VPI<=duration)
begin
ix=0.0;   //change the current state of MTJ
pp=1;
end
else
begin
VPI=duration;
duration= Pwidth;
end

end
end
else
begin	//Current smaller than critical current

ix=-1.0;	//save the current state of MTJ
//STT-MTJ dynamic behavior : Neel-Brown model
tau=tau0*exp(Em*(1-abs(Id/IcAP))/(`Kb*temp*40*`M_PI));

if(Vc>brown_threshold)
begin
if (Vc<0.8*IcAP*Rap)
begin
if(STO==1||STO==2)
begin

duration=abs(\$rdist_exponential(seed, tau));	//stochastic effect
end

else
begin
duration=tau;
end

if (duration<=Pwidth)
begin

if(VPI<=duration)
begin
ix=0.0;   //change the current state of MTJ
end
else
begin
VPI=duration;
duration= 100000000;
end

end
end

end
end

end

end

end

else                          //without consideration of stochastic behaviors
begin

if(I(Ttrans)>-0.5)	//Case which the magnetizations of the two layers are parallel
begin

if (pp==1)
begin
VPI=1;
pp=0;
end

//TMR real
TMRR=TMRreal/(1+Vb*Vb/(Vh*Vh));

//Parallel resistance
Rp=Ro;
R=Rp;
Id=Vb/Rp;
//Calcul of critical current
PolaP=`sqrt(TMRreal*(TMRreal+2))/(2*(TMRreal+1));  	//Polarization state parallel

gp=alpha*gamma*`e*Ms*tslreal*Hk/(40*`M_PI*(`ub*PolaP)); 	//Critical current density
IcP=gp*surface;		// Critical current

if(Vb>=IcP*Rp)
begin	//Current higher than critical current
//STT-MTJ dynamic behavior : Sun model

//Time needed to be sure that the switching is effected
durationstatic=(`C+ln(`M_PI*`M_PI*(Em/(`Kb*temp*40*`M_PI))/4))*`e*1000*Ms*surface*tslreal*(1+P*P)/(4*`M_PI*2*`ub*P*10000*abs(Id-IcP));

duration=durationstatic;

if(duration<=Pwidth)
begin	//Switching of the free layer always occurs
ix=-1.0;   //change the current state of MTJ
end
else
begin
ix=0.0;
end

end
else
begin	//Current smaller than critical current

ix=0.0;	//save the current state of MTJ
//STT-MTJ dynamic behavior : Neel-Brown model
tau=tau0*exp(Em*(1-abs(Id/IcP))/(`Kb*temp*40*`M_PI));
if(Vb>brown_threshold)
begin
if (Vb<0.8*IcP*Rp)
begin
duration=tau;

if (Pwidth >= duration)
begin

ix=-1.0;   //change the current state of MTJ
end
else
begin
ix=0.0;
end

end
end

end

end

else if(I(Ttrans)<-0.5)   	//Case which the magnetizations of the two layers are antiparallel

begin

if (pp==1)
begin
VPI=1;
pp=0;
end

//TMR real
TMRRT=TMRreal/(1+Vb*Vb/(Vh*Vh));

// Antiparallel resistance
Rap=Ro*(1+TMRRT);
Rp=Ro;
R=Rap;
Id=Vb/(Rap);
PolaAP=`sqrt(TMRreal*(TMRreal+2))/(2*(TMRreal+1));  	//Polarization state anti parallel
gap=alpha*gamma*`e*Ms*tslreal*Hk/(40*`M_PI*(`ub*PolaAP));  	//Critical current density
IcAP=gap*surface; 	// Critical current

if(Vc>=(IcAP*Rap))
begin	//Current higher than critical current

//STT-MTJ dynamic behavior : Sun model
durationstatic=(`C+ln(`M_PI*`M_PI*(Em/(`Kb*temp*40*`M_PI))/4))*`e*1000*Ms*surface*tslreal*(1+P*P)/(4*`M_PI*2*`ub*P*10000*abs(-Id-IcAP));
duration=durationstatic;  //time needed to be sure that the switching is effected

if(duration<=Pwidth)
begin	//Switching of the free layer always occurs
ix=0.0;   //change the current state of MTJ
end
else
begin
ix=-1.0;
end
end
else
begin	//Current smaller than critical current

ix=-1.0;	//save the current state of MTJ
//STT-MTJ dynamic behavior : Neel-Brown model
tau=tau0*exp(Em*(1-abs(Id/IcAP))/(`Kb*temp*40*`M_PI));

if(Vc>brown_threshold)
begin
if (Vc<0.8*IcAP*Rap)

begin
duration=tau;

if (duration<=Pwidth)
begin
ix=0.0;   //change the current state of MTJ

end
else
begin
ix=-1.0;
end

end

end
end

end

end

I(x)<+ix;	//Actualisation of the state of x with the value calculated
if(counter==0)
begin
if(I(Ttrans)!=0)
begin
ix=0;
end
end

I(Ttrans)<+ transition(ix,duration,1e-11,1e-11); //Ttrans has the same function than x but it includes the time effects

if(counter==0)
begin
if(I(Ttrans)!=0)
begin
ix=-1;
end
end
I(T1,T2)<+Id;	//Actualisation of the current of MTJ with the value calculated

I(PI)<+VPI;
counter=counter+1;

end    //la fin de transient analysis

if(Temp_var==1)
begin
V(n1) <+ ( V(T1,T2)*V(T1,T2) )/ ( R*surface*lam/(thick_s ));   //Definition of the maximum incrase of temperature

I(n1,n2) <+ V(n1,n2) / resistor;	// RC circuit definition,RC circuit parallel
I(n2) <+ capacitor * (ddt(V(n2)));

V(Temp) <+  V(n2) + temp_init;
end
else
begin
V(Temp) <+  temp_init;
end
// \$display("The resistance R=",R);
// \$display("The current Id=",Id);
// \$display("Parallel to antiparallel critical current IcP=",IcP);
// \$display("Antiparallel to parallel critical current IcAP=",IcAP);

end  //la fin d'analog begin

endmodule```

--[[ ]]--