|
| 1 | +# Import libraries |
| 2 | +import matplotlib.pyplot as plt, numpy as np, pandas as pd |
| 3 | + |
| 4 | +# Chip number |
| 5 | +CHIP = 10 |
| 6 | + |
| 7 | +# Load bitstream |
| 8 | +bs = np.loadtxt(open("../bitstream/vectors_bitstream.txt"), dtype=np.int32) |
| 9 | + |
| 10 | +# Load target output as dataframe |
| 11 | +cols = ['addr', 'R'] |
| 12 | +dtypes = { |
| 13 | + 'addr': np.int32, |
| 14 | + 'R': np.float64 |
| 15 | +} |
| 16 | +data = pd.read_csv(f'../log/chip{CHIP}/read.tsv', names=cols, sep='\t', dtype=dtypes, index_col='addr') |
| 17 | +data['bin'] = bs[:len(data)] |
| 18 | + |
| 19 | +# CDF curves |
| 20 | +plt.figure(figsize=(4,3)) |
| 21 | +plt.xlim(5, 1e3) |
| 22 | +plt.xscale('log') |
| 23 | +plt.title('Post-Prog. READ Resistance Dist.') |
| 24 | +for i in range(2): |
| 25 | + rdata = data[data['bin'] == i] |
| 26 | + counts, bin_edges = np.histogram(rdata['R']/1000, bins=65536, density=True) |
| 27 | + cdf = np.cumsum(counts) |
| 28 | + plt.plot(bin_edges[1:], cdf/cdf[-1]*100) |
| 29 | +plt.xlabel('Resistance (kOhm)') |
| 30 | +plt.ylabel('CDF (%)') |
| 31 | +plt.tight_layout() |
| 32 | +plt.savefig('figs/progread-cdf.pdf') |
| 33 | + |
| 34 | +plt.figure(figsize=(4,3)) |
| 35 | +plt.xlim(0, 150) |
| 36 | +plt.title('Post-Prog. READ Conductance Dist.') |
| 37 | +for i in range(2): |
| 38 | + rdata = data[data['bin'] == i] |
| 39 | + counts, bin_edges = np.histogram(1e6/rdata['R'], bins=65536, density=True) |
| 40 | + cdf = np.cumsum(counts) |
| 41 | + plt.plot(bin_edges[1:], cdf/cdf[-1]*100) |
| 42 | +plt.xlabel('Conductance (uS)') |
| 43 | +plt.ylabel('CDF (%)') |
| 44 | +plt.tight_layout() |
| 45 | +plt.savefig('figs/progread-g-cdf.pdf') |
0 commit comments