- 31st March 2012, 03:21 #1

- Join Date
- Mar 2012
- Posts
- 12
- Helped
- 3 / 3
- Points
- 469
- Level
- 4

## Memristor simulation in HSPICE

Hi,

I am working with memristors and have been trying to simulate their behavior using HSPICE without success. Am using the non-linear dopant drift model from http://www.radioeng.cz/fulltexts/2009/09_02_210_214.pdf

Just to confirm that the SPICE code I was using was correct I tried it in Pspice, as the testing in the above paper was done on Pspice. It worked on Pspice and I was able to simulate the code, i.e., observe the hysteresis, using it. The code I used in PSpice is very similar to the one available at:

Simulation problem with pspice model of memristor

Am including it here (from the above thread, but my code is similar):

PSpice Code:

* Ron, Roff - Resistance in ON / OFF States

* Rinit - Resistance at T=0

* D - Width of the thin film

* uv - Migration coefficient

* p - Parameter of the WINDOW-function

* for modeling nonlinear boundary conditions

* x - W/D Ratio, W is the actual width

* of the doped area (from 0 to D)

*

.SUBCKT memristor Plus Minus PARAMS:

+ Ron=100 Roff=16K Rinit=11K D=10N uv=10F p=10

* DIFFERENTIAL EQUATION MODELING *

Gx 0 x value={ I(Emem)*uv*Ron/D^2*f(V(x),p)}

Cx x 0 1 IC={(Roff-Rinit)/(Roff-Ron)}

Raux x 0 1T

* RESISTIVE PORT OF THE MEMRISTOR *

Emem plus aux value={-I(Emem)*V(x)*(Roff-Ron)}

Roff aux minus {Roff}

*Flux computation*

Eflux flux 0 value={SDT(V(plus,minus))}

*Charge computation*

Echarge charge 0 value={SDT(I(Emem))}

* WINDOW FUNCTIONS

* FOR NONLINEAR DRIFT MODELING *

*window function, according to Joglekar

.func f(x,p)={1-(2*x-1)^(2*p)}

*proposed window function

;.func f(x,i,p)={1-(x-stp(-i))^(2*p)}

.ENDS memristor

Xmemrist aa 0 memristor

Vtest aa 0 SIN(0 1.2V 1 0 0 0)

.tran 0 3s 0 3m skipbp

.probe

.end

----------------------------------------------

But when I try to use it with HSPICE it does not work, i.e., I am unable to observe the hysteresis when plotting the I-V characteristics. The I-V plot is linear, representing a simple resistor.

My HSPICE code is shown below:

* MEMRISTOR

* Ron, Roff - Resistance in ON / OFF States

* Rinit - Resistance at T=0

* D - Width of the thin film

* uv - Migration coefficient

* p - Parameter of the WINDOW-function

* for modeling nonlinear boundary conditions

* x - W/D Ratio, W is the actual width

* of the doped area (from 0 to D)

*

.SUBCKT memristor Plus Minus

+ Ron=100 Roff=16K Rinit=11K D=10N uv=10F p=10

* DIFFERENTIAL EQUATION MODELING *

. PARAM f(x,p)= '1-pow((2*x-1),(2*p))'

Gx 0 x value='I(Emem)*uv*Ron/pow(D,2)*f(V(x),p)'

Cx x 0 1 IC='(Roff-Rinit)/(Roff-Ron)'

Raux x 0 1T

* RESISTIVE PORT OF THE MEMRISTOR *

Emem plus aux value='-I(Emem)*V(x)*(Roff-Ron)'

Roff aux minus Roff

*Flux computation*

*Eflux flux 0 value={SDT(V(plus,minus))}

*Charge computation*

*Echarge charge 0 value={SDT(I(Emem))}

* WINDOW FUNCTIONS

* FOR NONLINEAR DRIFT MODELING *

*window function, according to Joglekar

*.func f(x,p)={1-(2*x-1)^(2*p)}

*proposed window function

*;.func f(x,i,p)={1-(x-stp(-i))^(2*p)}

.ENDS memristor

Xmemrist aa 0 memristor Ron=100 Roff=16K Rinit=11K D=10N uv=10F p=10

Vtest aa 0 SIN(0 1.2V 1 0 0 0)

