Open the PDK tab
Click the PDK tab at the top.
No two devices from a factory are exactly alike. Read the PDK's process corners, simulate the typical and the slow memristor, then build 20 random memristors in one Monte Carlo run and find out which manufacturing spread matters most. You only ever need to click whatever is inside the red box, or type exactly what is in a black box.
Do Your first simulation first: this section uses the same moves (Netlist, Simulate, Quit, quit). Start with openPDKcreator open.
A real factory never makes two devices exactly alike: the oxide comes out a little thicker here, the metal a little rougher there. So the PDK doesn't give one value for Ron and Roff, it gives corners: the typical case and the two extremes a designer must survive. Here they live in one file, openmemristorpdk_corners.lib, and openPDKcreator shows them in a table.
Click the PDK tab at the top.
Click Simulation.
You are on ngspice Models, with the file openmemristorpdk_corners.lib already chosen. Click the small Corners tab.
Three rows (1): TT, FF and SS. TT is selected, and its values are in the box at the bottom right (2).
ron_tio2_au = 100 Ω and roff_tio2_au = 16k (16 000 Ω).Click the FF row.
The box now shows the FF values: ron_tio2_au = 80 and roff_tio2_au = 12.8k, both 20 % below TT. Don't change anything here.
A testbench picks one corner with a single word. You'll run the typical one first.
Click the Library Manager tab.
Click the library openmemristorpdk_pr (1) if it isn't selected yet, then the cell memristor_tio2_au_corners_tb (2).
Click Open in xschem on the Schematic row.
The same circuit as in Your first simulation: a sine-wave source and one memristor. The difference is in the code block at the bottom. The line boxed in red picks the corner.
* Process corner: TT (typical), FF (fast) or SS (slow).
* To try another corner, change the last word of the .lib line.
.lib /foss/designs/openMemristorPDK/data/openmemristorpdk/libs.tech/ngspice/models/openmemristorpdk_corners.lib TT
.model mm memristor_tio2_au ron={ron_tio2_au} roff={roff_tio2_au} d=10n uv=1e-14 x0=0
.control
pre_osdi /foss/designs/openMemristorPDK/user_models/veriloga/memristor_tio2_au.osdi
tran 300u 3.34
let peak = maximum(-i(V1)) * 1e6
echo Ron = $&@mm[ron] Ohm Roff = $&@mm[roff] Ohm peak current = $&peak uA
plot -i(V1) vs v(te) retraceplot ylimit -110u 110u title 'Memristor I-V loop at one corner' xlabel 'Voltage (V)' ylabel 'Current (A)'
.endc
Click Netlist and wait until it turns green.
Click Simulate and wait about 10 seconds.
The plot shows the pinched loop of a typical device, and the last line in the ngspice window gives its numbers.
Click Quit in the plot window.
Click inside the white ngspice window, type quit and press Enter.
Same testbench, one word changed: TT becomes SS.
Double-click the code block text.
The Edit Properties window opens. The .lib line is too long to see its end. Click anywhere on it.
Press End. The text slides left and the cursor stops right after TT.
Press Backspace twice, type SS (1) and click OK (2).
SS in capitals: the corner names in the file are capitals.Click Netlist (1), wait for green, then Simulate (2).
A thinner loop: less current flows.
FF. You should get a peak of 98.6 µA.Same as before: Quit in the plot window, then quit + Enter in the ngspice window.
Click the X at the top-right of the xschem window.
xschem asks UNSAVED data: want to exit? Click OK. The testbench keeps TT for next time.
Corners show the extremes. Monte Carlo shows what a real batch looks like: ngspice builds 20 memristors, each with its own random Ron, Roff and oxide thickness D, and simulates them one after another. The name comes from the casino in Monaco: it's all about random numbers.
In the Library Manager, click memristor_tio2_au_mc_tb.
Click Open in xschem.
Same circuit, a longer code block. The three lines boxed in red are where the randomness comes from.
* Monte Carlo: simulate 20 memristors, each one a little different,
* like 20 devices from a real factory. agauss(typical, spread, 1)
* draws a random value around the typical one (a bell curve).
.param ron_mc = agauss(100, 10, 1)
.param roff_mc = agauss(16k, 1.6k, 1)
.param d_mc = agauss(10n, 0.5n, 1)
.model mm memristor_tio2_au ron={ron_mc} roff={roff_mc} d={d_mc} uv=1e-14 x0=0
.options interp
.control
pre_osdi /foss/designs/openMemristorPDK/user_models/veriloga/memristor_tio2_au.osdi
* setseed: the same 20 random memristors every time (the ones in the guide)
setseed 16
let runs = 20
let ron = vector(runs)
let roff = vector(runs)
let dnm = vector(runs)
let peak = vector(runs)
set curves = ( )
let n = 0
dowhile n < runs
reset
tran 1m 3.34
let ron[n] = @mm[ron]
let roff[n] = @mm[roff]
let dnm[n] = @mm[d] * 1e9
let imem = -i(V1)
let peak[n] = maximum(imem) * 1e6
set curves = ( $curves {$curplot}.imem )
let n = n + 1
end
setplot const
let n = 0
dowhile n < runs
let r1 = ron[n]
let r2 = roff[n]
let dd = dnm[n]
let pk = peak[n]
echo memristor $&n : Ron $&r1 Roff $&r2 D $&dd nm peak $&pk uA
let n = n + 1
end
plot $curves vs tran1.v(te) retraceplot title '20 memristors (Monte Carlo)' xlabel 'Voltage (V)' ylabel 'Current (A)'
.endc
Click Netlist (1), wait for green, then Simulate (2). Twenty simulations take about 20 seconds.
Nineteen loops are so small they lie flat along the zero line. One of them shoots up to almost 5 mA.
tran1.imem ... tran20.imem: run 1 to run 20.
The blue one, tran2, has switched on: the steep line through the middle is its low Ron.
The current is 60 times bigger than the others. The plot's scale is now mA (thousandths), not µA.
The plot covers part of the ngspice window. Click the ngspice window's title bar to bring it to the front.
One line per memristor, numbered from 0. Memristor 0 is run 1, memristor 1 is run 2 (the blue one), and so on.
Click Quit in the plot window.
Click inside the ngspice window, type quit and press Enter.
What if the factory could make the oxide exactly 10 nm every time? Set D's spread to zero and run the batch again.
Double-click the code block text.
On the line .param d_mc = agauss(10n, 0.5n, 1), click right after 0.5n, before the comma.
Press Backspace 4 times to delete 0.5n, type 0 (1). The line now reads agauss(10n, 0, 1). Click OK (2).
Click Netlist (1), wait for green, then Simulate (2), and wait about 20 seconds.
Now every loop is visible: twenty pinched loops, all between about 60 and 130 µA. None switches on.
Quit in the plot window, then quit + Enter in the ngspice window (bring it to the front first).
Click the X at the top-right of the xschem window.
Click OK on UNSAVED data: want to exit? The testbench keeps the 0.5n spread.