This commit is contained in:
Katherine Parry 2022-06-24 19:42:00 +00:00
commit 57f83bcbd6
8 changed files with 72 additions and 30 deletions

1
.gitignore vendored
View File

@ -75,6 +75,7 @@ synthDC/alib-52
synthDC/*.log synthDC/*.log
synthDC/*.svf synthDC/*.svf
synthDC/runs/ synthDC/runs/
synthDC/newRuns
synthDC/PPAruns synthDC/PPAruns
synthDC/plots/ synthDC/plots/
synthDC/runArchive synthDC/runArchive

View File

@ -5,10 +5,10 @@ NAME := synth
# defaults # defaults
export DESIGN ?= wallypipelinedcore export DESIGN ?= wallypipelinedcore
export FREQ ?= 500 export FREQ ?= 4000
export CONFIG ?= rv32e export CONFIG ?= rv64gc
# sky130 and sky90 presently supported # sky130 and sky90 presently supported
export TECH ?= sky130 export TECH ?= tsmc28
# MAXCORES allows parallel compilation, which is faster but less CPU-efficient # MAXCORES allows parallel compilation, which is faster but less CPU-efficient
# Avoid when doing sweeps of many optimization points in parallel # Avoid when doing sweeps of many optimization points in parallel
export MAXCORES ?= 4 export MAXCORES ?= 4
@ -19,7 +19,7 @@ export DRIVE ?= FLOP
time := $(shell date +%F-%H-%M) time := $(shell date +%F-%H-%M)
hash := $(shell git rev-parse --short HEAD) hash := $(shell git rev-parse --short HEAD)
export OUTPUTDIR := runs/$(DESIGN)_$(CONFIG)_$(TECH)nm_$(FREQ)_MHz_$(time)_$(hash) export OUTPUTDIR := newRuns/$(DESIGN)_$(CONFIG)_$(TECH)nm_$(FREQ)_MHz_$(time)_$(hash)
export SAIFPOWER ?= 0 export SAIFPOWER ?= 0
CONFIGDIR ?= ${WALLY}/pipelined/config CONFIGDIR ?= ${WALLY}/pipelined/config

View File

@ -1,30 +1,13 @@
#!/usr/bin/python3 #!/usr/bin/python3
# Shreya Sanghai (ssanghai@hmc.edu) 2/28/2022
# Madeleine Masser-Frye (mmmasserfrye@hmc.edu) 06/2022 # Madeleine Masser-Frye (mmmasserfrye@hmc.edu) 06/2022
from collections import namedtuple from collections import namedtuple
import glob
import re import re
import csv import csv
import subprocess import subprocess
from matplotlib.cbook import flatten from matplotlib.cbook import flatten
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import matplotlib.lines as lines import matplotlib.lines as lines
import numpy as np
# field_names = [ 'Name', 'Critical Path Length', 'Cell Area', 'Synth Time']
# data = []
# for name in glob.glob("/home/ssanghai/riscv-wally/synthDC/runs/*/reports/wallypipelinedcore_qor.rep"):
# f = open(name, 'r')
# # trimName = re.search("runs\/(.*?)\/reports", name).group(1)
# trimName = re.search("wallypipelinedcore_(.*?)_sky9",name).group(1)
# for line in f:
# if "Critical Path Length" in line:
# pathLen = re.search("Length: *(.*?)\\n", line).group(1)
# if "Cell Area" in line:
# area = re.search("Area: *(.*?)\\n", line).group(1)
# if "Overall Compile Time" in line:
# time = re.search("Time: *(.*?)\\n", line).group(1)
# data += [{'Name' : trimName, 'Critical Path Length': pathLen, 'Cell Area' : area, 'Synth Time' :time}]
def synthsintocsv(): def synthsintocsv():
''' writes a CSV with one line for every available synthesis ''' writes a CSV with one line for every available synthesis
@ -100,8 +83,6 @@ def freqPlot(tech, width, config):
areasL[ind] += [oneSynth.area] areasL[ind] += [oneSynth.area]
f, (ax1, ax2) = plt.subplots(2, 1, sharex=True) f, (ax1, ax2) = plt.subplots(2, 1, sharex=True)
for ax in (ax1, ax2):
ax.ticklabel_format(useOffset=False, style='plain')
for ind in [0,1]: for ind in [0,1]:
areas = areasL[ind] areas = areasL[ind]
@ -120,11 +101,13 @@ def freqPlot(tech, width, config):
lines.Line2D([0], [0], color='blue', ls='', marker='o', label='slack violated')] lines.Line2D([0], [0], color='blue', ls='', marker='o', label='slack violated')]
ax1.legend(handles=legend_elements) 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)") ax2.set_xlabel("Target Freq (MHz)")
ax1.set_ylabel('Delay (ns)') ax1.set_ylabel('Delay (ns)')
ax2.set_ylabel('Area (sq microns)') ax2.set_ylabel('Area (sq microns)')
ax1.set_title(tech + ' ' + width +config) ax1.set_title(tech + ' ' + width +config)
plt.savefig('./plots/wally/' + tech + '_' + width + config + '.png') plt.savefig('./plots/wally/freqSweep_' + tech + '_' + width + config + '.png')
# plt.show() # plt.show()
def areaDelay(width, tech, freq, config=None, special=None): def areaDelay(width, tech, freq, config=None, special=None):
@ -149,16 +132,24 @@ def areaDelay(width, tech, freq, config=None, special=None):
plt.scatter(delays, areas) plt.scatter(delays, areas)
plt.xlabel('Delay (ns)') plt.xlabel('Delay (ns)')
plt.ylabel('Area (sq microns)') plt.ylabel('Area (sq microns)')
titleStr = tech + ' ' +width ytop = ax1.get_ylim()[1]
if config: titleStr += config plt.ylim(ymin=0, ymax=1.1*ytop)
if special: titleStr += special titleStr = tech + ' ' + width
saveStr = tech + '_' + width
if config:
titleStr += config
saveStr = saveStr + config + '_versions_'
if (special != None):
titleStr += special
saveStr = saveStr + '_origConfigs_'
saveStr += str(freq)
titleStr = titleStr + ' (target freq: ' + str(freq) + ')' titleStr = titleStr + ' (target freq: ' + str(freq) + ')'
plt.title(titleStr) plt.title(titleStr)
for i in range(len(labels)): for i in range(len(labels)):
plt.annotate(labels[i], (delays[i], areas[i]), textcoords="offset points", xytext=(0,10), ha='center') plt.annotate(labels[i], (delays[i], areas[i]), textcoords="offset points", xytext=(0,10), ha='center')
plt.savefig('./plots/wally/areaDelay ' + titleStr + '.png') plt.savefig('./plots/wally/areaDelay_' + saveStr + '.png')
# ending freq in 42 means fpu was turned off manually # ending freq in 42 means fpu was turned off manually
@ -167,5 +158,4 @@ if __name__ == '__main__':
synthsfromcsv('Summary.csv') synthsfromcsv('Summary.csv')
freqPlot('tsmc28', 'rv64', 'gc') freqPlot('tsmc28', 'rv64', 'gc')
areaDelay('rv32', 'tsmc28', 4200, config='gc') areaDelay('rv32', 'tsmc28', 4200, config='gc')
areaDelay('rv32', 'tsmc28', 3042, special='') areaDelay('rv32', 'tsmc28', 3042, special='')

