From: Luke Kenneth Casson Leighton Date: Fri, 3 Aug 2018 04:57:56 +0000 (+0100) Subject: add peripherals makefile template X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3e471c8195b006be5c8b8872c5d8292fddf14283;p=pinmux.git add peripherals makefile template --- diff --git a/src/bsv/Makefile.peripherals.template b/src/bsv/Makefile.peripherals.template new file mode 100644 index 0000000..7e901cd --- /dev/null +++ b/src/bsv/Makefile.peripherals.template @@ -0,0 +1,74 @@ +### Makefile for the cclass project + +TOP_MODULE:=mkslow_peripherals +TOP_FILE:=slow_peripherals.bsv +TOP_DIR:=./ +WORKING_DIR := $(shell pwd) + +BSVINCDIR:= .:%/Prelude:%/Libraries:%/Libraries/BlueNoC: +BSVINCDIR:= $(BSVINCDIR):../../../shakti-core/src/core +BSVINCDIR:= $(BSVINCDIR):../../../shakti-core/src/core/fpu +BSVINCDIR:= $(BSVINCDIR):../../../shakti-core/src/lib +BSVINCDIR:= $(BSVINCDIR):../../../shakti-peripherals/src/core +BSVINCDIR:= $(BSVINCDIR):../../../shakti-peripherals/src/uncore/axi4 +BSVINCDIR:= $(BSVINCDIR):../../../shakti-peripherals/src/uncore/axi4lite +BSVINCDIR:= $(BSVINCDIR):../../../shakti-peripherals/src/uncore/debug +BSVINCDIR:= $(BSVINCDIR):../../../shakti-peripherals/src/lib +BSVINCDIR:= $(BSVINCDIR):../../../shakti-peripherals/src/peripherals/gpio +BSVINCDIR:= $(BSVINCDIR):../../../shakti-peripherals/src/peripherals/rgbttl +BSVINCDIR:= $(BSVINCDIR):../../../shakti-peripherals/src/peripherals/i2c +BSVINCDIR:= $(BSVINCDIR):../../../shakti-peripherals/src/peripherals/mux +BSVINCDIR:= $(BSVINCDIR):../../../shakti-peripherals/src/peripherals/plic +BSVINCDIR:= $(BSVINCDIR):../../../shakti-peripherals/src/peripherals/clint +BSVINCDIR:= $(BSVINCDIR):../../../shakti-peripherals/src/peripherals/sdram +BSVINCDIR:= $(BSVINCDIR):../../../shakti-peripherals/src/peripherals/pwm +BSVINCDIR:= $(BSVINCDIR):../../../shakti-peripherals/src/peripherals/qspi +BSVINCDIR:= $(BSVINCDIR):../../../shakti-peripherals/src/peripherals/spi +BSVINCDIR:= $(BSVINCDIR):../../../shakti-peripherals/src/peripherals/sdmmc +BSVINCDIR:= $(BSVINCDIR):../../../shakti-peripherals/src/peripherals/flexbus +BSVINCDIR:= $(BSVINCDIR):../../../shakti-peripherals/src/peripherals/jtagdtm +BSVINCDIR:= $(BSVINCDIR):../../../shakti-peripherals/src/peripherals/uart + +default: gen_verilog + +check-blue: + @if test -z "$$BLUESPECDIR"; then echo "BLUESPECDIR variable not set"; exit 1; fi; + +###### Setting the variables for bluespec compile #$############################ +BSVCOMPILEOPTS:= -check-assert -suppress-warnings G0020 -keep-fires -opt-undetermined-vals -remove-false-rules -remove-empty-rules -remove-starved-rules +BSVLINKOPTS:=-parallel-sim-link 8 -keep-fires +VERILOGDIR:=./verilog/ +BSVBUILDDIR:=./bsv_build/ +BSVOUTDIR:=./bin +################################################################################ + +########## BSIM COMPILE, LINK AND SIMULATE TARGETS ########################## +.PHONY: check-restore +check-restore: + @if [ "$(define_macros)" != "$(old_define_macros)" ]; then make clean ; fi; + +.PHONY: gen_verilog +gen_verilog: check-restore check-blue + @echo Compiling mkTbSoc in Verilog for simulations ... + @mkdir -p $(BSVBUILDDIR); + @mkdir -p $(VERILOGDIR); + bsc -u -verilog -elab -vdir $(VERILOGDIR) -bdir $(BSVBUILDDIR) \ + -info-dir $(BSVBUILDDIR) $(define_macros) \ + -D RV64=True -D muldiv=True -D sequential=True \ + -D atomic=True -D spfpu=True -D dpfpu=True \ + -D bpu=True -D MMU=True -D perf=True \ + -D prefetch=True -D CLINT=True \ + -D simulate=True -D SDRAM=True \ + -D GPIO_MUX=True \ + -D verilog=True $(BSVCOMPILEOPTS) -verilog-filter \ + ${BLUESPECDIR}/bin/basicinout -p $(BSVINCDIR) \ + -g $(TOP_MODULE) $(TOP_DIR)/$(TOP_FILE) \ + 2>&1 | tee bsv_compile.log + @echo Compilation finished + +############################################################################# + +.PHONY: clean +clean: + rm -rf $(BSVBUILDDIR) *.log $(BSVOUTDIR) ./bbl* + rm -rf verilog obj_dir bsv_src diff --git a/src/bsv/pinmux_generator.py b/src/bsv/pinmux_generator.py index 9890f3f..fbe1973 100644 --- a/src/bsv/pinmux_generator.py +++ b/src/bsv/pinmux_generator.py @@ -74,6 +74,8 @@ def pinmuxgen(pth=None, verify=True): # copy over template and library files shutil.copyfile(os.path.join(cwd, 'Makefile.template'), os.path.join(bp, 'Makefile')) + shutil.copyfile(os.path.join(cwd, 'Makefile.peripherals.template'), + os.path.join(bp, 'Makefile.peripherals')) cwd = os.path.join(cwd, 'bsv_lib') for fname in []: shutil.copyfile(os.path.join(cwd, fname),