added support for plotting and fitting power

This commit is contained in:
mmasserfrye 2022-05-18 17:01:55 +00:00
parent f8722f04f9
commit 84422f3859
5 changed files with 101 additions and 78 deletions

View File

@ -361,7 +361,7 @@ module ppa_decoder #(parameter WIDTH = 8) (
end
endmodule
module ppa_mux2 #(parameter WIDTH = 8) (
module ppa_mux2_1 #(parameter WIDTH = 1) (
input logic [WIDTH-1:0] d0, d1,
input logic s,
output logic [WIDTH-1:0] y);

View File

@ -1,4 +1,5 @@
#!/usr/bin/python3
from distutils.log import error
import subprocess
import csv
import re
@ -6,6 +7,7 @@ import matplotlib.pyplot as plt
import matplotlib.lines as lines
import numpy as np
def getData():
bashCommand = "grep 'Critical Path Length' runs/ppa_*/reports/*qor*"
outputCPL = subprocess.check_output(['bash','-c', bashCommand])
@ -15,20 +17,28 @@ def getData():
outputDA = subprocess.check_output(['bash','-c', bashCommand])
linesDA = outputDA.decode("utf-8").split('\n')[:-1]
bashCommand = "grep '100' runs/ppa_*/reports/*power*"
outputP = subprocess.check_output(['bash','-c', bashCommand])
linesP = outputP.decode("utf-8").split('\n')[:-1]
cpl = re.compile('\d{1}\.\d{6}')
f = re.compile('_\d*_MHz')
wm = re.compile('ppa_\w*_\d*_qor')
da = re.compile('\d*\.\d{6}')
p = re.compile('\d+\.\d+[e-]*\d+')
allSynths = []
for i in range(len(linesCPL)):
line = linesCPL[i]
mwm = wm.findall(line)[0][4:-4].split('_')
power = p.findall(linesP[i])
oneSynth = [mwm[0], int(mwm[1])]
oneSynth += [int(f.findall(line)[0][1:-4])]
oneSynth += [float(cpl.findall(line)[0])]
oneSynth += [float(da.findall(linesDA[i])[0])]
oneSynth += [float(power[1])]
oneSynth += [float(power[2])]
allSynths += [oneSynth]
return allSynths
@ -38,9 +48,17 @@ def getVals(module, freq, var):
if (var == 'delay'):
ind = 3
units = " (ps)"
else:
elif (var == 'area'):
ind = 4
units = " (square microns)"
units = " (sq microns)"
elif (var == 'dpower'):
ind = 5
units = " (mW)"
elif (var == 'lpower'):
ind = 6
units = " (nW)"
else:
error
widths = []
ivar = []
@ -53,7 +71,7 @@ def getVals(module, freq, var):
def writeCSV(allSynths):
file = open("ppaData.csv", "w")
writer = csv.writer(file)
writer.writerow(['Module', 'Width', 'Target Freq', 'Delay', 'Area'])
writer.writerow(['Module', 'Width', 'Target Freq', 'Delay', 'Area', 'D Power (mW)', 'L Power (nW)'])
for one in allSynths:
writer.writerow(one)
@ -118,6 +136,8 @@ def makePlots(mod):
plotPPA(mod, 5000, 'delay')
plotPPA(mod, 5000, 'area')
plotPPA(mod, 10, 'area')
plotPPA(mod, 5000, 'lpower')
plotPPA(mod, 5000, 'dpower')
def regress(widths, var):
@ -136,9 +156,9 @@ def regress(widths, var):
def makeCoefTable():
file = open("ppaFitting.csv", "w")
writer = csv.writer(file)
writer.writerow(['Module', 'Variable', 'Freq', '1', 'N', 'log(N)', 'Nlog(N)', 'R^2'])
writer.writerow(['Module', 'Metric', 'Freq', '1', 'N', 'log(N)', 'Nlog(N)', 'R^2'])
for mod in ['add', 'mult', 'comparator']:
for mod in ['add', 'mult', 'comparator', 'shifter']:
for comb in [['delay', 5000], ['area', 5000], ['area', 10]]:
var = comb[0]
freq = comb[1]
@ -155,5 +175,5 @@ writeCSV(allSynths)
makePlots('shifter')
# makeCoefTable()
makeCoefTable()

