mirror of
				https://github.com/openhwgroup/cvw
				synced 2025-02-11 06:05:49 +00:00 
			
		
		
		
	made parallel synthesis in python command line based
This commit is contained in:
		
							parent
							
								
									c5dfefe669
								
							
						
					
					
						commit
						56f002b707
					
				@ -1,29 +0,0 @@
 | 
				
			|||||||
#!/usr/bin/bash
 | 
					 | 
				
			||||||
# Madeleine Masser-Frye mmasserfrye@hmc.edu July 2022
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
helpFunction()
 | 
					 | 
				
			||||||
{  echo ""
 | 
					 | 
				
			||||||
   echo "Usage: $0 "
 | 
					 | 
				
			||||||
   echo -e "\t--configs    Synthesizes wally with configurations 32e, 32ic, 64ic, 32gc, and 64gc"
 | 
					 | 
				
			||||||
   echo -e "\t--freqs NUM  Synthesizes rv32e with target frequencies at NUM MHz and +/- 2, 4, 6, 8 %"
 | 
					 | 
				
			||||||
   echo -e "\t--features   Synthesizes rv64gc versions FPUoff, noMulDiv, noPriv, PMP0, PMP16"
 | 
					 | 
				
			||||||
   exit 1 # Exit script after printing help
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
VALID_ARGS=$(getopt -o cft: --long configs,features,freqs: -- "$@")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
eval set -- "$VALID_ARGS"
 | 
					 | 
				
			||||||
unset VALID_ARGS
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if [[ $1 == "--" ]]; 
 | 
					 | 
				
			||||||
    then helpFunction
 | 
					 | 
				
			||||||
elif [[ $1 == "--freqs" ]] && [[ ! $2 =~ ^[[:digit:]]+$ ]]
 | 
					 | 
				
			||||||
    then echo "Argument must be an integer, target frequnecy is in MHz"
 | 
					 | 
				
			||||||
else
 | 
					 | 
				
			||||||
    make clean
 | 
					 | 
				
			||||||
    make del
 | 
					 | 
				
			||||||
    make copy 
 | 
					 | 
				
			||||||
    make configs 
 | 
					 | 
				
			||||||
    ./wallySynth.py $1 $2
 | 
					 | 
				
			||||||
    ./extractSummary.py
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
@ -3,44 +3,62 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import subprocess
 | 
					import subprocess
 | 
				
			||||||
from multiprocessing import Pool
 | 
					from multiprocessing import Pool
 | 
				
			||||||
import time
 | 
					import argparse
 | 
				
			||||||
import sys
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
def runSynth(config, tech, freq):
 | 
					def runSynth(config, tech, freq, maxopt):
 | 
				
			||||||
    global pool
 | 
					    global pool
 | 
				
			||||||
    command = "make synth DESIGN=wallypipelinedcore CONFIG={} TECH={} DRIVE=FLOP FREQ={} MAXOPT=1 MAXCORES=1".format(config, tech, freq)
 | 
					    command = "make synth DESIGN=wallypipelinedcore CONFIG={} TECH={} DRIVE=FLOP FREQ={} MAXOPT={} MAXCORES=1".format(config, tech, freq, maxopt)
 | 
				
			||||||
    pool.map(mask, [command])
 | 
					    pool.map(mask, [command])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def mask(command):
 | 
					def mask(command):
 | 
				
			||||||
    subprocess.Popen(command, shell=True)
 | 
					    subprocess.Popen(command, shell=True)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
testFreq = [3000, 10000]
 | 
					def freshStart():
 | 
				
			||||||
 | 
					    out = subprocess.check_output(['bash','-c', 'make clean'])
 | 
				
			||||||
 | 
					    for x in out.decode("utf-8").split('\n')[:-1]:
 | 
				
			||||||
 | 
					        print(x)
 | 
				
			||||||
 | 
					    return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if __name__ == '__main__':
 | 
					if __name__ == '__main__':
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    i = 0
 | 
					 | 
				
			||||||
    techs = ['sky90', 'tsmc28']
 | 
					    techs = ['sky90', 'tsmc28']
 | 
				
			||||||
    synthsToRun = []
 | 
					    allConfigs = ['rv32gc', 'rv32ic', 'rv64gc', 'rv64ic', 'rv32e', 'rv32i', 'rv64i']
 | 
				
			||||||
    tech = techs[i]
 | 
					    freqVaryPct = [-20, -12, -8, -6, -4, -2, 0, 2, 4, 6, 8, 12, 20]
 | 
				
			||||||
    freq = testFreq[i]
 | 
					
 | 
				
			||||||
    arr = [-8, -6, -4, -2, 0, 2, 4, 6, 8]
 | 
					 | 
				
			||||||
    pool = Pool()
 | 
					    pool = Pool()
 | 
				
			||||||
    staggerPeriod = 60 #seconds
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    typeToRun = sys.argv[1]
 | 
					    parser = argparse.ArgumentParser()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if 'configs' in typeToRun:
 | 
					    parser.add_argument("-s", "--freqsweep", type=int, help = "Synthesize wally with target frequencies at given MHz and +/- 2, 4, 6, 8 %%")
 | 
				
			||||||
 | 
					    parser.add_argument("-c", "--configsweep", action='store_true', help = "Synthesize wally with configurations 32e, 32ic, 64ic, 32gc, and 64gc")
 | 
				
			||||||
 | 
					    parser.add_argument("-f", "--featuresweep", action='store_true', help = "Synthesize wally with features turned off progressively to visualize critical path")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    parser.add_argument("-v", "--version", choices=allConfigs, help = "Configuration of wally")
 | 
				
			||||||
 | 
					    parser.add_argument("-t", "--targetfreq", type=int, help = "Target frequncy")
 | 
				
			||||||
 | 
					    parser.add_argument("-e", "--tech", choices=techs, help = "Technology")
 | 
				
			||||||
 | 
					    parser.add_argument("-o", "--maxopt", action='store_true', help = "Turn on MAXOPT")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    args = parser.parse_args()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    freq = args.targetfreq if args.targetfreq else 3000
 | 
				
			||||||
 | 
					    tech = args.tech if args.tech else 'sky90'
 | 
				
			||||||
 | 
					    maxopt = int(args.maxopt)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if args.freqsweep:
 | 
				
			||||||
 | 
					        sc = args.freqsweep
 | 
				
			||||||
 | 
					        config = args.version if args.version else 'rv32e'
 | 
				
			||||||
 | 
					        freshStart()
 | 
				
			||||||
 | 
					        for freq in [round(sc+sc*x/100) for x in freqVaryPct]: # rv32e freq sweep
 | 
				
			||||||
 | 
					            runSynth(config, tech, freq, maxopt)
 | 
				
			||||||
 | 
					    if args.configsweep:
 | 
				
			||||||
 | 
					        freshStart()
 | 
				
			||||||
        for config in ['rv32gc', 'rv32ic', 'rv64gc', 'rv64ic', 'rv32e']: # configs
 | 
					        for config in ['rv32gc', 'rv32ic', 'rv64gc', 'rv64ic', 'rv32e']: # configs
 | 
				
			||||||
            config = config + '_orig' # until memory integrated
 | 
					            config = config + '_orig' # until memory integrated
 | 
				
			||||||
            runSynth(config, tech, freq)
 | 
					            runSynth(config, tech, freq, maxopt)
 | 
				
			||||||
            time.sleep(staggerPeriod)
 | 
					    if args.featuresweep:
 | 
				
			||||||
    elif 'features' in typeToRun:
 | 
					        freshStart()
 | 
				
			||||||
 | 
					        v = args.version if args.version else 'rv64gc'
 | 
				
			||||||
        for mod in ['FPUoff', 'noMulDiv', 'noPriv', 'PMP0', 'PMP16']: # rv64gc path variations
 | 
					        for mod in ['FPUoff', 'noMulDiv', 'noPriv', 'PMP0', 'PMP16']: # rv64gc path variations
 | 
				
			||||||
            config = 'rv64gc_' + mod
 | 
					            config = v + '_' + mod
 | 
				
			||||||
            runSynth(config, tech, freq)
 | 
					            runSynth(config, tech, freq, maxopt)
 | 
				
			||||||
            time.sleep(staggerPeriod)
 | 
					 | 
				
			||||||
    elif 'freqs' in typeToRun:
 | 
					 | 
				
			||||||
        sc = int(sys.argv[2])
 | 
					 | 
				
			||||||
        config = 'rv32e'
 | 
					 | 
				
			||||||
        for freq in [round(sc+sc*x/100) for x in arr]: # rv32e freq sweep
 | 
					 | 
				
			||||||
            runSynth(config, tech, freq)
 | 
					 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user