mirror of
				https://github.com/openhwgroup/cvw
				synced 2025-02-11 06:05:49 +00:00 
			
		
		
		
	Merge branch 'main' of https://github.com/davidharrishmc/riscv-wally
This commit is contained in:
		
						commit
						57f83bcbd6
					
				
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -75,6 +75,7 @@ synthDC/alib-52 | ||||
| synthDC/*.log | ||||
| synthDC/*.svf | ||||
| synthDC/runs/ | ||||
| synthDC/newRuns | ||||
| synthDC/PPAruns | ||||
| synthDC/plots/ | ||||
| synthDC/runArchive | ||||
|  | ||||
| @ -5,10 +5,10 @@ NAME := synth | ||||
| 
 | ||||
| # defaults
 | ||||
| export DESIGN ?= wallypipelinedcore | ||||
| export FREQ ?= 500 | ||||
| export CONFIG ?= rv32e | ||||
| export FREQ ?= 4000 | ||||
| export CONFIG ?= rv64gc | ||||
| # sky130 and sky90 presently supported
 | ||||
| export TECH ?= sky130 | ||||
| export TECH ?= tsmc28 | ||||
| # MAXCORES allows parallel compilation, which is faster but less CPU-efficient
 | ||||
| # Avoid when doing sweeps of many optimization points in parallel
 | ||||
| export MAXCORES ?= 4 | ||||
| @ -19,7 +19,7 @@ export DRIVE ?= FLOP | ||||
| 
 | ||||
| time := $(shell date +%F-%H-%M) | ||||
| 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 | ||||
| 
 | ||||
| CONFIGDIR ?= ${WALLY}/pipelined/config | ||||
|  | ||||
| @ -1,30 +1,13 @@ | ||||
| #!/usr/bin/python3 | ||||
| # Shreya Sanghai (ssanghai@hmc.edu) 2/28/2022 | ||||
| # Madeleine Masser-Frye (mmmasserfrye@hmc.edu) 06/2022 | ||||
| from collections import namedtuple | ||||
| import glob  | ||||
| import re | ||||
| import csv | ||||
| import subprocess | ||||
| from matplotlib.cbook import flatten | ||||
| import matplotlib.pyplot as plt | ||||
| 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(): | ||||
|     ''' writes a CSV with one line for every available synthesis | ||||
| @ -100,8 +83,6 @@ def freqPlot(tech, width, config): | ||||
|             areasL[ind] += [oneSynth.area] | ||||
|      | ||||
|     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]: | ||||
|         areas = areasL[ind] | ||||
| @ -120,11 +101,13 @@ def freqPlot(tech, width, config): | ||||
|                        lines.Line2D([0], [0], color='blue', ls='', marker='o', label='slack violated')] | ||||
| 
 | ||||
|     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)") | ||||
|     ax1.set_ylabel('Delay (ns)') | ||||
|     ax2.set_ylabel('Area (sq microns)') | ||||
|     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() | ||||
| 
 | ||||
| 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.xlabel('Delay (ns)') | ||||
|     plt.ylabel('Area (sq microns)') | ||||
|     titleStr = tech + ' ' +width | ||||
|     if config: titleStr += config | ||||
|     if special: titleStr += special | ||||
|     ytop = ax1.get_ylim()[1] | ||||
|     plt.ylim(ymin=0, ymax=1.1*ytop) | ||||
|     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) + ')' | ||||
|     plt.title(titleStr) | ||||
| 
 | ||||
|     for i in range(len(labels)): | ||||
|         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 | ||||
| 
 | ||||
| @ -167,5 +158,4 @@ if __name__ == '__main__': | ||||
|     synthsfromcsv('Summary.csv') | ||||
|     freqPlot('tsmc28', 'rv64', 'gc') | ||||
|     areaDelay('rv32', 'tsmc28', 4200, config='gc') | ||||
|     areaDelay('rv32', 'tsmc28', 3042, special='') | ||||
| 
 | ||||
|     areaDelay('rv32', 'tsmc28', 3042, special='') | ||||
							
								
								
									
										6
									
								
								synthDC/runAllSynths.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										6
									
								
								synthDC/runAllSynths.sh
									
									
									
									
									
										Executable 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 | ||||
| @ -6,6 +6,20 @@ import csv | ||||
| import linecache | ||||
| 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(): | ||||
|     data = [] | ||||
|  | ||||
							
								
								
									
										31
									
								
								synthDC/wallySynth.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										31
									
								
								synthDC/wallySynth.py
									
									
									
									
									
										Executable 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) | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user