forked from Github_Repos/cvw
fixed importing of area-optimized synths, overlayed them on PPA plots, accounted for mux outliers, fixed flop adjustments
This commit is contained in:
parent
411243f335
commit
659449256a
@ -1,101 +1,101 @@
|
||||
Module,Tech,Width,Target Freq,Delay,Area,L Power (nW),D energy (fJ)
|
||||
priorityencoder,sky90,8,7994,0.12495900000000001,60.760001,44.346,13.420596600000001
|
||||
priorityencoder,sky90,16,5753,0.16977,136.220003,77.243,21.255203999999996
|
||||
priorityencoder,sky90,32,4776,0.20887,379.260006,246.78,50.066139
|
||||
priorityencoder,sky90,64,4096,0.244022,794.780014,364.853,72.718556
|
||||
priorityencoder,sky90,128,3409,0.293333,1602.300031,610.009,126.13319000000001
|
||||
add,sky90,8,3652,0.27337,245.000005,139.276,101.69364
|
||||
add,sky90,16,2931,0.339912,623.280012,352.919,268.53048
|
||||
add,sky90,32,2420,0.413219,1330.840024,582.809,520.65594
|
||||
add,sky90,64,2139,0.467468,2781.240054,1050.0,939.143212
|
||||
add,sky90,128,1885,0.5304949999999999,6186.740118,2230.0,2147.974254999999
|
||||
csa,sky90,8,5984,0.166714,306.740006,227.761,164.046576
|
||||
csa,sky90,16,5984,0.165225,588.000011,322.135,321.1974
|
||||
csa,sky90,32,5740,0.166714,1160.320023,826.559,570.495308
|
||||
csa,sky90,64,5984,0.165225,2469.600048,1440.0,1354.3493250000001
|
||||
csa,sky90,128,5984,0.165225,4897.060095,2990.0,2649.0524250000003
|
||||
shiftleft,sky90,8,4321,0.23109,250.880004,181.951,70.25136
|
||||
shiftleft,sky90,16,3355,0.29804,666.400006,558.433,195.51424
|
||||
priorityencoder,sky90,8,7994,0.12495882036527395,60.760001,44.346,13.42057730723042
|
||||
priorityencoder,sky90,16,5761,0.16976997552508244,136.220003,77.243,21.28915493084534
|
||||
priorityencoder,sky90,32,4776,0.20887023450586265,379.260006,246.78,50.06619521105528
|
||||
priorityencoder,sky90,64,4096,0.244021625,794.780014,364.853,72.71844425000002
|
||||
priorityencoder,sky90,128,3409,0.2933331557641537,1602.300031,610.009,126.1332569785861
|
||||
add,sky90,8,3652,0.2733695629791895,245.000005,139.276,101.6934774282585
|
||||
add,sky90,16,2931,0.33991248447628797,623.280012,352.919,268.5308627362675
|
||||
add,sky90,32,2420,0.4132191404958678,1330.840024,582.809,520.6561170247934
|
||||
add,sky90,64,2139,0.4674681813931744,2781.240054,1050.0,939.1435764188874
|
||||
add,sky90,128,1885,0.5304949787798409,6186.740118,2230.0,2147.9741690795754
|
||||
csa,sky90,8,5740,0.16671402787456446,290.080006,207.654,143.04063591637635
|
||||
csa,sky90,16,5984,0.16522529946524064,588.000011,322.135,321.19798216042784
|
||||
csa,sky90,32,5740,0.16671402787456446,1160.320023,826.559,570.4954033867597
|
||||
csa,sky90,64,5984,0.16522529946524064,2469.600048,1440.0,1354.3517797165773
|
||||
csa,sky90,128,5984,0.16522529946524064,4897.060095,2990.0,2649.0572263262034
|
||||
shiftleft,sky90,8,4321,0.23108991020597083,250.880004,181.951,70.25133270261513
|
||||
shiftleft,sky90,16,3355,0.29803959314456036,666.400006,558.433,195.51397310283156
|
||||
shiftleft,sky90,32,2500,0.39945200000000003,1400.420023,738.137,368.29474400000004
|
||||
shiftleft,sky90,64,2203,0.453859,3914.120062,2680.0,1144.632398
|
||||
shiftleft,sky90,128,1907,0.5242939999999999,9192.400136,6080.0,2900.3944079999997
|
||||
comparator,sky90,8,4829,0.206669,198.940004,136.459,48.567215
|
||||
comparator,sky90,16,4014,0.24886599999999998,355.740006,188.666,62.714231999999996
|
||||
comparator,sky90,32,3596,0.27763899999999997,697.760013,316.793,109.389766
|
||||
comparator,sky90,64,3129,0.319542,1372.980026,508.393,204.826422
|
||||
comparator,sky90,128,2682,0.37267500000000003,2836.120055,772.571,463.6077000000001
|
||||
flop,sky90,8,7708,0.11434399999999999,133.279999,129.629,341.2939712
|
||||
flop,sky90,16,7708,0.11434399999999999,266.5599975,259.258,682.4049919999999
|
||||
flop,sky90,32,7708,0.11434399999999999,533.119995,518.516,1364.69564
|
||||
flop,sky90,64,8396,0.114344,1066.23999,1040.0,2972.829656
|
||||
flop,sky90,128,8396,0.114344,2132.4799805,2070.0,5945.087592
|
||||
mux2,sky90,8,5280,0.188723,63.700001,23.506,19.4762136
|
||||
mux2,sky90,16,4815,0.202073,119.560002,32.354,37.7674437
|
||||
mux2,sky90,32,4950,0.199897,374.360008,259.372,135.530166
|
||||
mux2,sky90,64,4060,0.245667,514.50001,165.954,163.614222
|
||||
mux2,sky90,128,4004,0.249748,1302.420025,767.078,466.52926399999996
|
||||
mux4,sky90,8,4655,0.214552,159.740002,86.462,42.0307368
|
||||
mux4,sky90,16,4452,0.223139,392.0,398.313,103.090218
|
||||
mux4,sky90,32,3802,0.262263,465.500009,150.568,139.26165300000002
|
||||
mux4,sky90,64,3699,0.269517,877.100017,304.149,274.90734
|
||||
mux4,sky90,128,3166,0.31572500000000003,1984.500039,725.267,569.5679000000001
|
||||
mux8,sky90,8,3577,0.27891699999999997,287.140006,116.648,60.831797699999996
|
||||
mux8,sky90,16,3419,0.29151,588.000006,280.193,150.71067
|
||||
mux8,sky90,32,3155,0.314651,1237.740008,639.983,323.14657700000004
|
||||
mux8,sky90,64,3020,0.330329,2207.940042,730.503,445.613821
|
||||
mux8,sky90,128,2666,0.37501399999999996,3761.240072,1460.0,854.281892
|
||||
mult,sky90,8,1310,0.7631560000000001,2194.220041,1440.0,1420.996472
|
||||
mult,sky90,16,997,1.002926,7519.540137,4940.0,6375.600582
|
||||
mult,sky90,32,763,1.310613,25200.700446,14900.0,24931.791099000002
|
||||
mult,sky90,64,632,1.5822660000000002,86011.661365,42600.0,88845.818166
|
||||
mult,sky90,128,524,1.9083759999999999,296198.144128,114000.0,273311.88559200004
|
||||
priorityencoder,tsmc28,8,31306,0.031913,8.316,34.836,1.7137280999999998
|
||||
priorityencoder,tsmc28,16,21202,0.047050999999999996,21.294,73.912,3.8158361
|
||||
priorityencoder,tsmc28,32,16453,0.06074,62.118,205.801,9.438996
|
||||
priorityencoder,tsmc28,64,13786,0.07244400000000001,137.088001,428.365,18.328332000000003
|
||||
priorityencoder,tsmc28,128,11439,0.087412,315.252,980.365,40.908816
|
||||
add,tsmc28,8,13787,0.072267,33.012,176.194,12.328750199999996
|
||||
add,tsmc28,16,11520,0.08680199999999999,90.972001,475.452,33.679176
|
||||
add,tsmc28,32,9810,0.101918,209.286002,1060.0,81.43248200000001
|
||||
add,tsmc28,64,8203,0.121869,392.616003,1800.0,142.34299200000004
|
||||
add,tsmc28,128,7210,0.138694,868.140006,4090.0,331.33996600000006
|
||||
csa,tsmc28,8,23865,0.040776,49.392,473.393,20.918088
|
||||
csa,tsmc28,16,23865,0.040776,98.783999,946.879,41.75462400000001
|
||||
csa,tsmc28,32,23865,0.040776,197.567999,1890.0,83.305368
|
||||
csa,tsmc28,64,23865,0.040776,395.135998,3790.0,166.52918400000001
|
||||
csa,tsmc28,128,23865,0.040776,790.271996,7570.0,333.099144
|
||||
shiftleft,tsmc28,8,15183,0.06578,48.384,333.876,15.517502
|
||||
shiftleft,tsmc28,16,11800,0.084718,130.788,613.549,33.717764
|
||||
shiftleft,tsmc28,32,9587,0.104304,384.803997,1940.0,101.800704
|
||||
shiftleft,tsmc28,64,8269,0.120883,967.427998,4980.0,272.8329309999999
|
||||
shiftleft,tsmc28,128,7023,0.14238299999999998,1836.953994,8670.0,566.541957
|
||||
comparator,tsmc28,8,17054,0.058548,32.256,160.477,8.752925999999999
|
||||
comparator,tsmc28,16,13709,0.07280299999999999,48.132,204.944,11.8523284
|
||||
comparator,tsmc28,32,12136,0.082381,146.16,623.674,35.506211
|
||||
comparator,tsmc28,64,10862,0.09205799999999999,291.312,1240.0,69.41173199999999
|
||||
comparator,tsmc28,128,9371,0.106711,558.432,2400.0,127.946489
|
||||
flop,tsmc28,8,19458,0.048892,15.12,157.268,51.8450768
|
||||
flop,tsmc28,16,19226,0.048892,30.24,314.578,102.39940480000001
|
||||
flop,tsmc28,32,20286,0.048892,60.4799995,629.157,216.053748
|
||||
flop,tsmc28,64,20286,0.048892,120.959999,1260.0,432.107496
|
||||
flop,tsmc28,128,20286,0.048892,241.919998,2520.0,864.1661
|
||||
mux2,tsmc28,8,29634,0.033745,16.758,114.564,5.436319499999999
|
||||
mux2,tsmc28,16,19150,0.052219,15.75,88.448,5.1592372
|
||||
mux2,tsmc28,32,17903,0.055855999999999996,32.130001,171.146,9.897683199999998
|
||||
mux2,tsmc28,64,18546,0.053857,90.846,517.414,27.359356000000002
|
||||
mux2,tsmc28,128,16594,0.060106,184.968,1150.0,58.603350000000006
|
||||
mux4,tsmc28,8,18130,0.055091999999999995,27.971999,133.963,8.0213952
|
||||
mux4,tsmc28,16,16440,0.060656,39.438,185.149,12.373824000000003
|
||||
mux4,tsmc28,32,15168,0.065805,69.174,324.969,23.229165
|
||||
mux4,tsmc28,64,13915,0.071806,137.465999,648.086,45.59681
|
||||
mux4,tsmc28,128,13089,0.07639599999999999,296.603997,1440.0,94.501852
|
||||
mux8,tsmc28,8,12885,0.07751,44.856,215.13,11.905536000000001
|
||||
mux8,tsmc28,16,12256,0.081543,121.841998,521.624,25.930674
|
||||
mux8,tsmc28,32,11695,0.085374,168.21,815.694,46.35808200000001
|
||||
mux8,tsmc28,64,11000,0.090793,304.037999,1490.0,81.895286
|
||||
mux8,tsmc28,128,10464,0.095475,664.775992,2850.0,153.04642500000003
|
||||
mult,tsmc28,8,5091,0.196425,516.222001,3840.0,342.95804999999996
|
||||
mult,tsmc28,16,3819,0.261843,1634.472002,11800.0,1455.3233939999998
|
||||
mult,tsmc28,32,2973,0.33635600000000004,5141.430011,36900.0,5416.340668
|
||||
mult,tsmc28,64,2390,0.41840900000000003,16045.092071,109000.0,18545.978925000003
|
||||
mult,tsmc28,128,1868,0.535328,44272.49428,262000.0,50011.412416
|
||||
shiftleft,sky90,64,2203,0.45385946391284615,3914.120062,2680.0,1144.633567988198
|
||||
shiftleft,sky90,128,1907,0.5242938489774515,9192.400136,6080.0,2900.3935725432616
|
||||
comparator,sky90,8,4829,0.2066692116380203,198.940004,136.459,48.56726473493477
|
||||
comparator,sky90,16,4014,0.24886605181863478,355.740006,188.666,62.714245058295965
|
||||
comparator,sky90,32,3596,0.27763876307007784,697.760013,316.793,109.38967264961067
|
||||
comparator,sky90,64,3129,0.31954192361776923,1372.980026,508.393,204.82637303899006
|
||||
comparator,sky90,128,2682,0.37267507755406415,2836.120055,772.571,463.6077964772558
|
||||
flop,sky90,8,10,0.1143419999999935,133.279999,64.8145,0.22163481569998741
|
||||
flop,sky90,16,10,0.1143419999999935,266.5599975,129.629,0.4426750529999749
|
||||
flop,sky90,32,10,0.1143419999999935,533.119995,259.258,0.88306326599995
|
||||
flop,sky90,64,10,0.1143419999999935,1066.23999,520.0,1.7717864609998994
|
||||
flop,sky90,128,10,0.1143419999999935,2132.4799805,1035.0,3.537741479999799
|
||||
mux2,sky90,8,5280,0.1887229393939394,63.700001,23.506,19.476207345454547
|
||||
mux2,sky90,16,4815,0.20207331983385254,119.560002,32.354,37.76750347694705
|
||||
mux2,sky90,32,5049,0.21904002158843336,237.160005,57.793,84.98752837631214
|
||||
mux2,sky90,64,4087,0.2460982481037436,482.160008,124.422,156.51848579398091
|
||||
mux2,sky90,128,3920,0.25878504081632653,955.500018,279.611,313.9062545102041
|
||||
mux4,sky90,8,4655,0.21455177121374866,159.740002,86.462,42.03069198077337
|
||||
mux4,sky90,16,4452,0.22313914914645103,392.0,398.313,103.09028690566036
|
||||
mux4,sky90,32,3802,0.2622634634402946,465.500009,150.568,139.26189908679646
|
||||
mux4,sky90,64,3699,0.2695173360367667,877.100017,304.149,274.9076827575021
|
||||
mux4,sky90,128,3166,0.3157249696778269,1984.500039,725.267,569.5678452987997
|
||||
mux8,sky90,8,3577,0.2789168803466592,287.140006,116.648,60.83177160360637
|
||||
mux8,sky90,16,3419,0.2915101822170225,588.000006,280.193,150.71076420620065
|
||||
mux8,sky90,32,3092,0.33231726520051746,1062.320021,325.058,219.99402956274258
|
||||
mux8,sky90,64,3020,0.33032882781456957,2207.940042,730.503,445.61358872185434
|
||||
mux8,sky90,128,2666,0.37501377344336084,3761.240072,1460.0,854.281375903976
|
||||
mult,sky90,8,1310,0.7631557786259543,2194.220041,1440.0,1420.996059801527
|
||||
mult,sky90,16,997,1.0029260270812437,7519.540137,4940.0,6375.600754155466
|
||||
mult,sky90,32,763,1.3106129895150722,25200.700446,14900.0,24931.79089954522
|
||||
mult,sky90,64,632,1.5822664810126583,86011.661365,42600.0,88845.84517534176
|
||||
mult,sky90,128,524,1.9083759465648855,296198.144128,114000.0,273311.87793918326
|
||||
priorityencoder,tsmc28,8,31306,0.03191275857663067,8.316,34.836,1.713715135565067
|
||||
priorityencoder,tsmc28,16,21202,0.04705136175832468,21.294,73.912,3.815865438600132
|
||||
priorityencoder,tsmc28,32,16453,0.060740189205615996,62.118,205.801,9.439025402552724
|
||||
priorityencoder,tsmc28,64,13786,0.07244435673872045,137.088001,428.365,18.328422254896275
|
||||
priorityencoder,tsmc28,128,11439,0.0874122290410001,315.252,980.365,40.908923191188045
|
||||
add,tsmc28,8,13787,0.07226709545223761,33.012,176.194,12.328766484151734
|
||||
add,tsmc28,16,11520,0.08680155555555555,90.972001,475.452,33.67900355555555
|
||||
add,tsmc28,32,9810,0.1019177991845056,209.286002,1060.0,81.43232154841998
|
||||
add,tsmc28,64,8203,0.12186861952944045,392.616003,1800.0,142.34254761038645
|
||||
add,tsmc28,128,7210,0.13869425520110956,868.140006,4090.0,331.3405756754508
|
||||
csa,tsmc28,8,23865,0.04077636748376283,49.392,473.393,20.91827651917033
|
||||
csa,tsmc28,16,23865,0.04077636748376283,98.783999,946.879,41.75500030337314
|
||||
csa,tsmc28,32,23865,0.04077636748376283,197.567999,1890.0,83.30611876932745
|
||||
csa,tsmc28,64,23865,0.04077636748376283,395.135998,3790.0,166.5306848036874
|
||||
csa,tsmc28,128,23865,0.04077636748376283,790.271996,7570.0,333.1021459748586
|
||||
shiftleft,tsmc28,8,15183,0.06578013640255549,48.384,333.876,15.51753417736284
|
||||
shiftleft,tsmc28,16,11800,0.0847177627118644,130.788,613.549,33.71766955932203
|
||||
shiftleft,tsmc28,32,9587,0.10430391697089808,384.803997,1940.0,101.80062296359652
|
||||
shiftleft,tsmc28,64,8269,0.12088260744951022,967.427998,4980.0,272.83204501354453
|
||||
shiftleft,tsmc28,128,7023,0.14238329232521713,1836.953994,8670.0,566.543120162039
|
||||
comparator,tsmc28,8,17054,0.05854826984871585,32.256,160.477,8.752966342383019
|
||||
comparator,tsmc28,16,13709,0.07280278080093369,48.132,204.944,11.852292714392004
|
||||
comparator,tsmc28,32,12136,0.08238147264337507,146.16,623.674,35.50641470929466
|
||||
comparator,tsmc28,64,10862,0.09205807659731172,291.312,1240.0,69.41178975437303
|
||||
comparator,tsmc28,128,9371,0.10671119720414043,558.432,2400.0,127.9467254477644
|
||||
flop,tsmc28,8,10,0.048889000000002625,15.12,78.6345,0.013320296940000717
|
||||
flop,tsmc28,16,10,0.048889000000002625,30.24,157.29,0.026541838100001425
|
||||
flop,tsmc28,32,10,0.048889000000002625,60.4799995,314.5805,0.05332812120000287
|
||||
flop,tsmc28,64,10,0.048889000000002625,120.959999,630.0,0.10640935295000573
|
||||
flop,tsmc28,128,10,0.048889000000002625,241.919998,1260.0,0.21305826200001143
|
||||
mux2,tsmc28,8,27000,0.04027303703703704,10.332,86.166,4.244778103703704
|
||||
mux2,tsmc28,16,19440,0.052470329218107,15.372,84.373,5.1473392962962965
|
||||
mux2,tsmc28,32,17903,0.05585556035301346,32.130001,171.146,9.897605294553983
|
||||
mux2,tsmc28,64,18546,0.05385698274560552,90.846,517.414,27.359347234767604
|
||||
mux2,tsmc28,128,16594,0.0601057455706882,184.968,1150.0,58.603101931421
|
||||
mux4,tsmc28,8,18130,0.05509219801434087,27.971999,133.963,8.021424030888031
|
||||
mux4,tsmc28,16,16440,0.06065625060827251,39.438,185.149,12.373875124087593
|
||||
mux4,tsmc28,32,15168,0.0658052700421941,69.174,324.969,23.229260324894515
|
||||
mux4,tsmc28,64,13915,0.07180589399928135,137.465999,648.086,45.59674268954365
|
||||
mux4,tsmc28,128,13089,0.07639603056001222,296.603997,1440.0,94.50188980273512
|
||||
mux8,tsmc28,8,12885,0.07750962359332557,44.856,215.13,11.90547818393481
|
||||
mux8,tsmc28,16,12256,0.08154268929503918,121.841998,521.624,25.93057519582246
|
||||
mux8,tsmc28,32,11695,0.08537362676357418,168.21,815.694,46.35787933262078
|
||||
mux8,tsmc28,64,11000,0.0907930909090909,304.037999,1490.0,81.89536799999999
|
||||
mux8,tsmc28,128,10464,0.09547474923547401,664.775992,2850.0,153.04602302446486
|
||||
mult,tsmc28,8,5000,0.19998100000000002,444.150001,3260.0,306.970835
|
||||
mult,tsmc28,16,3819,0.26184265147944485,1634.472002,11800.0,1455.3214569227544
|
||||
mult,tsmc28,32,2973,0.3363555785401951,5141.430011,36900.0,5416.333881232761
|
||||
mult,tsmc28,64,2390,0.4184090418410042,16045.092071,109000.0,18545.980779602512
|
||||
mult,tsmc28,128,1868,0.5353279057815846,44272.49428,262000.0,50011.4036139272
|
||||
|
|
@ -1,7 +1,6 @@
|
||||
#!/usr/bin/python3
|
||||
# Madeleine Masser-Frye mmasserfrye@hmc.edu 5/22
|
||||
|
||||
from operator import index
|
||||
import scipy.optimize as opt
|
||||
import subprocess
|
||||
import csv
|
||||
@ -9,7 +8,6 @@ import re
|
||||
from matplotlib.cbook import flatten
|
||||
import matplotlib.pyplot as plt
|
||||
import matplotlib.lines as lines
|
||||
import matplotlib.axes as axes
|
||||
import numpy as np
|
||||
from collections import namedtuple
|
||||
import sklearn.metrics as skm
|
||||
@ -49,7 +47,7 @@ def synthsintocsv():
|
||||
module, width, risc, tech, freq = specReg.findall(oneSynth)[2:7]
|
||||
tech = tech[:-2]
|
||||
metrics = []
|
||||
for phrase in [['Path Slack', 'qor'], ['Clk Period', 'qor'], ['Design Area', 'qor'], ['100', 'power']]:
|
||||
for phrase in [['Path Slack', 'qor'], ['Design Area', 'qor'], ['100', 'power']]:
|
||||
bashCommand = 'grep "{}" '+ oneSynth[2:]+'/reports/*{}*'
|
||||
bashCommand = bashCommand.format(*phrase)
|
||||
try: output = subprocess.check_output(['bash','-c', bashCommand])
|
||||
@ -59,12 +57,13 @@ def synthsintocsv():
|
||||
nums = metricReg.findall(str(output))
|
||||
nums = [float(m) for m in nums]
|
||||
metrics += nums
|
||||
delay = metrics[1] - metrics[0]
|
||||
area = metrics[2]
|
||||
lpower = metrics[5]
|
||||
denergy = (metrics[3] + metrics[4])*delay*1000 # (switching + internal powers)*delay, more practical units for regression coefs
|
||||
delay = 1000/int(freq) - metrics[0]
|
||||
area = metrics[1]
|
||||
lpower = metrics[4]
|
||||
denergy = (metrics[2] + metrics[3])*delay*1000 # (switching + internal powers)*delay, more practical units for regression coefs
|
||||
|
||||
if ('flop' in module): area = area/2 # since two flops in each module
|
||||
if ('flop' in module): # since two flops in each module
|
||||
[area, lpower, denergy] = [n/2 for n in [area, lpower, denergy]]
|
||||
|
||||
writer.writerow([module, tech, width, freq, delay, area, lpower, denergy])
|
||||
file.close()
|
||||
@ -102,7 +101,6 @@ def getVals(tech, module, var, freq=None):
|
||||
works at a specified target frequency or if none is given, uses the synthesis with the best achievable delay for each width
|
||||
'''
|
||||
|
||||
global widths
|
||||
metric = []
|
||||
widthL = []
|
||||
|
||||
@ -115,31 +113,33 @@ def getVals(tech, module, var, freq=None):
|
||||
metric = [x for _, x in sorted(zip(widthL, metric))] # ordering
|
||||
else:
|
||||
for w in widths:
|
||||
m = 100000 # large number to start
|
||||
for oneSynth in allSynths:
|
||||
for oneSynth in bestSynths:
|
||||
if (oneSynth.width == w) & (oneSynth.tech == tech) & (oneSynth.module == module):
|
||||
if (oneSynth.delay < m) & (1000/oneSynth.delay > oneSynth.freq):
|
||||
m = oneSynth.delay
|
||||
osdict = oneSynth._asdict()
|
||||
met = osdict[var]
|
||||
try: metric += [met]
|
||||
except: pass
|
||||
|
||||
osdict = oneSynth._asdict()
|
||||
met = osdict[var]
|
||||
metric += [met]
|
||||
return metric
|
||||
|
||||
def csvOfBest():
|
||||
global techSpecs, widths, modules, allSynths
|
||||
bestSynths = []
|
||||
for tech in [x.tech for x in techSpecs]:
|
||||
for mod in modules:
|
||||
for w in widths:
|
||||
m = 100000 # large number to start
|
||||
m = np.Inf # large number to start
|
||||
best = None
|
||||
for oneSynth in allSynths:
|
||||
if (oneSynth.width == w) & (oneSynth.tech == tech) & (oneSynth.module == mod):
|
||||
if (oneSynth.delay < m) & (1000/oneSynth.delay > oneSynth.freq):
|
||||
m = oneSynth.delay
|
||||
best = oneSynth
|
||||
if [mod, tech, w] in leftblue:
|
||||
for oneSynth in allSynths:
|
||||
if (oneSynth.width == w) & (oneSynth.tech == tech) & (oneSynth.module == mod):
|
||||
if (oneSynth.freq < m) & (1000/oneSynth.delay < oneSynth.freq):
|
||||
if ([mod, tech, w] != ['mux2', 'sky90', 128]) or (oneSynth.area < 1100):
|
||||
m = oneSynth.freq
|
||||
best = oneSynth
|
||||
else:
|
||||
for oneSynth in allSynths:
|
||||
if (oneSynth.width == w) & (oneSynth.tech == tech) & (oneSynth.module == mod):
|
||||
if (oneSynth.delay < m) & (1000/oneSynth.delay > oneSynth.freq):
|
||||
m = oneSynth.delay
|
||||
best = oneSynth
|
||||
if (best != None) & (best not in bestSynths):
|
||||
bestSynths += [best]
|
||||
|
||||
@ -149,6 +149,7 @@ def csvOfBest():
|
||||
for synth in bestSynths:
|
||||
writer.writerow(list(synth))
|
||||
file.close()
|
||||
return bestSynths
|
||||
|
||||
def genLegend(fits, coefs, r2, spec, ale=False):
|
||||
''' generates a list of two legend elements
|
||||
@ -172,7 +173,7 @@ def genLegend(fits, coefs, r2, spec, ale=False):
|
||||
if str(coefsr[ind]) != '0.0': eq += " + " + coefsr[ind] + eqDict[k]
|
||||
ind += 1
|
||||
|
||||
eq = eq[3:]
|
||||
eq = eq[3:] # chop off leading ' + '
|
||||
|
||||
legend_elements = [lines.Line2D([0], [0], color=spec.color, label=eq)]
|
||||
legend_elements += [lines.Line2D([0], [0], color=spec.color, ls='', marker=spec.shape, label=spec.tech +' $R^2$='+ str(round(r2, 4)))]
|
||||
@ -185,19 +186,13 @@ def oneMetricPlot(module, var, freq=None, ax=None, fits='clsgn', norm=True, colo
|
||||
fits: constant, linear, square, log2, Nlog2
|
||||
plots given variable vs width for all matching syntheses with regression
|
||||
'''
|
||||
|
||||
if ax is None:
|
||||
singlePlot = True
|
||||
ax = plt.gca()
|
||||
else:
|
||||
singlePlot = True
|
||||
if ax or (freq == 10):
|
||||
singlePlot = False
|
||||
if ax is None:
|
||||
ax = plt.gca()
|
||||
|
||||
fullLeg = []
|
||||
global techSpecs
|
||||
global widths
|
||||
|
||||
global norms
|
||||
|
||||
allWidths = []
|
||||
allMetrics = []
|
||||
|
||||
@ -209,39 +204,40 @@ def oneMetricPlot(module, var, freq=None, ax=None, fits='clsgn', norm=True, colo
|
||||
if norm:
|
||||
techdict = spec._asdict()
|
||||
norm = techdict[var]
|
||||
metric = [m/norm for m in metric] # comment out to not normalize
|
||||
metric = [m/norm for m in metric]
|
||||
|
||||
if len(metric) == 5:
|
||||
allWidths += widths
|
||||
allMetrics += metric
|
||||
if len(metric) == 5: # don't include the spec if we don't have points for all widths
|
||||
xp, pred, leg = regress(widths, metric, spec, fits, ale=ale)
|
||||
fullLeg += leg
|
||||
c = color if color else spec.color
|
||||
ax.scatter(widths, metric, color=c, marker=spec.shape)
|
||||
ax.plot(xp, pred, color=c)
|
||||
allWidths += widths
|
||||
allMetrics += metric
|
||||
|
||||
combined = TechSpec('combined', 'red', '_', 0, 0, 0, 0)
|
||||
xp, pred, leg = regress(allWidths, allMetrics, combined, fits, ale=ale)
|
||||
fullLeg += leg
|
||||
ax.plot(xp, pred, color='red')
|
||||
|
||||
ax.legend(handles=fullLeg)
|
||||
|
||||
ax.set_xticks(widths)
|
||||
ax.set_xlabel("Width (bits)")
|
||||
|
||||
if norm:
|
||||
ylabeldic = {"lpower": "Leakage Power (add32)", "denergy": "Energy/Op (add32)", "area": "Area (add32)", "delay": "Delay (FO4)"}
|
||||
else:
|
||||
ylabeldic = {"lpower": "Leakage Power (nW)", "denergy": "Dynamic Energy (fJ)", "area": "Area (sq microns)", "delay": "Delay (ns)"}
|
||||
|
||||
ax.legend(handles=fullLeg)
|
||||
ax.set_xticks(widths)
|
||||
ax.set_xlabel("Width (bits)")
|
||||
ax.set_ylabel(ylabeldic[var])
|
||||
|
||||
if (module in ['flop', 'csa']) & (var == 'delay'):
|
||||
ax.set_ylim(ymin=0)
|
||||
|
||||
if singlePlot:
|
||||
titleStr = " (target " + str(freq)+ "MHz)" if freq != None else " (best achievable delay)"
|
||||
ax.set_title(module + titleStr)
|
||||
plt.savefig('./plots/PPA/'+ module + '_' + var + '.png')
|
||||
plt.show()
|
||||
# plt.show()
|
||||
|
||||
def regress(widths, var, spec, fits='clsgn', ale=False):
|
||||
''' fits a curve to the given points
|
||||
@ -259,22 +255,19 @@ def regress(widths, var, spec, fits='clsgn', ale=False):
|
||||
mat += [row]
|
||||
|
||||
y = np.array(var, dtype=np.float)
|
||||
coefsResid = opt.nnls(mat, y)
|
||||
coefs = coefsResid[0]
|
||||
|
||||
xp = np.linspace(4, 140, 200)
|
||||
pred = []
|
||||
coefs = opt.nnls(mat, y)[0]
|
||||
yp = []
|
||||
for x in xp:
|
||||
n = [func(x/normAddWidth) for func in funcArr]
|
||||
pred += [sum(np.multiply(coefs, n))]
|
||||
|
||||
for w in widths:
|
||||
n = [func(w) for func in funcArr]
|
||||
yp += [sum(np.multiply(coefs, n))]
|
||||
|
||||
r2 = skm.r2_score(y, yp)
|
||||
|
||||
xp = np.linspace(4, 140, 200)
|
||||
pred = []
|
||||
for x in xp:
|
||||
n = [func(x/normAddWidth) for func in funcArr]
|
||||
pred += [sum(np.multiply(coefs, n))]
|
||||
|
||||
leg = genLegend(fits, coefs, r2, spec, ale=ale)
|
||||
|
||||
return xp, pred, leg
|
||||
@ -317,7 +310,7 @@ def genFuncs(fits='clsgn'):
|
||||
funcArr += [lambda x: x*np.log2(x)]
|
||||
return funcArr
|
||||
|
||||
def noOutliers(freqs, delays, areas):
|
||||
def noOutliers(median, freqs, delays, areas):
|
||||
''' returns a pared down list of freqs, delays, and areas
|
||||
cuts out any syntheses in which target freq isn't within 75% of the min delay target to focus on interesting area
|
||||
helper function to freqPlot()
|
||||
@ -325,33 +318,28 @@ def noOutliers(freqs, delays, areas):
|
||||
f=[]
|
||||
d=[]
|
||||
a=[]
|
||||
try:
|
||||
ind = delays.index(min(delays))
|
||||
med = freqs[ind]
|
||||
for i in range(len(freqs)):
|
||||
norm = freqs[i]/med
|
||||
# if (norm > 0.25) & (norm<1.75):
|
||||
if freqs[i] < 8000:
|
||||
f += [freqs[i]]
|
||||
d += [delays[i]]
|
||||
a += [areas[i]]
|
||||
except: pass
|
||||
for i in range(len(freqs)):
|
||||
norm = freqs[i]/median
|
||||
if (norm > 0.4) & (norm<1.4):
|
||||
f += [freqs[i]]
|
||||
d += [delays[i]]
|
||||
a += [areas[i]]
|
||||
|
||||
return f, d, a
|
||||
|
||||
def freqPlot(tech, mod, width):
|
||||
''' plots delay, area, area*delay, and area*delay^2 for syntheses with specified tech, module, width
|
||||
'''
|
||||
global allSynths
|
||||
|
||||
freqsL, delaysL, areasL = ([[], []] for i in range(3))
|
||||
count = 0
|
||||
for oneSynth in allSynths:
|
||||
if (mod == oneSynth.module) & (width == oneSynth.width) & (tech == oneSynth.tech):
|
||||
count += 1
|
||||
ind = (1000/oneSynth.delay < oneSynth.freq) # when delay is within target clock period
|
||||
freqsL[ind] += [oneSynth.freq]
|
||||
delaysL[ind] += [oneSynth.delay]
|
||||
areasL[ind] += [oneSynth.area]
|
||||
|
||||
median = np.median(list(flatten(freqsL)))
|
||||
|
||||
f, (ax1, ax2, ax3, ax4) = plt.subplots(4, 1, sharex=True)
|
||||
for ax in (ax1, ax2, ax3, ax4):
|
||||
@ -362,8 +350,7 @@ def freqPlot(tech, mod, width):
|
||||
delays = delaysL[ind]
|
||||
freqs = freqsL[ind]
|
||||
|
||||
if ('flop' in mod): areas = [m/2 for m in areas] # since two flops in each module
|
||||
# freqs, delays, areas = noOutliers(freqs, delays, areas) # comment out to see all syntheses
|
||||
freqs, delays, areas = noOutliers(median, freqs, delays, areas) # comment out to see all syntheses
|
||||
|
||||
c = 'blue' if ind else 'green'
|
||||
adprod = adprodpow(areas, delays, 1)
|
||||
@ -408,7 +395,6 @@ def squareAreaDelay(tech, mod, width):
|
||||
targets = freqsL[ind]
|
||||
targets = [1000/f for f in targets]
|
||||
|
||||
if ('flop' in mod): areas = [m/2 for m in areas] # since two flops in each module
|
||||
targets, delays, areas = noOutliers(targets, delays, areas) # comment out to see all
|
||||
|
||||
if not ind:
|
||||
@ -473,24 +459,29 @@ def adprodpow(areas, delays, pow):
|
||||
|
||||
return result
|
||||
|
||||
def plotPPA(mod, freq=None, norm=True):
|
||||
def plotPPA(mod, freq=None, norm=True, aleOpt=False):
|
||||
''' for the module specified, plots width vs delay, area, leakage power, and dynamic energy with fits
|
||||
if no freq specified, uses the synthesis with best achievable delay for each width
|
||||
overlays data from both techs
|
||||
'''
|
||||
plt.rcParams["figure.figsize"] = (12,8)
|
||||
fig, axs = plt.subplots(2, 2)
|
||||
global fitDict
|
||||
modFit = fitDict[mod]
|
||||
|
||||
oneMetricPlot(mod, 'delay', ax=axs[0,0], fits=modFit[0], freq=freq, norm=norm)
|
||||
oneMetricPlot(mod, 'area', ax=axs[0,1], fits=modFit[1], freq=freq, norm=norm)
|
||||
oneMetricPlot(mod, 'lpower', ax=axs[1,0], fits=modFit[1], freq=freq, norm=norm)
|
||||
oneMetricPlot(mod, 'denergy', ax=axs[1,1], fits=modFit[1], freq=freq, norm=norm)
|
||||
if aleOpt:
|
||||
oneMetricPlot(mod, 'area', ax=axs[0,1], fits=modFit[1], freq=10, norm=norm, color='black')
|
||||
oneMetricPlot(mod, 'lpower', ax=axs[1,0], fits=modFit[1], freq=10, norm=norm, color='black')
|
||||
oneMetricPlot(mod, 'denergy', ax=axs[1,1], fits=modFit[1], freq=10, norm=norm, color='black')
|
||||
|
||||
titleStr = " (target " + str(freq)+ "MHz)" if freq != None else " (best achievable delay)"
|
||||
n = 'normalized' if norm else 'unnormalized'
|
||||
saveStr = './plots/PPA/'+ n + '/' + mod + '.png'
|
||||
plt.suptitle(mod + titleStr)
|
||||
plt.savefig(saveStr)
|
||||
if freq != 10: plt.savefig(saveStr)
|
||||
# plt.show()
|
||||
|
||||
def plotBestAreas(mod):
|
||||
@ -512,38 +503,38 @@ def plotBestAreas(mod):
|
||||
plt.savefig('./plots/bestAreas/' + mod + '.png')
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
##############################
|
||||
# set up stuff, global variables
|
||||
widths = [8, 16, 32, 64, 128]
|
||||
normAddWidth = 32
|
||||
fitDict = {'add': ['cg', 'l', 'l'], 'mult': ['cg', 'sl', 'ls'], 'comparator': ['cg', 'l', 'l'], 'csa': ['c', 'l', 'l'], 'shiftleft': ['cg', 'n', 'ln'], 'flop': ['c', 'l', 'l'], 'priorityencoder': ['cg', 'l', 'l']}
|
||||
fitDict.update(dict.fromkeys(['mux2', 'mux4', 'mux8'], ['cg', 'l', 'l'])) #data
|
||||
modules = ['priorityencoder', 'add', 'csa', 'shiftleft', 'comparator', 'flop', 'mux2', 'mux4', 'mux8', 'mult']
|
||||
normAddWidth = 32 # divisor to use with N since normalizing to add_32
|
||||
|
||||
fitDict = {'add': ['cg', 'l', 'l'], 'mult': ['cg', 's', 'ls'], 'comparator': ['cg', 'l', 'l'], 'csa': ['c', 'l', 'l'], 'shiftleft': ['cg', 'l', 'ln'], 'flop': ['c', 'l', 'l'], 'priorityencoder': ['cg', 'l', 'l']}
|
||||
fitDict.update(dict.fromkeys(['mux2', 'mux4', 'mux8'], ['cg', 'l', 'l']))
|
||||
leftblue = [['mux2', 'sky90', 32], ['mux2', 'sky90', 64], ['mux2', 'sky90', 128], ['mux2', 'tsmc28', 16], ['mux2', 'tsmc28', 8], ['mux8', 'sky90', 32]]
|
||||
|
||||
TechSpec = namedtuple("TechSpec", "tech color shape delay area lpower denergy")
|
||||
techSpecs = [['sky90', 'green', 'o', 43.2e-3, 1330.84, 582.81, 520.66], ['tsmc28', 'blue', '^', 12.2e-3, 209.29, 1060, 81.43]]
|
||||
|
||||
invz1arealeakage = [['sky90', 1.96, 1.98], ['gf32', .351, .3116], ['tsmc28', .252, 1.09]] #['gf32', 'purple', 's', 15e-3]
|
||||
techSpecs = [TechSpec(*t) for t in techSpecs]
|
||||
modules = ['priorityencoder', 'add', 'csa', 'shiftleft', 'comparator', 'flop', 'mux2', 'mux4', 'mux8', 'mult']
|
||||
# invz1arealeakage = [['sky90', 1.96, 1.98], ['gf32', .351, .3116], ['tsmc28', .252, 1.09]] #['gf32', 'purple', 's', 15e-3]
|
||||
##############################
|
||||
|
||||
|
||||
# cleanup()
|
||||
# cleanup() # run to remove garbage synth runs
|
||||
# synthsintocsv() # slow, run only when new synth runs to add to csv
|
||||
|
||||
allSynths = synthsfromcsv('ppaData.csv') # your csv here!
|
||||
bestSynths = csvOfBest()
|
||||
|
||||
# # ### examples
|
||||
|
||||
# ### plotting examples
|
||||
# squareAreaDelay('sky90', 'add', 32)
|
||||
# plotBestAreas('add')
|
||||
# oneMetricPlot('add', 'delay')
|
||||
# freqPlot('sky90', 'mux4', 16)
|
||||
|
||||
for mod in modules:
|
||||
plotPPA(mod, norm=False)
|
||||
plotPPA(mod)
|
||||
# plotPPA(mod, norm=False)
|
||||
plotPPA(mod, aleOpt=True)
|
||||
plotBestAreas(mod)
|
||||
for w in [8, 16, 32, 64, 128]:
|
||||
freqPlot('sky90', mod, w)
|
||||
freqPlot('tsmc28', mod, w)
|
||||
plt.close('all')
|
||||
|
||||
csvOfBest()
|
||||
plt.close('all')
|
3006
synthDC/ppaData.csv
3006
synthDC/ppaData.csv
File diff suppressed because it is too large
Load Diff
@ -38,9 +38,9 @@ def getData(filename):
|
||||
# arr = [-5, -3, -1, 1, 3, 5]
|
||||
arr2 = [-8, -6, -4, -2, 0, 2, 4, 6, 8]
|
||||
|
||||
widths = [32]
|
||||
modules = ['mux2']#, 'comparator'] #, 'mux2', 'mux4', 'mux8', 'shiftleft', 'flop', 'comparator'] # need mult, 'shiftleft', add
|
||||
techs = ['sky90']
|
||||
widths = [128]
|
||||
modules = ['mux2', 'mux4', 'mux8', 'shiftleft', 'flop', 'comparator', 'mult', 'priorityencoder', 'add', 'csa']
|
||||
techs = ['tsmc28']
|
||||
LoT = []
|
||||
|
||||
|
||||
@ -56,8 +56,7 @@ for w in widths:
|
||||
m = oneSynth.delay
|
||||
synth = oneSynth
|
||||
# f = 1000/synth.delay
|
||||
f = 4950
|
||||
for freq in [round(f+f*x/100) for x in arr2]:
|
||||
for freq in [10]: #[round(f+f*x/100) for x in arr2]:
|
||||
LoT += [[synth.module, str(synth.width), synth.tech, str(freq)]]
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user