View File

@ -1,67 +1,67 @@
Module,Width,Target Freq,Delay,Area
add,128,10,7.100851,1867.879976
add,128,5000,0.389771,7007.980119
add,16,10,2.032906,221.479998
add,16,4000,0.249839,551.74001
add,16,5000,0.228259,924.140017
add,16,6000,0.225754,1120.140018
add,32,10,4.160501,456.679995
add,32,4000,0.280842,1730.680031
add,32,5000,0.2505,1933.540033
add,32,6000,0.271774,1746.36003
add,64,10,8.474034,927.079988
add,64,4000,0.323267,3758.300065
add,64,5000,0.334061,3798.480071
add,64,6000,0.328457,3749.480066
add,8,10,0.940062,103.879999
add,8,5000,0.199689,197.960003
comparator,128,10,0.842074,1997.240039
comparator,128,5000,0.260142,5215.56005
comparator,16,10,0.576329,252.840005
comparator,16,4000,0.249312,280.280005
comparator,16,5000,0.199026,313.600006
comparator,16,6000,0.166568,422.380007
comparator,32,10,0.765874,495.88001
comparator,32,4000,0.24995,608.580012
comparator,32,5000,0.205372,919.240014
comparator,32,6000,0.2012,1248.520016
comparator,64,10,0.561562,1008.42002
comparator,64,4000,0.249905,1437.660027
comparator,64,5000,0.219296,2738.120023
comparator,64,6000,0.221138,2341.220025
comparator,8,10,0.29577,118.580002
comparator,8,5000,0.195502,129.360003
mult,128,10,9.334627,180734.540854
mult,128,5000,1.78322,314617.244472
mult,16,10,4.730546,3869.040009
mult,16,4000,0.821111,9132.620147
mult,16,5000,0.820059,9583.420143
mult,16,6000,0.831308,8594.600132
mult,32,10,7.575772,12412.680067
mult,32,4000,1.091389,31262.980534
mult,32,5000,1.092153,31497.200524
mult,32,6000,1.084816,33519.920555
mult,64,10,4.7933,46798.920227
mult,64,4000,1.411752,93087.261425
mult,64,5000,1.404875,94040.801492
mult,64,6000,1.415466,89931.661403
mult,8,10,2.076433,1009.399998
mult,8,5000,0.552339,4261.040075
shifter,128,10,2.577935,8113.420158
shifter,128,5000,0.395847,16602.180268
shifter,16,10,0.0,0.0
shifter,16,10,0.0,0.0
shifter,32,10,1.906335,1656.200032
shifter,32,10,1.906335,1656.200032
shifter,32,10,1.906335,1656.200032
shifter,32,4000,0.260606,3490.760054
shifter,32,4000,0.260606,3490.760054
shifter,32,4000,0.260606,3490.760054
shifter,32,5000,0.238962,4985.260077
shifter,32,5000,0.238962,4985.260077
shifter,32,5000,0.238962,4985.260077
shifter,32,6000,0.241742,4312.000069
shifter,32,6000,0.241742,4312.000069
shifter,32,6000,0.241742,4312.000069
shifter,8,10,0.0,0.0
shifter,8,5000,0.0,0.0
Module,Width,Target Freq,Delay,Area,D Power (mW),L Power (nW)
add,128,10,7.100851,1867.879976,0.00501,465.925
add,128,5000,0.389771,7007.980119,3.309,2.77
add,16,10,2.032906,221.479998,0.000575,55.29
add,16,4000,0.249839,551.74001,0.239,302.479
add,16,5000,0.228259,924.140017,0.519,641.631
add,16,6000,0.225754,1120.140018,0.739,1.01
add,32,10,4.160501,456.679995,0.00118,112.161
add,32,4000,0.280842,1730.680031,0.735,849.828
add,32,5000,0.2505,1933.540033,1.049,1.03
add,32,6000,0.271774,1746.36003,1.138,955.901
add,64,10,8.474034,927.079988,0.00246,230.083
add,64,4000,0.323267,3758.300065,1.523,1.75
add,64,5000,0.334061,3798.480071,1.917,2.18
add,64,6000,0.328457,3749.480066,2.346,1.77
add,8,10,0.940062,103.879999,0.000241,24.765
add,8,5000,0.199689,197.960003,0.113,83.576
comparator,128,10,0.842074,1997.240039,0.00087,243.506
comparator,128,5000,0.260142,5215.56005,3.708,6.0
comparator,16,10,0.576329,252.840005,0.000144,31.402
comparator,16,4000,0.249312,280.280005,0.0581,55.248
comparator,16,5000,0.199026,313.600006,0.0859,78.893
comparator,16,6000,0.166568,422.380007,0.255,301.506
comparator,32,10,0.765874,495.88001,0.000226,66.41
comparator,32,4000,0.24995,608.580012,0.168,130.613
comparator,32,5000,0.205372,919.240014,0.43,840.47
comparator,32,6000,0.2012,1248.520016,0.928,1.48
comparator,64,10,0.561562,1008.42002,0.000449,127.626
comparator,64,4000,0.249905,1437.660027,0.462,558.66
comparator,64,5000,0.219296,2738.120023,1.989,2.95
comparator,64,6000,0.221138,2341.220025,1.343,2.59
comparator,8,10,0.29577,118.580002,6.83e-05,16.053
comparator,8,5000,0.195502,129.360003,0.0358,21.443
mult,128,10,9.334627,180734.540854,0.428,1.8
mult,128,5000,1.78322,314617.244472,997.34,1.63
mult,16,10,4.730546,3869.040009,0.0107,641.517
mult,16,4000,0.821111,9132.620147,14.407,8.03
mult,16,5000,0.820059,9583.420143,20.175,8.5
mult,16,6000,0.831308,8594.600132,21.106,7.15
mult,32,10,7.575772,12412.680067,0.0229,1.18
mult,32,4000,1.091389,31262.980534,65.471,2.49
mult,32,5000,1.092153,31497.200524,79.554,2.58
mult,32,6000,1.084816,33519.920555,103.798,2.91
mult,64,10,4.7933,46798.920227,0.103,5.46
mult,64,4000,1.411752,93087.261425,227.876,6.05
mult,64,5000,1.404875,94040.801492,298.667,6.16
mult,64,6000,1.415466,89931.661403,337.302,5.63
mult,8,10,2.076433,1009.399998,0.00206,211.637
mult,8,5000,0.552339,4261.040075,5.543,5.05
mux2,1,10,0.060639,6.86,5.15e-06,1.19
mux2,1,10,0.060639,6.86,5.15e-06,1.19
shifter,128,10,2.758726,9722.580189,0.00789,720.698
shifter,128,5000,0.401118,19106.080347,6.94,1.23
shifter,16,10,1.237745,681.100013,0.000441,52.029
shifter,16,5000,0.209586,2120.720031,1.025,2.15
shifter,32,10,1.906335,1656.200032,0.00115,118.773
shifter,32,4000,0.260606,3490.760054,1.282,2.57
shifter,32,4000,0.260606,3490.760054,1.282,2.57
shifter,32,4000,0.260606,3490.760054,1.282,2.57
shifter,32,5000,0.238962,4985.260077,2.489,4.9
shifter,32,6000,0.241742,4312.000069,2.411,3.71
shifter,32,6000,0.241742,4312.000069,2.411,3.71
shifter,32,6000,0.241742,4312.000069,2.411,3.71
shifter,64,10,2.919486,4346.300085,0.00297,210.734
shifter,64,5000,0.358993,9471.700156,4.518,6.94
shifter,8,10,0.622998,244.020005,0.00019,26.943
shifter,8,5000,0.198885,495.88001,0.285,300.128

