2022-06-24 06:30:57 +00:00
#!/usr/bin/python3
2023-02-04 10:24:01 +00:00
# Madeleine Masser-Frye mmasserfrye@hmc.edu 1/2023
2022-06-24 06:30:57 +00:00
import subprocess
from multiprocessing import Pool
2022-07-08 20:41:59 +00:00
import argparse
2022-06-24 06:30:57 +00:00
2023-02-19 15:00:16 +00:00
def runSynth ( config , mod , tech , freq , maxopt , usesram ) :
2022-07-08 08:02:11 +00:00
global pool
2023-02-19 15:00:16 +00:00
command = " make synth DESIGN=wallypipelinedcore CONFIG= {} MOD= {} TECH= {} DRIVE=FLOP FREQ= {} MAXOPT= {} USESRAM= {} MAXCORES=1 " . format ( config , mod , tech , freq , maxopt , usesram )
2022-07-08 08:02:11 +00:00
pool . map ( mask , [ command ] )
def mask ( command ) :
subprocess . Popen ( command , shell = True )
2022-06-24 06:30:57 +00:00
2022-07-08 20:41:59 +00:00
if __name__ == ' __main__ ' :
2023-10-31 03:57:35 +00:00
techs = [ ' sky130 ' , ' sky90 ' , ' tsmc28 ' , ' tsmc28psyn ' ]
2023-01-29 19:33:54 +00:00
allConfigs = [ ' rv32gc ' , ' rv32imc ' , ' rv64gc ' , ' rv64imc ' , ' rv32e ' , ' rv32i ' , ' rv64i ' ]
2022-07-08 20:41:59 +00:00
freqVaryPct = [ - 20 , - 12 , - 8 , - 6 , - 4 , - 2 , 0 , 2 , 4 , 6 , 8 , 12 , 20 ]
2023-02-17 21:51:05 +00:00
# freqVaryPct = [-20, -10, 0, 10, 20]
2022-07-08 20:41:59 +00:00
2022-07-07 15:52:01 +00:00
pool = Pool ( )
2022-07-08 08:02:11 +00:00
2022-07-08 20:41:59 +00:00
parser = argparse . ArgumentParser ( )
parser . add_argument ( " -s " , " --freqsweep " , type = int , help = " Synthesize wally with target frequencies at given MHz and +/- 2, 4, 6, 8 %% " )
2023-01-29 19:33:54 +00:00
parser . add_argument ( " -c " , " --configsweep " , action = ' store_true ' , help = " Synthesize wally with configurations 32e, 32imc, 64ic, 32gc, and 64gc " )
2022-07-08 20:41:59 +00:00
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 " )
2023-02-04 10:24:01 +00:00
parser . add_argument ( " -r " , " --usesram " , action = ' store_true ' , help = " Use SRAM modules " )
2022-07-08 20:41:59 +00:00
args = parser . parse_args ( )
tech = args . tech if args . tech else ' sky90 '
maxopt = int ( args . maxopt )
2023-02-04 09:50:36 +00:00
usesram = int ( args . usesram )
mod = ' orig '
2022-07-08 08:02:11 +00:00
2022-07-08 20:41:59 +00:00
if args . freqsweep :
sc = args . freqsweep
config = args . version if args . version else ' rv32e '
for freq in [ round ( sc + sc * x / 100 ) for x in freqVaryPct ] : # rv32e freq sweep
2023-02-19 15:00:16 +00:00
runSynth ( config , mod , tech , freq , maxopt , usesram )
2023-02-17 18:35:39 +00:00
elif args . configsweep :
2023-02-07 21:18:39 +00:00
defaultfreq = 1500 if tech == ' sky90 ' else 5000
freq = args . targetfreq if args . targetfreq else defaultfreq
2023-01-29 19:33:54 +00:00
for config in [ ' rv32i ' , ' rv64gc ' , ' rv64i ' , ' rv32gc ' , ' rv32imc ' , ' rv32e ' ] : #configs
2023-02-19 15:00:16 +00:00
runSynth ( config , mod , tech , freq , maxopt , usesram )
2023-02-17 18:35:39 +00:00
elif args . featuresweep :
2023-02-07 21:18:39 +00:00
defaultfreq = 500 if tech == ' sky90 ' else 1500
freq = args . targetfreq if args . targetfreq else defaultfreq
2023-01-26 04:58:15 +00:00
config = args . version if args . version else ' rv64gc '
2023-02-20 04:05:39 +00:00
for mod in [ ' noAtomic ' , ' noFPU ' , ' noMulDiv ' , ' noPriv ' , ' PMP0 ' ] :
2023-02-19 15:00:16 +00:00
runSynth ( config , mod , tech , freq , maxopt , usesram )
2023-02-04 09:50:36 +00:00
else :
2023-02-07 21:18:39 +00:00
defaultfreq = 500 if tech == ' sky90 ' else 1500
freq = args . targetfreq if args . targetfreq else defaultfreq
2023-02-04 09:50:36 +00:00
config = args . version if args . version else ' rv64gc '
2023-02-19 15:00:16 +00:00
runSynth ( config , mod , tech , freq , maxopt , usesram )