mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-03 10:15:19 +00:00
Merge pull request #458 from stineje/main
fix to setup.csh and also ppaSynth.py
This commit is contained in:
commit
1d2eccc14d
@ -6,7 +6,7 @@
|
||||
echo "Executing Wally setup.csh"
|
||||
|
||||
# Path to Wally repository
|
||||
set WALLY = $PWD
|
||||
setenv WALLY $PWD
|
||||
echo '$WALLY set to ' ${WALLY}
|
||||
|
||||
# Extend alias which makes extending PATH much easier.
|
||||
|
@ -31,3 +31,12 @@ SAIFPOWER
|
||||
0: switching factor power analysis
|
||||
1: RTL simulation driven power analysis.
|
||||
|
||||
-----
|
||||
Extra Tool (PPA)
|
||||
|
||||
To run ppa analysis that hones into target frequency, you can type:
|
||||
python3 ppa/ppaSynth.py from the synthDC directory. This runs a sweep
|
||||
across all modules listed at the bottom of the ppaSynth.py file.
|
||||
|
||||
|
||||
|
||||
|
@ -1,5 +1,9 @@
|
||||
#!/usr/bin/python3
|
||||
#
|
||||
# Python regression test for DC
|
||||
# Madeleine Masser-Frye mmasserfrye@hmc.edu 5/22
|
||||
# James Stine james.stine@okstate.edu 15 October 2023
|
||||
#
|
||||
|
||||
import scipy.optimize as opt
|
||||
import subprocess
|
||||
@ -565,6 +569,7 @@ def makeLineLegend():
|
||||
fullLeg += [lines.Line2D([0], [0], color='black', label='smallest', linestyle='--')]
|
||||
fullLeg += [lines.Line2D([0], [0], color='blue', label='tsmc28', marker='^')]
|
||||
fullLeg += [lines.Line2D([0], [0], color='green', label='sky90', marker='o')]
|
||||
fullLeg += [lines.Line2D([0], [0], color='green', label='sky130', marker='+')]
|
||||
fullLeg += [lines.Line2D([0], [0], color='red', label='combined', marker='_')]
|
||||
fig.legend(handles=fullLeg, ncol=5, handlelength=1.4, loc='center')
|
||||
saveStr = './plots/legend.png'
|
||||
@ -689,7 +694,7 @@ def makePlotDirectory():
|
||||
os.makedirs(new_directory)
|
||||
os.chdir(new_directory)
|
||||
if 'freq' in folder:
|
||||
for tech in ['sky90', 'tsmc28']:
|
||||
for tech in ['sky90', 'sky130', 'tsmc28']:
|
||||
for mod in modules:
|
||||
tech_directory = os.path.join(new_directory, tech)
|
||||
mod_directory = os.path.join(tech_directory, mod)
|
||||
@ -702,15 +707,14 @@ def makePlotDirectory():
|
||||
if __name__ == '__main__':
|
||||
##############################
|
||||
# set up stuff, global variables
|
||||
widths = [8, 16, 32, 64, 128]
|
||||
modules = ['priorityencoder', 'add', 'csa', 'shiftleft', 'comparator', 'flop', 'mux2', 'mux4', 'mux8', 'mult'] #, 'mux2d', 'mux4d', 'mux8d']
|
||||
widths = [8, 16, 32, 64, 128]
|
||||
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', 's'], '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']))
|
||||
fitDict = {'add': ['cg', 'l', 'l'], 'mult': ['cg', 's', 's'], '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']))
|
||||
|
||||
TechSpec = namedtuple("TechSpec", "tech color shape delay area lpower denergy")
|
||||
techSpecs = [['sky90', 'green', 'o', 43.2e-3, 1440.600027, 714.057, 0.658022690438], ['tsmc28', 'blue', '^', 12.2e-3, 209.286002, 1060.0, .08153281695882594]]
|
||||
techSpecs = [['sky90', 'green', 'o', 43.2e-3, 1440.600027, 714.057, 0.658022690438], ['sky130', 'red', 'o', 43.2e-3, 1440.600027, 714.057, 0.658022690438], ['tsmc28', 'blue', '^', 12.2e-3, 209.286002, 1060.0, .08153281695882594]]
|
||||
techSpecs = [TechSpec(*t) for t in techSpecs]
|
||||
combined = TechSpec('combined fit', 'red', '_', 0, 0, 0, 0)
|
||||
##############################
|
||||
@ -731,7 +735,8 @@ if __name__ == '__main__':
|
||||
for mod in modules:
|
||||
for w in widths:
|
||||
freqPlot('sky90', mod, w)
|
||||
freqPlot('tsmc28', mod, w)
|
||||
plotPPA(mod, norm=False)
|
||||
plotPPA(mod, aleOpt=True)
|
||||
plt.close('all')
|
||||
#freqPlot('sky130', mod, w)
|
||||
#freqPlot('tsmc28', mod, w)
|
||||
#plotPPA(mod, norm=False)
|
||||
#plotPPA(mod, aleOpt=True)
|
||||
plt.close('all')
|
||||
|
@ -1,5 +1,9 @@
|
||||
#!/usr/bin/python3
|
||||
# Madeleine Masser-Frye mmasserfrye@hmc.edu 6/22
|
||||
#
|
||||
# Python regression test for DC
|
||||
# Madeleine Masser-Frye mmasserfrye@hmc.edu 5/22
|
||||
# James Stine james.stine@okstate.edu 15 October 2023
|
||||
#
|
||||
|
||||
import subprocess
|
||||
import re
|
||||
@ -7,7 +11,9 @@ from multiprocessing import Pool
|
||||
from ppaAnalyze import synthsfromcsv
|
||||
|
||||
def runCommand(module, width, tech, freq):
|
||||
command = "make synth DESIGN=ppa_{}_{} TECH={} DRIVE=INV FREQ={} MAXOPT=1 MAXCORES=1".format(module, width, tech, freq)
|
||||
command = "make synth DESIGN={} WIDTH={} TECH={} DRIVE=INV FREQ={} MAXOPT=1 MAXCORES=1".format(module, width, tech, freq)
|
||||
print('here we go')
|
||||
|
||||
subprocess.Popen(command, shell=True)
|
||||
|
||||
def deleteRedundant(synthsToRun):
|
||||
@ -20,7 +26,7 @@ def deleteRedundant(synthsToRun):
|
||||
def freqSweep(module, width, tech):
|
||||
synthsToRun = []
|
||||
arr = [-8, -6, -4, -2, 0, 2, 4, 6, 8]
|
||||
allSynths = synthsfromcsv('bestSynths.csv')
|
||||
allSynths = synthsfromcsv('ppa/bestSynths.csv')
|
||||
for synth in allSynths:
|
||||
if (synth.module == module) & (synth.tech == tech) & (synth.width == width):
|
||||
f = 1000/synth.delay
|
||||
@ -54,20 +60,20 @@ def allCombos(widths, modules, techs, freqs):
|
||||
if __name__ == '__main__':
|
||||
|
||||
##### Run specific syntheses
|
||||
widths = [8, 16, 32, 64, 128]
|
||||
modules = ['mult', 'add', 'shiftleft', 'flop', 'comparator', 'priorityencoder', 'add', 'csa', 'mux2', 'mux4', 'mux8']
|
||||
techs = ['sky90', 'tsmc28']
|
||||
freqs = [5000]
|
||||
synthsToRun = allCombos(widths, modules, techs, freqs)
|
||||
widths = [8, 16, 32, 64, 128]
|
||||
modules = ['mult', 'add', 'shiftleft', 'flop', 'comparator', 'priorityencoder', 'add', 'csa', 'mux2', 'mux4', 'mux8']
|
||||
techs = ['sky90', 'tsmc28']
|
||||
freqs = [5000]
|
||||
synthsToRun = allCombos(widths, modules, techs, freqs)
|
||||
|
||||
##### Run a sweep based on best delay found in existing syntheses
|
||||
module = 'add'
|
||||
width = 32
|
||||
tech = 'sky90'
|
||||
synthsToRun = freqSweep(module, width, tech)
|
||||
module = 'add'
|
||||
width = 32
|
||||
tech = 'sky90'
|
||||
synthsToRun = freqSweep(module, width, tech)
|
||||
|
||||
##### Only do syntheses for which a run doesn't already exist
|
||||
synthsToRun = filterRedundant(synthsToRun)
|
||||
|
||||
pool = Pool(processes=25)
|
||||
pool.starmap(print, synthsToRun)
|
||||
synthsToRun = filterRedundant(synthsToRun)
|
||||
|
||||
pool = Pool(processes=25)
|
||||
pool.starmap(runCommand, synthsToRun)
|
||||
|
@ -21,7 +21,7 @@ args=parser.parse_args()
|
||||
|
||||
fin_path = glob.glob(f"{os.getenv('WALLY')}/src/**/{args.DESIGN}.sv",recursive=True)[0]
|
||||
|
||||
fin = open(fin_path, "r")
|
||||
fin = open(fin_path, "r", encoding='utf-8')
|
||||
|
||||
lines = fin.readlines()
|
||||
|
||||
@ -70,4 +70,4 @@ fout.write(buf)
|
||||
fin.close()
|
||||
fout.close()
|
||||
|
||||
#print(buf)
|
||||
#print(buf)
|
||||
|
Loading…
Reference in New Issue
Block a user