1 Module Width Target Freq Delay Area D Power (mW) L Power (nW)
2 add 128 10 7.100851 1867.879976 0.00501 465.925
3 add 128 5000 0.389771 7007.980119 3.309 2.77
4 add 16 10 2.032906 221.479998 0.000575 55.29
5 add 16 4000 0.249839 551.74001 0.239 302.479
6 add 16 5000 0.228259 924.140017 0.519 641.631
7 add 16 6000 0.225754 1120.140018 0.739 1.01
8 add 32 10 4.160501 456.679995 0.00118 112.161
9 add 32 4000 0.280842 1730.680031 0.735 849.828
10 add 32 5000 0.2505 1933.540033 1.049 1.03
11 add 32 6000 0.271774 1746.36003 1.138 955.901
12 add 64 10 8.474034 927.079988 0.00246 230.083
13 add 64 4000 0.323267 3758.300065 1.523 1.75
14 add 64 5000 0.334061 3798.480071 1.917 2.18
15 add 64 6000 0.328457 3749.480066 2.346 1.77
16 add 8 10 0.940062 103.879999 0.000241 24.765
17 add 8 5000 0.199689 197.960003 0.113 83.576
18 comparator 128 10 0.842074 1997.240039 0.00087 243.506
19 comparator 128 5000 0.260142 5215.56005 3.708 6.0
20 comparator 16 10 0.576329 252.840005 0.000144 31.402
21 comparator 16 4000 0.249312 280.280005 0.0581 55.248
22 comparator 16 5000 0.199026 313.600006 0.0859 78.893
23 comparator 16 6000 0.166568 422.380007 0.255 301.506
24 comparator 32 10 0.765874 495.88001 0.000226 66.41
25 comparator 32 4000 0.24995 608.580012 0.168 130.613
26 comparator 32 5000 0.205372 919.240014 0.43 840.47
27 comparator 32 6000 0.2012 1248.520016 0.928 1.48
28 comparator 64 10 0.561562 1008.42002 0.000449 127.626
29 comparator 64 4000 0.249905 1437.660027 0.462 558.66
30 comparator 64 5000 0.219296 2738.120023 1.989 2.95
31 comparator 64 6000 0.221138 2341.220025 1.343 2.59
32 comparator 8 10 0.29577 118.580002 6.83e-05 16.053
33 comparator 8 5000 0.195502 129.360003 0.0358 21.443
34 mult 128 10 9.334627 180734.540854 0.428 1.8
35 mult 128 5000 1.78322 314617.244472 997.34 1.63
36 mult 16 10 4.730546 3869.040009 0.0107 641.517
37 mult 16 4000 0.821111 9132.620147 14.407 8.03
38 mult 16 5000 0.820059 9583.420143 20.175 8.5
39 mult 16 6000 0.831308 8594.600132 21.106 7.15
40 mult 32 10 7.575772 12412.680067 0.0229 1.18
41 mult 32 4000 1.091389 31262.980534 65.471 2.49
42 mult 32 5000 1.092153 31497.200524 79.554 2.58
43 mult 32 6000 1.084816 33519.920555 103.798 2.91
44 mult 64 10 4.7933 46798.920227 0.103 5.46
45 mult 64 4000 1.411752 93087.261425 227.876 6.05
46 mult 64 5000 1.404875 94040.801492 298.667 6.16
47 mult 64 6000 1.415466 89931.661403 337.302 5.63
48 mult 8 10 2.076433 1009.399998 0.00206 211.637
49 mult 8 5000 0.552339 4261.040075 5.543 5.05
50 shifter mux2 128 1 10 2.577935 0.060639 8113.420158 6.86 5.15e-06 1.19
51 shifter mux2 128 1 5000 10 0.395847 0.060639 16602.180268 6.86 5.15e-06 1.19
52 shifter 16 128 10 0.0 2.758726 0.0 9722.580189 0.00789 720.698
53 shifter 16 128 10 5000 0.0 0.401118 0.0 19106.080347 6.94 1.23
54 shifter 32 16 10 1.906335 1.237745 1656.200032 681.100013 0.000441 52.029
55 shifter 32 16 10 5000 1.906335 0.209586 1656.200032 2120.720031 1.025 2.15
56 shifter 32 10 1.906335 1656.200032 0.00115 118.773
57 shifter 32 4000 0.260606 3490.760054 1.282 2.57
58 shifter 32 4000 0.260606 3490.760054 1.282 2.57
59 shifter 32 4000 0.260606 3490.760054 1.282 2.57
60 shifter 32 5000 0.238962 4985.260077 2.489 4.9
61 shifter 32 5000 6000 0.238962 0.241742 4985.260077 4312.000069 2.411 3.71
62 shifter 32 5000 6000 0.238962 0.241742 4985.260077 4312.000069 2.411 3.71
63 shifter 32 6000 0.241742 4312.000069 2.411 3.71
64 shifter 32 64 6000 10 0.241742 2.919486 4312.000069 4346.300085 0.00297 210.734
65 shifter 32 64 6000 5000 0.241742 0.358993 4312.000069 9471.700156 4.518 6.94
66 shifter 8 10 0.0 0.622998 0.0 244.020005 0.00019 26.943
67 shifter 8 5000 0.0 0.198885 0.0 495.88001 0.285 300.128