.tran 100U 5

.plot tran V(aa) I(Vtest)

.option list node post=2 ingold=2

.end

---------------------------------------------

The changes I made from Pspice to HSPICE are:

1. changed the 'window' function definition from Pspice to HSPICE equivalent,

2. commented the flux and charge computation sections, as HSPICE does not have a 'SDT' equivalent function and they are not needed to observe the memristor characteristics.

Am not able to figure out the issue, any help would be useful.

--

Thanks,

Basawaraj

- 31st March 2012, 03:21

- 13th April 2012, 20:51 #2

- Join Date
- Mar 2012
- Posts
- 12
- Helped
- 3 / 3
- Points
- 469
- Level
- 4

## Re: Memristor simulation in HSPICE

Hi,

Came up with a idea to fix my HSPICE code. For this I have to access the nodes inside the subcircuit. This is pretty easy in HSPICE, but am not sure how to do this in PSPICE.

I tried by changing my memristor symbol, that is added another port at node "aux" of the subcircuit so that I could probe it. As I am only interested in probing it this port was left unconnected in the circuit. The simulation failed because this node was left unconnected.

Hence, is it possible to probe nodes inside a PSPICE subcircuit? If so how?

- 28th May 2012, 22:42 #3

- Join Date
- Mar 2012
- Posts
- 12
- Helped
- 3 / 3
- Points
- 469
- Level
- 4

## Re: Memristor simulation in HSPICE

Hi,

Found a solution, have to turn off the runlvl parameter, i.e., set it to zero

- 22nd October 2012, 15:45 #4

- Join Date
- Oct 2012
- Posts
- 1
- Helped
- 0 / 0
- Points
- 30
- Level
- 1

## Re: Memristor simulation in HSPICE

I tried to run your posted code and turned off runlvl as you suggested,

.option list node post=2 ingold=2 runlvl=0

However, it did not work as I was not able to observe hysteresis. Anything else should I modify to get it working? Do you mind to post your final working HSPICE code? Thanks in advance.

- 22nd October 2012, 15:45

- 4th November 2012, 21:21 #5

- Join Date
- Nov 2012
- Posts
- 2
- Helped
- 0 / 0
- Points
- 333
- Level
- 3

## Re: Memristor simulation in HSPICE

Hi basawaraj,

Would you mind sharing your final HSPICE description? For any reason, no matter I made the changes you recommended it does not work for me. We are using Synopsys' HSPICE 2010.

Thanks in advance!

- 27th May 2013, 21:21 #6

- Join Date
- May 2013
- Posts
- 1
- Helped
- 1 / 1
- Points
- 13
- Level
- 1

## Re: Memristor simulation in HSPICE

Hi,

I tested this code with hspice(V2008).At first it doesn't work and give me this error " **warning** (c:\users\sh.k\desktop\mem12.sp:17) ignore unrecognizable command card ." and then I checked every thing in this program. Finally I think I found what is wrong!

In this line:__". PARAM f(x,p)= '1-pow((2*x-1),(2*p))' "__**you should be delete the spice between "." and "PARAM"**. you do it and check again!

By the way, in Hspice it is better that "STD" changed to "INTEG".

---------

Shahab

1 members found this post helpful.

- 28th May 2013, 04:15 #7

- Join Date
- Nov 2012
- Posts
- 2
- Helped
- 0 / 0
- Points
- 333
- Level
- 3

## Re: Memristor simulation in HSPICE

Shahab, Thank you so much for the reply! I'm going to give ti a try!

- 14th May 2014, 20:44 #8

- Join Date
- May 2014
- Posts
- 6
- Helped
- 0 / 0
- Points
- 70
- Level
- 1

## Re: Memristor simulation in HSPICE

Hi onnes,

After all the changes suggested by u people i m getting just opposite curve of hysteresis, i.e., instead of 1st and 2nd quadrant i m getting it into 2nd and 4th quadrant. i have used the same code given above. Please help me with this.

Thanking you in anticipation.

- 2nd October 2014, 19:29 #9

- Join Date
- Oct 2014
- Posts
- 2
- Helped
- 0 / 0
- Points
- 13
- Level
- 1

## Re: Memristor simulation in HSPICE