6
synthDC/runAllSynths.sh Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/bash
mv runs runArchive/$(date +"%Y_%m_%d_%I_%M_%p")
mv newRuns runs
mkdir newRuns
./wallySynth.py

View File

@ -6,6 +6,20 @@ import csv
import linecache import linecache
import os import os
# field_names = [ 'Name', 'Critical Path Length', 'Cell Area', 'Synth Time']
# data = []
# for name in glob.glob("/home/ssanghai/riscv-wally/synthDC/runs/*/reports/wallypipelinedcore_qor.rep"):
# f = open(name, 'r')
# # trimName = re.search("runs\/(.*?)\/reports", name).group(1)
# trimName = re.search("wallypipelinedcore_(.*?)_sky9",name).group(1)
# for line in f:
# if "Critical Path Length" in line:
# pathLen = re.search("Length: *(.*?)\\n", line).group(1)
# if "Cell Area" in line:
# area = re.search("Area: *(.*?)\\n", line).group(1)
# if "Overall Compile Time" in line:
# time = re.search("Time: *(.*?)\\n", line).group(1)
# data += [{'Name' : trimName, 'Critical Path Length': pathLen, 'Cell Area' : area, 'Synth Time' :time}]
def main(): def main():
data = [] data = []

31
synthDC/wallySynth.py Executable file
View File

@ -0,0 +1,31 @@
#!/usr/bin/python3
# Madeleine Masser-Frye mmasserfrye@hmc.edu 6/22
import subprocess
from multiprocessing import Pool
def runCommand(config, tech, freq):
command = "make synth DESIGN=wallypipelinedcore CONFIG={} TECH={} DRIVE=FLOP FREQ={} MAXOPT=0 MAXCORES=1".format(config, tech, freq)
subprocess.Popen(command, shell=True)
if __name__ == '__main__':
techs = ['sky90', 'tsmc28']
bestAchieved = [750, 3000]
synthsToRun = []
arr = [-8, -6, -4, -2, 0, 2, 4, 6, 8]
for i in [0, 1]:
tech = techs[i]
f = bestAchieved[i]
for freq in [round(f+f*x/100) for x in arr]: # rv32e freq sweep
synthsToRun += [['rv32e', tech, freq]]
for config in ['rv32gc', 'rv32ic', 'rv64gc', 'rv64i', 'rv64ic']: # configs
synthsToRun += [[config, tech, f]]
for mod in ['FPUoff', 'noMulDiv', 'noPriv', 'PMP0', 'PMP16']: # rv64gc path variations
config = 'rv64gc_' + mod
synthsToRun += [[config, tech, f]]
pool = Pool()
pool.starmap(runCommand, synthsToRun)