mirror of
				https://github.com/openhwgroup/cvw
				synced 2025-02-11 06:05:49 +00:00 
			
		
		
		
	Merge branch 'main' of https://github.com/openhwgroup/cvw into dev
This commit is contained in:
		
						commit
						bae3772548
					
				@ -6,7 +6,7 @@
 | 
				
			|||||||
echo "Executing Wally setup.csh"
 | 
					echo "Executing Wally setup.csh"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Path to Wally repository
 | 
					# Path to Wally repository
 | 
				
			||||||
set WALLY = $PWD
 | 
					setenv WALLY $PWD
 | 
				
			||||||
echo '$WALLY set to ' ${WALLY}
 | 
					echo '$WALLY set to ' ${WALLY}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Extend alias which makes extending PATH much easier.
 | 
					# Extend alias which makes extending PATH much easier.
 | 
				
			||||||
 | 
				
			|||||||
@ -31,3 +31,12 @@ SAIFPOWER
 | 
				
			|||||||
        0: switching factor power analysis
 | 
					        0: switching factor power analysis
 | 
				
			||||||
        1: RTL simulation driven 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
 | 
					#!/usr/bin/python3
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# Python regression test for DC
 | 
				
			||||||
# Madeleine Masser-Frye mmasserfrye@hmc.edu 5/22
 | 
					# Madeleine Masser-Frye mmasserfrye@hmc.edu 5/22
 | 
				
			||||||
 | 
					# James Stine james.stine@okstate.edu 15 October 2023
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import scipy.optimize as opt
 | 
					import scipy.optimize as opt
 | 
				
			||||||
import subprocess
 | 
					import subprocess
 | 
				
			||||||
@ -565,6 +569,7 @@ def makeLineLegend():
 | 
				
			|||||||
    fullLeg += [lines.Line2D([0], [0], color='black', label='smallest', linestyle='--')]
 | 
					    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='blue', label='tsmc28', marker='^')]
 | 
				
			||||||
    fullLeg += [lines.Line2D([0], [0], color='green', label='sky90', marker='o')]
 | 
					    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='_')]
 | 
					    fullLeg += [lines.Line2D([0], [0], color='red', label='combined', marker='_')]
 | 
				
			||||||
    fig.legend(handles=fullLeg, ncol=5, handlelength=1.4, loc='center') 
 | 
					    fig.legend(handles=fullLeg, ncol=5, handlelength=1.4, loc='center') 
 | 
				
			||||||
    saveStr = './plots/legend.png'
 | 
					    saveStr = './plots/legend.png'
 | 
				
			||||||
@ -689,7 +694,7 @@ def makePlotDirectory():
 | 
				
			|||||||
            os.makedirs(new_directory)
 | 
					            os.makedirs(new_directory)
 | 
				
			||||||
        os.chdir(new_directory)
 | 
					        os.chdir(new_directory)
 | 
				
			||||||
        if 'freq' in folder:
 | 
					        if 'freq' in folder:
 | 
				
			||||||
            for tech in ['sky90', 'tsmc28']:
 | 
					            for tech in ['sky90', 'sky130', 'tsmc28']:
 | 
				
			||||||
                for mod in modules:
 | 
					                for mod in modules:
 | 
				
			||||||
                    tech_directory = os.path.join(new_directory, tech)
 | 
					                    tech_directory = os.path.join(new_directory, tech)
 | 
				
			||||||
                    mod_directory = os.path.join(tech_directory, mod)
 | 
					                    mod_directory = os.path.join(tech_directory, mod)
 | 
				
			||||||
@ -702,15 +707,14 @@ def makePlotDirectory():
 | 
				
			|||||||
if __name__ == '__main__':
 | 
					if __name__ == '__main__':
 | 
				
			||||||
    ##############################
 | 
					    ##############################
 | 
				
			||||||
    # set up stuff, global variables
 | 
					    # set up stuff, global variables
 | 
				
			||||||
    widths = [8, 16, 32, 64, 128]
 | 
						widths = [8, 16, 32, 64, 128]
 | 
				
			||||||
    modules = ['priorityencoder', 'add', 'csa', 'shiftleft', 'comparator', 'flop', 'mux2', 'mux4', 'mux8', 'mult'] #, 'mux2d', 'mux4d', 'mux8d']
 | 
					    modules = ['priorityencoder', 'add', 'csa', 'shiftleft', 'comparator', 'flop', 'mux2', 'mux4', 'mux8', 'mult'] 
 | 
				
			||||||
    normAddWidth = 32 # divisor to use with N since normalizing to add_32
 | 
					    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 = {'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.update(dict.fromkeys(['mux2', 'mux4', 'mux8'], ['cg', 'l', 'l']))
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    TechSpec = namedtuple("TechSpec", "tech color shape delay area lpower denergy")
 | 
					    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]
 | 
					    techSpecs = [TechSpec(*t) for t in techSpecs]
 | 
				
			||||||
    combined = TechSpec('combined fit', 'red', '_', 0, 0, 0, 0)
 | 
					    combined = TechSpec('combined fit', 'red', '_', 0, 0, 0, 0)
 | 
				
			||||||
    ##############################
 | 
					    ##############################
 | 
				
			||||||
