forked from Github_Repos/cvw
plot tuning, fo4 axis
This commit is contained in:
parent
528c24a02f
commit
3135e1202e
@ -1 +1 @@
|
||||
Subproject commit be67c99bd461742aa1c100bcc0732657faae2230
|
||||
Subproject commit 307c77b26e070ae85ffea665ad9b642b40e33c86
|
@ -8,6 +8,9 @@ from matplotlib.cbook import flatten
|
||||
import matplotlib.pyplot as plt
|
||||
import matplotlib.lines as lines
|
||||
from wallySynth import testFreq
|
||||
import numpy as np
|
||||
from ppa.ppaAnalyze import noOutliers
|
||||
from matplotlib import ticker
|
||||
|
||||
|
||||
def synthsintocsv():
|
||||
@ -27,7 +30,7 @@ def synthsintocsv():
|
||||
writer.writerow(['Width', 'Config', 'Special', 'Tech', 'Target Freq', 'Delay', 'Area'])
|
||||
|
||||
for oneSynth in allSynths:
|
||||
descrip = specReg.findall(oneSynth) #[30:]
|
||||
descrip = specReg.findall(oneSynth)
|
||||
width = descrip[2][:4]
|
||||
config = descrip[2][4:]
|
||||
if descrip[3][-2:] == 'nm':
|
||||
@ -71,6 +74,7 @@ def synthsfromcsv(filename):
|
||||
allSynths[i] = Synth(*allSynths[i])
|
||||
return allSynths
|
||||
|
||||
|
||||
def freqPlot(tech, width, config):
|
||||
''' plots delay, area for syntheses with specified tech, module, width
|
||||
'''
|
||||
@ -83,16 +87,24 @@ def freqPlot(tech, width, config):
|
||||
delaysL[ind] += [oneSynth.delay]
|
||||
areasL[ind] += [oneSynth.area]
|
||||
|
||||
f, (ax1, ax2) = plt.subplots(2, 1, sharex=True)
|
||||
fig, (ax1, ax2) = plt.subplots(2, 1, sharex=True)
|
||||
allFreqs = list(flatten(freqsL))
|
||||
if allFreqs != []:
|
||||
median = np.median(allFreqs)
|
||||
else:
|
||||
median = 0
|
||||
|
||||
for ind in [0,1]:
|
||||
areas = areasL[ind]
|
||||
delays = delaysL[ind]
|
||||
freqs = freqsL[ind]
|
||||
freqs, delays, areas = noOutliers(median, freqs, delays, areas)
|
||||
|
||||
c = 'blue' if ind else 'green'
|
||||
ax1.scatter(freqs, delays, color=c)
|
||||
ax2.scatter(freqs, areas, color=c)
|
||||
targs = [1000/f for f in freqs]
|
||||
|
||||
ax1.scatter(targs, delays, color=c)
|
||||
ax2.scatter(targs, areas, color=c)
|
||||
|
||||
freqs = list(flatten(freqsL))
|
||||
delays = list(flatten(delaysL))
|
||||
@ -104,20 +116,25 @@ def freqPlot(tech, width, config):
|
||||
ax1.legend(handles=legend_elements)
|
||||
ytop = ax2.get_ylim()[1]
|
||||
ax2.set_ylim(ymin=0, ymax=1.1*ytop)
|
||||
ax2.set_xlabel("Target Freq (MHz)")
|
||||
ax1.set_ylabel('Delay (ns)')
|
||||
ax2.set_xlabel("Target Cycle Time (ns)")
|
||||
ax1.set_ylabel('Cycle Time Achieved (ns)')
|
||||
ax2.set_ylabel('Area (sq microns)')
|
||||
ax1.set_title(tech + ' ' + width +config)
|
||||
ax1.set_title(tech + ' ' + width + config)
|
||||
ax2.yaxis.set_major_formatter(ticker.StrMethodFormatter('{x:,.0f}'))
|
||||
addFO4axis(fig, ax1, tech)
|
||||
|
||||
plt.savefig('./plots/wally/freqSweep_' + tech + '_' + width + config + '.png')
|
||||
# plt.show()
|
||||
|
||||
def areaDelay(tech, freq, width=None, config=None, special=None):
|
||||
|
||||
|
||||
def areaDelay(tech, fig=None, ax=None, freq=None, width=None, config=None, norm=False):
|
||||
delays, areas, labels = ([] for i in range(3))
|
||||
|
||||
for oneSynth in allSynths:
|
||||
if (width==None) or (width == oneSynth.width):
|
||||
if (tech == oneSynth.tech) & (freq == oneSynth.freq):
|
||||
if (special != None) & (oneSynth.special == special):
|
||||
if (config == None) & (oneSynth.special == 'FPUoff'): #fix
|
||||
delays += [oneSynth.delay]
|
||||
areas += [oneSynth.area]
|
||||
labels += [oneSynth.width + oneSynth.config]
|
||||
@ -125,44 +142,88 @@ def areaDelay(tech, freq, width=None, config=None, special=None):
|
||||
delays += [oneSynth.delay]
|
||||
areas += [oneSynth.area]
|
||||
labels += [oneSynth.special]
|
||||
# else:
|
||||
# delays += [oneSynth.delay]
|
||||
# areas += [oneSynth.area]
|
||||
# labels += [oneSynth.config + '_' + oneSynth.special]
|
||||
if width == None:
|
||||
width = ''
|
||||
if (fig == None) or (ax == None):
|
||||
fig, (ax) = plt.subplots(1, 1)
|
||||
ax.ticklabel_format(useOffset=False, style='plain')
|
||||
plt.subplots_adjust(left=0.18)
|
||||
|
||||
if norm:
|
||||
delays = [d/techdict[tech][0] for d in delays]
|
||||
areas = [a/techdict[tech][1] for a in areas]
|
||||
|
||||
f, (ax1) = plt.subplots(1, 1)
|
||||
plt.scatter(delays, areas)
|
||||
plt.xlabel('Delay (ns)')
|
||||
plt.xlabel('Cycle time (ns)')
|
||||
plt.ylabel('Area (sq microns)')
|
||||
ytop = ax1.get_ylim()[1]
|
||||
ytop = ax.get_ylim()[1]
|
||||
plt.ylim(ymin=0, ymax=1.1*ytop)
|
||||
titleStr = tech + ' ' + width
|
||||
saveStr = tech + '_' + width
|
||||
if config:
|
||||
titleStr += config
|
||||
saveStr = saveStr + config + '_versions_'
|
||||
if (special != None):
|
||||
titleStr += special
|
||||
if (config == None):
|
||||
saveStr = saveStr + '_origConfigs_'
|
||||
saveStr += str(freq)
|
||||
titleStr = titleStr + ' (target freq: ' + str(freq) + ')'
|
||||
titleStr = titleStr
|
||||
plt.title(titleStr)
|
||||
|
||||
ax.yaxis.set_major_formatter(ticker.StrMethodFormatter('{x:,.0f}'))
|
||||
|
||||
for i in range(len(labels)):
|
||||
plt.annotate(labels[i], (delays[i], areas[i]), textcoords="offset points", xytext=(0,10), ha='center')
|
||||
|
||||
plt.savefig('./plots/wally/areaDelay_' + saveStr + '.png')
|
||||
# addFO4axis(fig, ax1, tech)
|
||||
|
||||
# ending freq in 42 means fpu was turned off manually
|
||||
plt.savefig('./plots/wally/areaDelay_' + saveStr + '.png')
|
||||
|
||||
def normAreaDelay():
|
||||
fig2, (ax) = plt.subplots(1, 1)
|
||||
areaDelay('sky90', fig=fig2, ax=ax, freq=testFreq[0], norm=True)
|
||||
areaDelay('tsmc28', fig=fig2, ax=ax, freq=testFreq[1], norm=True)
|
||||
ax.set_title('Normalized Area & Cycle Time by Configuration')
|
||||
ax.set_xlabel('Cycle Time (FO4)')
|
||||
ax.set_ylabel('Area (add32)')
|
||||
fullLeg = [lines.Line2D([0], [0], color='royalblue', label='tsmc28')]
|
||||
fullLeg += [lines.Line2D([0], [0], color='orange', label='sky90')]
|
||||
ax.legend(handles = fullLeg, loc='upper left')
|
||||
plt.savefig('./plots/wally/normAreaDelay.png')
|
||||
|
||||
def addFO4axis(fig, ax, tech):
|
||||
fo4 = techdict[tech][0]
|
||||
|
||||
ax3 = fig.add_axes((0.125,0.14,0.775,0.0))
|
||||
ax3.yaxis.set_visible(False) # hide the yaxis
|
||||
|
||||
fo4Range = [x/fo4 for x in ax.get_xlim()]
|
||||
dif = fo4Range[1] - fo4Range[0]
|
||||
for n in [0.02, 0.05, 0.1, 0.25, 0.5, 1, 2, 5, 10, 20, 50, 100, 200, 500, 1000]:
|
||||
d = dif/n
|
||||
if d > 3 and d < 10:
|
||||
r = [int(x/n) for x in fo4Range]
|
||||
nsTicks = [round(x*n, 2) for x in range(r[0], r[1]+1)]
|
||||
break
|
||||
new_tick_locations = [fo4*float(x) for x in nsTicks]
|
||||
|
||||
ax3.set_xticks(new_tick_locations)
|
||||
ax3.set_xticklabels(nsTicks)
|
||||
ax3.set_xlim(ax.get_xlim())
|
||||
ax3.set_xlabel("FO4 delays")
|
||||
plt.subplots_adjust(left=0.125, bottom=0.25, right=0.9, top=0.9)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
synthsintocsv()
|
||||
|
||||
techdict = {'sky90': [43.2e-3, 1440.600027], 'tsmc28': [12.2e-3, 209.286002]}
|
||||
|
||||
# synthsintocsv()
|
||||
synthsfromcsv('Summary.csv')
|
||||
freqPlot('tsmc28', 'rv32', 'e')
|
||||
freqPlot('sky90', 'rv32', 'e')
|
||||
areaDelay('tsmc28', testFreq[1], width= 'rv64', config='gc')
|
||||
areaDelay('sky90', testFreq[0], width='rv64', config='gc')
|
||||
areaDelay('tsmc28', testFreq[1], special='FPUoff')
|
||||
areaDelay('sky90', testFreq[0], special='FPUoff')
|
||||
areaDelay('tsmc28', freq=testFreq[1], width= 'rv64', config='gc')
|
||||
areaDelay('sky90', freq=testFreq[0], width='rv64', config='gc')
|
||||
areaDelay('tsmc28', freq=testFreq[1])
|
||||
areaDelay('sky90', freq=testFreq[0])
|
||||
|
||||
# normAreaDelay()
|
||||
|
@ -9,7 +9,7 @@ def runCommand(config, tech, freq):
|
||||
commands = ["make fresh", "make synth DESIGN=wallypipelinedcore CONFIG={} TECH={} DRIVE=FLOP FREQ={} MAXOPT=0 MAXCORES=1".format(config, tech, freq)]
|
||||
for c in commands:
|
||||
subprocess.Popen(c, shell=True)
|
||||
time.sleep(60)
|
||||
# time.sleep(60) fix only do this when diff configs
|
||||
|
||||
testFreq = [3000, 10000]
|
||||
|
||||
@ -26,14 +26,14 @@ if __name__ == '__main__':
|
||||
tech = techs[i]
|
||||
sc = sweepCenter[i]
|
||||
f = testFreq[i]
|
||||
# for freq in [round(sc+sc*x/100) for x in arr]: # rv32e freq sweep
|
||||
# synthsToRun += [['rv32e', tech, freq]]
|
||||
for freq in [round(sc+sc*x/100) for x in arr]: # rv32e freq sweep
|
||||
synthsToRun += [['rv32e', tech, freq]]
|
||||
# for config in ['rv32gc', 'rv32ic', 'rv64gc', 'rv64ic', 'rv32e']: # configs
|
||||
# config = config + '_FPUoff' # while FPU under rennovation
|
||||
# synthsToRun += [[config, tech, f]]
|
||||
for mod in ['noMulDiv', 'noPriv', 'PMP0', 'PMP16']: # rv64gc path variations
|
||||
config = 'rv64gc_' + mod
|
||||
synthsToRun += [[config, tech, f]]
|
||||
# for mod in ['noMulDiv', 'noPriv', 'PMP0', 'PMP16']: # rv64gc path variations
|
||||
# config = 'rv64gc_' + mod
|
||||
# synthsToRun += [[config, tech, f]]
|
||||
|
||||
for x in synthsToRun:
|
||||
pool.starmap(runCommand, [x])
|
Loading…
Reference in New Issue
Block a user