-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript_HDA_results.py
40 lines (32 loc) · 1.28 KB
/
script_HDA_results.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from Autorepeat import *
Algs = [ber2, lambda x: ber_with_parities(x,N=1),lambda x: ber_with_parities(x,N=2),lambda x: ber_with_parities(x,N=4),lambda x: ber_with_parities(x,N=8),SECDED_ALG,SECDED_ML,HASH]
Labels = ["WITHOUT_HDA","1PCK","2PCK","4PCK","8PCK","SECDED_ALG","SECDED_ML","SHA256"]
MOD = ["CB","SQRT"]
TEMP = [30,40,50,60]
BOARDS = 1+np.arange(5)
PUFS = np.arange(16)
PINS = np.arange(8)
for mod in MOD:
for temp in TEMP:
it=-1
for HDA in Algs:
it+=1
alg_label = Labels[it]
cpath = f"HDA_RESULTS/{mod}/{temp}C/{alg_label}/"
if not os.path.exists(cpath):
os.makedirs(cpath)
KER,BER = [],[]
for board in BOARDS:
for puf in PUFS:
for pins in PINS:
df = read_temp(temp,board,puf,pins,mod)
_,ber,_,ker = HDA(df)
KER.append(ker)
BER.append(ber)
print(KER)
print(BER)
print("Saving Results : " + cpath + "...")
with open(cpath+"KER.npy","wb") as f:
np.save(f,KER)
with open(cpath+"BER.npy","wb") as f:
np.save(f,BER)