View File

@ -1,4 +1,4 @@
Module,Variable,Freq,1,N,log(N),Nlog(N),R^2
Module,Metric,Freq,1,N,log(N),Nlog(N),R^2
add,delay,5000,0.23935453005464438,0.015973094945355207,-0.058207695467226296,-0.002593789781151714,0.9902532112478974
add,area,5000,-1032.1274349672115,64.4386855922132,374.6678949053879,-3.2579193244904823,0.9999180068922152
add,area,10,-13.720004131149423,14.699999256147343,3.6067390521177815e-06,9.312480709428003e-08,1.0
@ -8,3 +8,6 @@ mult,area,10,-24112.991162714883,-8735.874000034026,30452.017533199683,1892.3032
comparator,delay,5000,0.18302939890710385,-0.001793523907103751,0.00950014684425352,0.0004195522734073458,0.9999387049502957
comparator,area,5000,1831.2076391201958,303.59984869227907,-1617.4342555852443,-44.475154143873425,0.9990603962758624
comparator,area,10,-0.23027509289593326,18.299023530396347,-8.48304611908023,-0.4881808064440773,0.9999674500675539
shifter,delay,5000,0.4107033934426204,0.03923479405737683,-0.19848886911558317,-0.006549393512462493,0.989283342171845
shifter,area,5000,-3612.7138133224103,-65.6549821150965,1929.186263038338,35.02443853718661,0.9998392000511572
shifter,area,10,806.0687632950834,120.52125970491868,-682.1783666753405,-5.1440062238735225,0.9998176364985187

