# Compute your own PS3 Cell Yield!

Here is a little Python script, that I wrote to compute yields for the PS3’s Cell chip on a 300mm wafer with different defect rates, depending on the number of SPEs required to be intact…

```#!/usr/bin/env python

from Numeric import *
import random

num_wavers = 100 # average over this many wavers

wafer_size = (300.0, 300.0) # mm (diameter, but we'll assume a square of that size)
die_size = (12.28, 18.0) # mm
spe_size = (5.81, 2.5) # mm

defect_rate = 0.4 # per cm^2

spe_columns = 2
spe_rows = 4
num_spes = spe_columns * spe_rows

dies_per_row = int(wafer_size / die_size)
dies_per_column = int(wafer_size / die_size)

working_spes = zeros((num_spes + 1,), Int)

for waver in range(num_wavers):
defect_table = zeros((dies_per_column, dies_per_row, 1 + num_spes), Int8)

num_defects = int((wafer_size * wafer_size) / 100.0 * defect_rate)
for d in range(num_defects):
x = random.uniform(0.0, wafer_size)
y = random.uniform(0.0, wafer_size)
column = int(x / die_size)
row = int(y / die_size)
if (column < dies_per_column) and (row < dies_per_row): # this could be false on the last die in each row / column
x -= column * die_size # position within the die
y -= row * die_size
if (x < spe_columns * spe_size) and (y < spe_rows * spe_size):
# we've hit an SPE
spe_index = int(y / spe_size) * spe_columns + int(x / spe_size)
defect_table[column][row][1 + spe_index] = True
else:
# we've hit another part of the die and the whole thing is broken
defect_table[column][row] = True

# now go through the table and sum the results
for y in range(dies_per_row):
for x in range(dies_per_column):
if (defect_table[x][y]):