2023-11-17 22:25:35 +00:00
|
|
|
#
|
|
|
|
# Makefile for synthesis
|
|
|
|
# Shreya Sanghai (ssanghai@hmc.edu) 2/28/2022
|
|
|
|
# Madeleine Masser-Frye (mmasserfrye@hmc.edu) 1/27/2023
|
2023-08-29 15:25:31 +00:00
|
|
|
NAME := synth
|
2022-02-09 21:06:42 +00:00
|
|
|
# defaults
|
|
|
|
export DESIGN ?= wallypipelinedcore
|
2023-02-05 00:02:50 +00:00
|
|
|
export FREQ ?= 10000
|
|
|
|
export CONFIG ?= rv64gc
|
2023-01-26 04:58:15 +00:00
|
|
|
export MOD ?= orig
|
2022-07-08 22:39:53 +00:00
|
|
|
# title to add a note in the synth's directory name
|
2022-07-08 08:02:11 +00:00
|
|
|
TITLE =
|
|
|
|
# tsmc28, sky130, and sky90 presently supported
|
2023-11-13 08:39:25 +00:00
|
|
|
export TECH ?= sky130
|
2022-02-14 01:22:17 +00:00
|
|
|
# MAXCORES allows parallel compilation, which is faster but less CPU-efficient
|
|
|
|
# Avoid when doing sweeps of many optimization points in parallel
|
2022-07-07 15:52:01 +00:00
|
|
|
export MAXCORES ?= 1
|
2022-02-14 01:22:17 +00:00
|
|
|
# MAXOPT turns on flattening, boundary optimization, and retiming
|
|
|
|
# The output netlist is hard to interpret, but significantly better PPA
|
2022-07-07 15:52:01 +00:00
|
|
|
export MAXOPT ?= 0
|
2022-06-23 23:16:43 +00:00
|
|
|
export DRIVE ?= FLOP
|
2023-02-18 01:37:05 +00:00
|
|
|
export USESRAM ?= 0
|
2023-11-11 03:10:35 +00:00
|
|
|
export WIDTH ?= 32
|
2022-02-09 21:06:42 +00:00
|
|
|
|
|
|
|
time := $(shell date +%F-%H-%M)
|
|
|
|
hash := $(shell git rev-parse --short HEAD)
|
2023-11-17 23:10:57 +00:00
|
|
|
export OUTPUTDIR := runs/$(DESIGN)_$(CONFIG)_$(MOD)_$(TECH)nm_$(FREQ)_MHz_$(time)_$(TITLE)_$(hash)
|
2023-11-17 22:25:35 +00:00
|
|
|
export SAIFPOWER ?= 0
|
2022-01-30 23:34:56 +00:00
|
|
|
|
2023-02-02 22:14:11 +00:00
|
|
|
OLDCONFIGDIR ?= ${WALLY}/config
|
2023-02-04 10:24:01 +00:00
|
|
|
export CONFIGDIR ?= $(OUTPUTDIR)/config
|
2022-04-25 16:03:02 +00:00
|
|
|
|
2022-01-30 23:34:56 +00:00
|
|
|
default:
|
2022-07-08 22:39:53 +00:00
|
|
|
@echo " Basic synthesis procedure for Wally:"
|
|
|
|
@echo " Invoke with make synth"
|
|
|
|
@echo "Use wallySynth.py to run a concurrent sweep "
|
2022-02-17 17:57:02 +00:00
|
|
|
|
2022-02-27 09:50:10 +00:00
|
|
|
|
2023-01-29 19:40:08 +00:00
|
|
|
DIRS32 = rv32e rv32gc rv32imc rv32i
|
2023-01-26 04:58:15 +00:00
|
|
|
DIRS64 = rv64i rv64gc
|
2022-07-07 15:52:01 +00:00
|
|
|
DIRS = $(DIRS32) $(DIRS64)
|
|
|
|
|
2023-01-30 18:54:19 +00:00
|
|
|
# k = 3 6
|
2022-04-25 16:03:02 +00:00
|
|
|
# bpred:
|
|
|
|
# @$(foreach kval, $(k), rm -rf $(CONFIGDIR)/rv64gc_bpred_$(kval);)
|
|
|
|
# @$(foreach kval, $(k), cp -r $(CONFIGDIR)/rv64gc $(CONFIGDIR)/rv64gc_bpred_$(kval);)
|
2023-07-24 18:32:46 +00:00
|
|
|
# @$(foreach kval, $(k), sed -i 's/BPRED_SIZE.*/BPRED_SIZE $(kval)/g' $(CONFIGDIR)/rv64gc_bpred_$(kval)/config.vh;)
|
2022-04-25 16:03:02 +00:00
|
|
|
# @$(foreach kval, $(k), make synth DESIGN=wallypipelinedcore CONFIG=rv64gc_bpred_$(kval) TECH=sky90 FREQ=500 MAXCORES=4 --jobs;)
|
2022-07-08 22:52:10 +00:00
|
|
|
|
2023-01-30 18:54:19 +00:00
|
|
|
configs: $(CONFIG)
|
|
|
|
$(CONFIG):
|
|
|
|
@echo $(CONFIG)
|
2023-02-04 09:50:36 +00:00
|
|
|
cp -r $(OLDCONFIGDIR)/shared/*.vh $(CONFIGDIR)
|
|
|
|
cp -r $(OLDCONFIGDIR)/$(CONFIG)/* $(CONFIGDIR)
|
|
|
|
|
2023-02-05 00:02:50 +00:00
|
|
|
# adjust DTIM and IROM to reasonable values depending on config
|
|
|
|
ifneq ($(filter $(CONFIG), $(DIRS32)),)
|
2023-08-24 11:54:09 +00:00
|
|
|
sed -i "s/DTIM_RANGE.*/DTIM_RANGE = 34\'h01FF;/g" $(CONFIGDIR)/config.vh
|
|
|
|
sed -i "s/IROM_RANGE.*/IROM_RANGE = 34\'h01FF;/g" $(CONFIGDIR)/config.vh
|
2023-02-05 00:02:50 +00:00
|
|
|
else ifneq ($(filter $(CONFIG), $(DIRS64)),)
|
2023-08-24 11:54:09 +00:00
|
|
|
sed -i "s/DTIM_RANGE.*/DTIM_RANGE = 56\'h01FF;/g" $(CONFIGDIR)/config.vh
|
|
|
|
sed -i "s/IROM_RANGE.*/IROM_RANGE = 56\'h01FF;/g" $(CONFIGDIR)/config.vh
|
2023-02-05 00:02:50 +00:00
|
|
|
else
|
|
|
|
$(info $(CONFIG) does not exist in $(DIRS32) or $(DIRS64))
|
|
|
|
@echo "Config not in list, RAM_RANGE will be unmodified"
|
|
|
|
endif
|
|
|
|
|
|
|
|
# if USESRAM = 1, set that in the config file, otherwise reduce sizes
|
2023-02-04 09:50:36 +00:00
|
|
|
ifeq ($(USESRAM), 1)
|
2023-08-24 11:54:09 +00:00
|
|
|
sed -i 's/USE_SRAM.*/USE_SRAM = 1;/g' $(CONFIGDIR)/config.vh
|
2023-02-04 09:50:36 +00:00
|
|
|
else
|
2023-08-21 15:33:27 +00:00
|
|
|
sed -i "s/WAYSIZEINBYTES.*/WAYSIZEINBYTES = 32\'d512;/g" $(CONFIGDIR)/config.vh
|
|
|
|
sed -i "s/NUMWAYS.*/NUMWAYS =32\'d1;/g" $(CONFIGDIR)/config.vh
|
|
|
|
sed -i "s/BPRED_SIZE.*/BPRED_SIZE =32\'d5;/g" $(CONFIGDIR)/config.vh
|
|
|
|
sed -i "s/BTB_SIZE.*/BTB_SIZE = 32\'d5;/g" $(CONFIGDIR)/config.vh
|
2023-02-05 00:02:50 +00:00
|
|
|
ifneq ($(filter $(CONFIG), $(DIRS32)),)
|
2023-08-24 11:54:09 +00:00
|
|
|
sed -i "s/BOOTROM_RANGE.*/BOOTROM_RANGE = 34\'h01FF;/g" $(CONFIGDIR)/config.vh
|
|
|
|
sed -i "s/UNCORE_RAM_RANGE.*/UNCORE_RAM_RANGE = 34\'h01FF;/g" $(CONFIGDIR)/config.vh
|
2023-02-05 00:02:50 +00:00
|
|
|
else ifneq ($(filter $(CONFIG), $(DIRS64)),)
|
2023-08-21 15:33:27 +00:00
|
|
|
sed -i "s/BOOTROM_RANGE.*/BOOTROM_RANGE = 56\'h01FF;/g" $(CONFIGDIR)/config.vh
|
2023-08-24 11:54:09 +00:00
|
|
|
sed -i "s/UNCORE_RAM_RANGE.*/UNCORE_RAM_RANGE = 56\'h01FF;/g" $(CONFIGDIR)/config.vh
|
2023-02-05 00:02:50 +00:00
|
|
|
endif
|
2023-01-26 04:58:15 +00:00
|
|
|
endif
|
2022-07-08 22:52:10 +00:00
|
|
|
|
2023-02-05 00:02:50 +00:00
|
|
|
# adjust config if synthesizing with any modifications
|
2023-02-15 14:39:10 +00:00
|
|
|
# This code is subtle with ifneq. It successively turns off a larger
|
|
|
|
# set of features in order of cycle time limiting.
|
|
|
|
# When mod = orig, all features are ON
|
|
|
|
# When mod = PMP0, the number of PMP entries is set to 0
|
|
|
|
# when mod = noPriv, the privileged unit and PMP are disabled
|
|
|
|
# when mod = noFPU, the FPU, privileged unit, and PMP are disabled
|
|
|
|
# when mod = noMulDiv, the MDU, FPU, privileged unit, and PMP are disabled.
|
2023-02-20 04:05:39 +00:00
|
|
|
# when mod = noAtomic, the Atomic, MDU, FPU, privileged unit, and PMP are disabled
|
2023-02-15 14:39:10 +00:00
|
|
|
|
2023-02-07 20:07:43 +00:00
|
|
|
ifneq ($(MOD), orig)
|
|
|
|
# PMP 0
|
2023-11-19 04:56:50 +00:00
|
|
|
sed -i 's/PMP_ENTRIES.*\(64\|16\)/PMP_ENTRIES = 0;/' $(CONFIGDIR)/config.vh
|
2023-02-07 20:07:43 +00:00
|
|
|
ifneq ($(MOD), PMP0)
|
|
|
|
# no priv
|
2023-11-19 04:56:50 +00:00
|
|
|
sed -i 's/ZICSR_SUPPORTED.*1/ZICSR_SUPPORTED = 0;/' $(CONFIGDIR)/config.vh
|
2023-02-07 20:07:43 +00:00
|
|
|
ifneq ($(MOD), noPriv)
|
2022-07-08 22:29:18 +00:00
|
|
|
# turn off FPU
|
2023-07-24 18:32:46 +00:00
|
|
|
sed -i 's/1 *<< *3/0 << 3/' $(CONFIGDIR)/config.vh
|
|
|
|
sed -i 's/1 *<< *5/0 << 5/' $(CONFIGDIR)/config.vh
|
2023-02-07 20:07:43 +00:00
|
|
|
ifneq ($(MOD), noFPU)
|
2022-07-08 22:29:18 +00:00
|
|
|
# no muldiv
|
2023-07-24 18:32:46 +00:00
|
|
|
sed -i 's/1 *<< *12/0 << 12/' $(CONFIGDIR)/config.vh
|
2023-02-20 04:05:39 +00:00
|
|
|
ifneq ($(MOD), noMulDiv)
|
|
|
|
# no atomic
|
2023-07-24 18:32:46 +00:00
|
|
|
sed -i 's/1 *<< *0/0 << 0/' $(CONFIGDIR)/config.vh
|
2023-02-20 04:05:39 +00:00
|
|
|
endif
|
2023-02-07 20:07:43 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
2023-01-26 04:58:15 +00:00
|
|
|
endif
|
|
|
|
|
2023-01-30 18:54:19 +00:00
|
|
|
ifeq ($(SAIFPOWER), 1)
|
2023-02-02 22:48:23 +00:00
|
|
|
cp -f ../sim/power.saif .
|
2023-01-30 18:54:19 +00:00
|
|
|
endif
|
|
|
|
|
2023-01-26 04:58:15 +00:00
|
|
|
mkdirecs:
|
2022-01-30 23:34:56 +00:00
|
|
|
@echo "DC Synthesis"
|
2022-02-09 21:06:42 +00:00
|
|
|
@mkdir -p $(OUTPUTDIR)
|
2023-02-04 10:24:01 +00:00
|
|
|
@mkdir -p $(OUTPUTDIR)/hdl
|
|
|
|
@mkdir -p $(OUTPUTDIR)/config
|
2022-02-09 21:06:42 +00:00
|
|
|
@mkdir -p $(OUTPUTDIR)/reports
|
|
|
|
@mkdir -p $(OUTPUTDIR)/mapped
|
|
|
|
@mkdir -p $(OUTPUTDIR)/unmapped
|
2023-01-26 04:58:15 +00:00
|
|
|
|
2023-10-19 17:44:03 +00:00
|
|
|
synth: mkdirecs configs rundc # clean
|
2023-01-30 18:54:19 +00:00
|
|
|
|
2023-01-26 04:58:15 +00:00
|
|
|
rundc:
|
2023-02-19 15:00:16 +00:00
|
|
|
ifeq ($(TECH), tsmc28psyn)
|
2023-02-16 14:07:17 +00:00
|
|
|
dc_shell-xg-t -64bit -topographical_mode -f scripts/$(NAME).tcl | tee $(OUTPUTDIR)/$(NAME).out
|
2023-02-19 15:00:16 +00:00
|
|
|
else
|
|
|
|
dc_shell-xg-t -64bit -f scripts/$(NAME).tcl | tee $(OUTPUTDIR)/$(NAME).out
|
2023-02-16 21:16:32 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
2023-01-26 04:58:15 +00:00
|
|
|
clean:
|
|
|
|
rm -rf $(OUTPUTDIR)/hdl
|
2022-07-08 22:29:18 +00:00
|
|
|
rm -rf $(OUTPUTDIR)/WORK
|
2022-07-09 02:40:41 +00:00
|
|
|
rm -rf $(OUTPUTDIR)/alib-52
|
2022-01-30 23:34:56 +00:00
|
|
|
rm -f default.svf
|
|
|
|
rm -f command.log
|
|
|
|
rm -f filenames*.log
|
2022-02-10 00:42:48 +00:00
|
|
|
rm -f power.saif
|
2022-06-28 02:23:29 +00:00
|
|
|
rm -f Synopsys_stack_trace_*.txt
|
2023-02-16 14:07:17 +00:00
|
|
|
rm -f crte_*.txt
|
2023-11-11 03:10:35 +00:00
|
|
|
|