1 Module Variable Metric Freq 1 N log(N) Nlog(N) R^2
2 add delay 5000 0.23935453005464438 0.015973094945355207 -0.058207695467226296 -0.002593789781151714 0.9902532112478974
3 add area 5000 -1032.1274349672115 64.4386855922132 374.6678949053879 -3.2579193244904823 0.9999180068922152
4 add area 10 -13.720004131149423 14.699999256147343 3.6067390521177815e-06 9.312480709428003e-08 1.0
8 comparator delay 5000 0.18302939890710385 -0.001793523907103751 0.00950014684425352 0.0004195522734073458 0.9999387049502957
9 comparator area 5000 1831.2076391201958 303.59984869227907 -1617.4342555852443 -44.475154143873425 0.9990603962758624
10 comparator area 10 -0.23027509289593326 18.299023530396347 -8.48304611908023 -0.4881808064440773 0.9999674500675539
11 shifter delay 5000 0.4107033934426204 0.03923479405737683 -0.19848886911558317 -0.006549393512462493 0.989283342171845
12 shifter area 5000 -3612.7138133224103 -65.6549821150965 1929.186263038338 35.02443853718661 0.9998392000511572
13 shifter area 10 806.0687632950834 120.52125970491868 -682.1783666753405 -5.1440062238735225 0.9998176364985187

View File

@ -14,9 +14,9 @@ def deleteRedundant(LoT):
bashCommand = synthStr.format(*synth)
outputCPL = subprocess.check_output(['bash','-c', bashCommand])
widths = ['8', '16', '32', '64', '128']
modules = ['shifter']
freqs = ['10', '5000']
widths = ['1']
modules = ['mux2']
freqs = ['10']
tech = 'sky90'