Monte Carlo Analysis: With Emphasis On Memory L13, Part 1
Monte Carlo Analysis: With Emphasis On Memory L13, Part 1
6/14/23 SS 2023 2
IBM Power 8
6/14/23 SS 2023 3
How to Make a Memory
• If it is about a loved one, a photo or a letter make wonderful
reminders and will last a long time
• If it is for a chip, we need a circuit that can reliably store a state
T F F T
6/14/23 SS 2023 4
How to Make LOTS of Memory
• Chips perform best when they have lots of data
• So we want a LOT of memory on a chip
• Example: Apple’s M1 chip has ~550 Million “bits”
6/14/23 SS 2023 5
An SRAM “Cell”
• Consists of the two cross-coupled Bit Line Bit Line Bar
inverters, plus two “access” devices Word Line
6/14/23 SS 2023 6
From Cell to Memory
• We stack the cells so that they share word-lines horizontally and
share bit lines vertically
• The address decoder selects
cell cell cell cell cell cell cell cell
one row of cells cell cell cell cell cell cell cell cell
Address Decoder
cell cell cell cell cell cell cell cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
bottom of the array senses cell cell cell cell cell cell cell cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
6/14/23 SS 2023 7
Reading a Cell
• Pre-charge circuit charges Pre-Charge Circuit
the two bit lines to 𝑉## Bit Line Bit Line Bar
Word Line
6/14/23 SS 2023 8
Reading a Cell 𝑉!!
Pre-Charge
Word Line
Sense-Amplifier Circuit
Output
6/14/23 SS 2023 9
Writing a Cell
Data
• Similar to the read,
except that the bit
Write Enable
lines are driven by
strong tri-state Bit Line Bit Line Bar
buffers which force
Word Line
the state of the cell to
the desired value
Output
6/14/23 SS 2023 10
Sense Amps
𝑉!!
Pre-Charge
• Sense Amplifiers
are super important to
determining the speed Bit Line Bit Line Bar
Sense Enable
6/14/23 SS 2023 11
Reading a 0 and a 1
Sense Enable
Word Line 2
Word Line 1
Pre-Charge
6/14/23 SS 2023 12
Parasitics and other Messy Things
• The cell exists in the company of many other cells
cell
cell
cell
• Cells in the same row share the same word line, while cell
cell
cell
cell
cell
cell
• We will model the presence of the other cells using our load cell
6/14/23 SS 2023 13
Creating a Complete Column
Pre-Charge
• SRAMs are usually divided into
banks, and each bank is N×M cells
Bit Line Bit Line Bar
Word Line
Sense
Enable
6/14/23 SS 2023 14
Creating a Complete Column
• We need one cell storing a 0 and another
cell storing a 1
• Because we want the access time for both Bit Line Bit Line Bar
cases
• We will use our “load multiplier” to create × ×
the other cells
6/14/23 SS 2023 15
Implementation Details
cell cell cell cell cell cell cell cell
• If the SRAM cell is 0.3µ x 1.2µ cell cell cell cell cell cell cell cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
cell
this means the height of the array
Address Decoder
cell cell cell cell cell cell cell cell
is 128 x 0.3µ = 38.4µ cell cell cell cell cell cell cell cell
• For an 8K array, we will have 64 cell cell cell cell cell cell cell cell
array is 64 x 1.2µ = 76.8µ cell cell cell cell cell cell cell cell
6/14/23 SS 2023 16
Cells + Wires and Parasitics
• The well needs connections to 𝐵𝐿 𝐵𝐿
• Power, Ground
GND
GND
GND
VDD
• Word Line
• Bit Line and Bit Line Bar
WL Cell Cell
Metal 2
6/14/23 SS 2023 17
Aside: Estimating Parasitics
'(
• Resistance: 𝑅 = )*
𝜌+, = 0.017Ω𝜇
T A B
W S
6/14/23 SS 2023 18
Wiring Levels Example
This is an older 0.25µ
technology, current
“Last” Metal, X (and Y) processes have many
more layers of metal
M4, Y direction
M1, X direction
Microns
6/14/23 SS 2023 19
A Deeper Look
• Our basic cell is just two inverters
Output
• DC transfer curve for an Yes… it inverts!
inverter →
Input
6/14/23 SS 2023 20
Back to Back Inverters
• We can plot the forward and backward transfer curves together
B
• At the points where the
two lines intersect, the two
inverters are “in agreement” B A
6/14/23 SS 2023 21
Stability and Instability
• Not like my Ex-President
6/14/23 SS 2023 22
Where are our Inverters Stable
• The middle point is not stable, any noise will cause the inverters to
go to one of the other of the stable points
B
6/14/23 SS 2023 23
Stability and Noise
• The “butterfly curve” we plotted earlier is useful for understanding
how our SRAM cell responds to noise
B
6/14/23 SS 2023 24
Questions?
6/14/23 SS 2023 25
MOSFET Refresher
Source Gate Drain
accelerator
Ion
• We “set” the threshold voltage by
implanting dopant ions in the channel
to change it charge density and therefore
the ease with which the channel can be
Dopant Ions
made to conduct
• And in Lecture 5 we explained that
implantation is a random process in that the
location of the dopant ions is random
Source Drain
Channel
6/14/23 SS 2023 26
The Dope on Silicon
• Wafers are made from pure crystalline Silicon
0.543nm
• Doping concentrations are in the range of
1013 to 1018 dopants / cm3 which works out to
be 10-8 to 10-3 dopants / nm3
5nm
20nm
• A device which is 5nm x 200nm x 20nm 200nm
will have ~20 dopant ions
6/14/23 SS 2023 27
Discrete vs. Average
• In a large device, the dopants are scattered all over and tend to
“average” out
• But as devices get
smaller, the averaging
disappears
• And therefore the
randomness of the
dopant locations is
much more visible
• And thus 𝑉!" is more
variable as devices are
made smaller!
6/14/23 SS 2023 28
Modeling & Simulation of 𝑉!" Variability
• Advanced Process Design Kits (PDK) Customer PDK Foundry
have information on the expected Design FAB
variability in threshold voltage Design Test
Chips Package
6/14/23 SS 2023 29
Simulating Stability
If you are at VDD the
current is zero, but if you
Current flowing reduce your voltage the
into source inverter fights you, giving
you current to bring you
back up
Current flowing
out of source
6/14/23 SS 2023 30
Interpreting the Stability Curve
Safe
Safe
6/14/23 SS 2023 31
Exploring our Stability Curve
* sram 32nm dc stability
OK * sram 32nm dc stability
.include 32nm_HP.pm
Better
.include 32nm_HP.pm
* make the DC voltage sources * make the DC voltage sources
VDD vdd 0 0.7 VDD vdd 0 0.7
VIN vin 0 0.0 VIN vin 0 0.0
M0 out g0 vdd vdd PMOS L=32n W=128n .subckt pfet d g s b PARAMS: L=1.0 W=1.0 DVT=0.0
M1 out g1 0 0 NMOS L=32n W=128n vx g gx {DVT}
M2 vin g2 vdd vdd PMOS L=32n W=128n mx d gx s b PMOS L={L} W={W}
M3 vin g3 0 0 NMOS L=32n W=128n .ends
.dc VIN 0.0 0.7 0.005 x0 out vin vdd vdd pfet PARAMS: L=32n W=128n
.print dc v(vin) i(VIN) x1 out vin 0 0 nfet PARAMS: L=32n W=128n
.end x2 vin out vdd vdd pfet PARAMS: L=32n W=128n
x3 vin out 0 0 nfet PARAMS: L=32n W=128n
6/14/23 SS 2023 32
Monte-Carlo Stability Curve
def write_spice_file(cktfile, P) :
f = open(cktfile, "w")
f.write(f"""* sram 32nm dc stability Write the spice file
.include 32nm_HP.pm with the 4 𝑉"# shifts
VDD vdd 0 0.7
VIN vin 0 0.0
.subckt nfet d g s b PARAMS: L=1.0 W=1.0 DVT=0.0
vx g gx {{DVT}}
mx d gx s b NMOS L={{L}} W={{W}}
.ends
.subckt pfet d g s b PARAMS: L=1.0 W=1.0 DVT=0.0
vx g gx {{DVT}}
mx d gx s b PMOS L={{L}} W={{W}}
.ends
x0 out vin vdd vdd pfet PARAMS: L=32n W=128n DVT={P[0]}
x1 out vin 0 0 nfet PARAMS: L=32n W=128n DVT={P[1]}
x2 vin out vdd vdd pfet PARAMS: L=32n W=128n DVT={P[2]}
x3 vin out 0 0 nfet PARAMS: L=32n W=128n DVT={P[3]}
.dc VIN 0.0 0.7 0.005
.print dc v(vin) i(VIN)
.end""")
f.close()
6/14/23 SS 2023 33
Results
• Art!
6/14/23 SS 2023 34
From Curve to Noise Margins
• Calculating the values
at which the minima
and maxima occur
• What is a reasonable
goal for the noise margin?
• A common rule of thumb
is 10% of 𝑉!!
6/14/23 SS 2023 35
Noise Margins are Correlated
Seems like we
have a lot of
room before cell
failure
6/14/23 SS 2023 36
Probabilities and Failures
• Let us assume that the probability of failure of an SRAM cell is 𝑝
• If we have 𝑁 cells in our array, then the probability that all 𝑁 are OK
is 𝑃56657 = 1 − 𝑝 8
𝑝
• Say we would like
99% of our arrays
to work, then we
0.99 = 1 − 𝑝 8 →
Type equation here.
To get a 1K bit array
working, 𝑝 has to be < 10-5!
6/14/23 SS 2023 37
Estimating the Failure Probability
• We can estimate the distribution, and from that estimate the
probability
• 𝑆𝑁𝑀" = 𝑁(0.24897,0.038872) and we want 𝑃𝑟𝑜𝑏(𝑆𝑁𝑀" ) < 0.07)
• This corresponds to a
failure probability of
1.014×10-5
• Cannot do an array of more
than 1K with this cell 😳
6/14/23 SS 2023 38
ReReReDunDuncy
• In a large SRAM array, redundant rows and columns are added in
order to try and “fix” a broken array
• OK for a large array, but not possible on a small one (< 32Kb)
• So we still have to deal with this problem
6/14/23 SS 2023 39
Questions?
6/14/23 SS 2023 40
Project Feedback
6/14/23 SS 2023 41
Plots, Points and Lines
• Most of you made plots like this →
6/14/23 SS 2023 42
Histograms
• “The histogram
resembles a Gaussian
curve in all the cases”
6/14/23 SS 2023 43
Our Friend
• I was impressed that
some of you did a bit
of research on the
circuits and found out
what they are
6/14/23 SS 2023 44
P e r f o r m a n c e
• Many of you mentioned long CPU times for
running the various simulations
6/14/23 SS 2023 45
Black and White Boxes
• The intent of giving you the simulator in
source code was for you to feel free to
modify it
• Those who did Project 2 had no choice, but
many Project 1 teams did not “enter the code”
6/14/23 SS 2023 46
ReadWriteReadWriteReadWriteReadWriteReadWriteRea
• Because of not being willing to change the code, many were forced
to perform the tasks via files
• Don’t do that
6/14/23 SS 2023 47
Dictionary Abuse
• That poor poor Python dictionary it is so
so convenient
• There are many alternatives that are worth learning, like in-memory
databases, data classes, etc…
6/14/23 SS 2023 48