@ -731,7 +735,8 @@ if __name__ == '__main__':
 | 
				
			|||||||
    for mod in modules:
 | 
					    for mod in modules:
 | 
				
			||||||
        for w in widths:
 | 
					        for w in widths:
 | 
				
			||||||
            freqPlot('sky90', mod, w)
 | 
					            freqPlot('sky90', mod, w)
 | 
				
			||||||
            freqPlot('tsmc28', mod, w)
 | 
					            #freqPlot('sky130', mod, w)			
 | 
				
			||||||
        plotPPA(mod, norm=False)
 | 
					            #freqPlot('tsmc28', mod, w)
 | 
				
			||||||
        plotPPA(mod, aleOpt=True)
 | 
					        #plotPPA(mod, norm=False)
 | 
				
			||||||
 | 
					        #plotPPA(mod, aleOpt=True)
 | 
				
			||||||
        plt.close('all')
 | 
					        plt.close('all')
 | 
				
			||||||
@ -1,5 +1,9 @@
 | 
				
			|||||||
#!/usr/bin/python3
 | 
					#!/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 subprocess
 | 
				
			||||||
import re
 | 
					import re
 | 
				
			||||||
@ -7,7 +11,9 @@ from multiprocessing import Pool
 | 
				
			|||||||
from ppaAnalyze import synthsfromcsv
 | 
					from ppaAnalyze import synthsfromcsv
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def runCommand(module, width, tech, freq):
 | 
					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)
 | 
					    subprocess.Popen(command, shell=True)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def deleteRedundant(synthsToRun):
 | 
					def deleteRedundant(synthsToRun):
 | 
				
			||||||
@ -20,7 +26,7 @@ def deleteRedundant(synthsToRun):
 | 
				
			|||||||
def freqSweep(module, width, tech):
 | 
					def freqSweep(module, width, tech):
 | 
				
			||||||
    synthsToRun = []
 | 
					    synthsToRun = []
 | 
				
			||||||
    arr = [-8, -6, -4, -2, 0, 2, 4, 6, 8]
 | 
					    arr = [-8, -6, -4, -2, 0, 2, 4, 6, 8]
 | 
				
			||||||
    allSynths = synthsfromcsv('bestSynths.csv')
 | 
					    allSynths = synthsfromcsv('ppa/bestSynths.csv')
 | 
				
			||||||
    for synth in allSynths:
 | 
					    for synth in allSynths:
 | 
				
			||||||
        if (synth.module == module) & (synth.tech == tech) & (synth.width == width):
 | 
					        if (synth.module == module) & (synth.tech == tech) & (synth.width == width):
 | 
				
			||||||
            f = 1000/synth.delay
 | 
					            f = 1000/synth.delay
 | 
				
			||||||
@ -54,20 +60,20 @@ def allCombos(widths, modules, techs, freqs):
 | 
				
			|||||||
if __name__ == '__main__':
 | 
					if __name__ == '__main__':
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    ##### Run specific syntheses
 | 
					    ##### Run specific syntheses
 | 
				
			||||||
    widths = [8, 16, 32, 64, 128] 
 | 
						widths = [8, 16, 32, 64, 128] 
 | 
				
			||||||
    modules = ['mult', 'add', 'shiftleft', 'flop', 'comparator', 'priorityencoder', 'add', 'csa', 'mux2', 'mux4', 'mux8']
 | 
						modules = ['mult', 'add', 'shiftleft', 'flop', 'comparator', 'priorityencoder', 'add', 'csa', 'mux2', 'mux4', 'mux8']
 | 
				
			||||||
    techs = ['sky90', 'tsmc28']
 | 
						techs = ['sky90', 'tsmc28']
 | 
				
			||||||
    freqs = [5000]
 | 
						freqs = [5000]
 | 
				
			||||||
    synthsToRun = allCombos(widths, modules, techs, freqs)
 | 
						synthsToRun = allCombos(widths, modules, techs, freqs)
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    ##### Run a sweep based on best delay found in existing syntheses
 | 
					    ##### Run a sweep based on best delay found in existing syntheses
 | 
				
			||||||
    module = 'add'
 | 
						module = 'add'
 | 
				
			||||||
    width = 32
 | 
						width = 32
 | 
				
			||||||
    tech = 'sky90'
 | 
						tech = 'sky90'
 | 
				
			||||||
    synthsToRun = freqSweep(module, width, tech)
 | 
						synthsToRun = freqSweep(module, width, tech)
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
    ##### Only do syntheses for which a run doesn't already exist
 | 
					    ##### Only do syntheses for which a run doesn't already exist
 | 
				
			||||||
    synthsToRun = filterRedundant(synthsToRun)
 | 
						synthsToRun = filterRedundant(synthsToRun)
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
    pool = Pool(processes=25)
 | 
						pool = Pool(processes=25)
 | 
				
			||||||
    pool.starmap(print, synthsToRun)
 | 
						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_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()
 | 
					lines = fin.readlines()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user