From df30b415f56889dd0f3f779dcdabd5f61eb0c9ee Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Wed, 1 Mar 2023 15:41:32 -0800 Subject: [PATCH 01/21] Remove SBT thin client | Build all with fat jars --- common.mk | 49 ++++++++++++++++++--------------------------- project/plugins.sbt | 2 +- variables.mk | 33 +++++++++++++++++------------- 3 files changed, 40 insertions(+), 44 deletions(-) diff --git a/common.mk b/common.mk index 73d2d6c4cf..f61a043bbc 100644 --- a/common.mk +++ b/common.mk @@ -16,7 +16,6 @@ HELP_COMPILATION_VARIABLES += \ " EXTRA_SIM_LDFLAGS = additional LDFLAGS for building simulators" \ " EXTRA_SIM_SOURCES = additional simulation sources needed for simulator" \ " EXTRA_SIM_REQS = additional make requirements to build the simulator" \ -" ENABLE_SBT_THIN_CLIENT = if set, use sbt's experimental thin client (works best when overridding SBT_BIN with the mainline sbt script)" \ " ENABLE_CUSTOM_FIRRTL_PASS = if set, enable custom firrtl passes (SFC lowers to LowFIRRTL & MFC converts to Verilog)" \ " EXTRA_CHISEL_OPTIONS = additional options to pass to the Chisel compiler" \ " EXTRA_FIRRTL_OPTIONS = additional options to pass to the FIRRTL compiler" @@ -47,7 +46,6 @@ HELP_COMMANDS += \ " firrtl = generate intermediate firrtl files from chisel elaboration" \ " run-tests = run all assembly and benchmark tests" \ " launch-sbt = start sbt terminal" \ -" {shutdown,start}-sbt-server = shutdown or start sbt server if using ENABLE_SBT_THIN_CLIENT" \ ######################################################################################### # include additional subproject make fragments @@ -98,12 +96,21 @@ $(BOOTROM_TARGETS): $(build_dir)/bootrom.%.img: $(TESTCHIP_RSRCS_DIR)/testchipip cp -f $< $@ ######################################################################################### -# create firrtl file rule and variables +# compile scala jars +######################################################################################### +$(GEN_CLASSPATH_TARGETS) &: $(SCALA_SOURCES) $(SCALA_BUILDTOOL_DEPS) + $(call run_sbt_assembly,$(SBT_PROJECT),$(GEN_CLASSPATH)) + +$(BTL_CLASSPATH_TARGETS) &: $(SCALA_SOURCES) $(SCALA_BUILDTOOL_DEPS) + $(call run_sbt_assembly,tapeout,$(BTL_CLASSPATH)) + +######################################################################################### +# verilog generation pipeline ######################################################################################### # AG: must re-elaborate if cva6 sources have changed... otherwise just run firrtl compile -$(FIRRTL_FILE) $(ANNO_FILE) &: $(SCALA_SOURCES) $(SCALA_BUILDTOOL_DEPS) $(EXTRA_GENERATOR_REQS) +$(FIRRTL_FILE) $(ANNO_FILE) &: $(GEN_CLASSPATH_TARGETS) $(EXTRA_GENERATOR_REQS) mkdir -p $(build_dir) - $(call run_scala_main,$(SBT_PROJECT),$(GENERATOR_PACKAGE).Generator,\ + $(call run_scala_main,$(GEN_CLASSPATH),$(GENERATOR_PACKAGE).Generator,\ --target-dir $(build_dir) \ --name $(long_name) \ --top-module $(MODEL_PACKAGE).$(MODEL) \ @@ -181,9 +188,9 @@ endif if [ $(SFC_LEVEL) = low ]; then jq -s '[.[][]]' $(EXTRA_ANNO_FILE) $(SFC_EXTRA_ANNO_FILE) > $(FINAL_ANNO_FILE); fi if [ $(SFC_LEVEL) = none ]; then cat $(EXTRA_ANNO_FILE) > $(FINAL_ANNO_FILE); fi -$(SFC_MFC_TARGETS) &: $(FIRRTL_FILE) $(FINAL_ANNO_FILE) $(VLOG_SOURCES) $(SFC_LEVEL) $(EXTRA_FIRRTL_OPTIONS) +$(SFC_MFC_TARGETS) &: $(BTL_CLASSPATH_TARGETS) $(FIRRTL_FILE) $(FINAL_ANNO_FILE) $(VLOG_SOURCES) $(SFC_LEVEL) $(EXTRA_FIRRTL_OPTIONS) rm -rf $(GEN_COLLATERAL_DIR) - $(call run_scala_main,tapeout,barstools.tapeout.transforms.GenerateModelStageMain,\ + $(call run_scala_main,$(BTL_CLASSPATH),barstools.tapeout.transforms.GenerateModelStageMain,\ --no-dedup \ --output-file $(SFC_FIRRTL_BASENAME) \ --output-annotation-file $(SFC_ANNO_FILE) \ @@ -253,12 +260,12 @@ $(TOP_SMEMS_CONF) $(MODEL_SMEMS_CONF) &: $(MFC_SMEMS_CONF) $(MFC_MODEL_HRCHY_JS # This file is for simulation only. VLSI flows should replace this file with one containing hard SRAMs TOP_MACROCOMPILER_MODE ?= --mode synflops -$(TOP_SMEMS_FILE) $(TOP_SMEMS_FIR) &: $(TOP_SMEMS_CONF) - $(call run_scala_main,tapeout,barstools.macros.MacroCompiler,-n $(TOP_SMEMS_CONF) -v $(TOP_SMEMS_FILE) -f $(TOP_SMEMS_FIR) $(TOP_MACROCOMPILER_MODE)) +$(TOP_SMEMS_FILE) $(TOP_SMEMS_FIR) &: $(BTL_CLASSPATH_TARGETS) $(TOP_SMEMS_CONF) + $(call run_scala_main,$(BTL_CLASSPATH),barstools.macros.MacroCompiler,-n $(TOP_SMEMS_CONF) -v $(TOP_SMEMS_FILE) -f $(TOP_SMEMS_FIR) $(TOP_MACROCOMPILER_MODE)) MODEL_MACROCOMPILER_MODE = --mode synflops -$(MODEL_SMEMS_FILE) $(MODEL_SMEMS_FIR) &: $(MODEL_SMEMS_CONF) | $(TOP_SMEMS_FILE) - $(call run_scala_main,tapeout,barstools.macros.MacroCompiler, -n $(MODEL_SMEMS_CONF) -v $(MODEL_SMEMS_FILE) -f $(MODEL_SMEMS_FIR) $(MODEL_MACROCOMPILER_MODE)) +$(MODEL_SMEMS_FILE) $(MODEL_SMEMS_FIR) &: $(BTL_CLASSPATH_TARGETS) $(MODEL_SMEMS_CONF) | $(TOP_SMEMS_FILE) + $(call run_scala_main,$(BTL_CLASSPATH),barstools.macros.MacroCompiler, -n $(MODEL_SMEMS_CONF) -v $(MODEL_SMEMS_FILE) -f $(MODEL_SMEMS_FIR) $(MODEL_MACROCOMPILER_MODE)) ######################################################################################## # remove duplicate files and headers in list of simulation file inputs @@ -356,7 +363,6 @@ endif ####################################### # Rules for building DRAMSim2 library ####################################### - dramsim_dir = $(base_dir)/tools/DRAMSim2 dramsim_lib = $(dramsim_dir)/libdramsim.a @@ -364,27 +370,12 @@ $(dramsim_lib): $(MAKE) -C $(dramsim_dir) $(notdir $@) ################################################ -# Helper to run SBT or manage the SBT server +# Helper to run SBT ################################################ - SBT_COMMAND ?= shell .PHONY: launch-sbt launch-sbt: - cd $(base_dir) && $(SBT_NON_THIN) "$(SBT_COMMAND)" - -.PHONY: check-thin-client -check-thin-client: -ifeq (,$(ENABLE_SBT_THIN_CLIENT)) - $(error ENABLE_SBT_THIN_CLIENT not set.) -endif - -.PHONY: shutdown-sbt-server -shutdown-sbt-server: check-thin-client - cd $(base_dir) && $(SBT) "shutdown" - -.PHONY: start-sbt-server -start-sbt-server: check-thin-client - cd $(base_dir) && $(SBT) "exit" + cd $(base_dir) && $(SBT) "$(SBT_COMMAND)" ######################################################################################### # print help text diff --git a/project/plugins.sbt b/project/plugins.sbt index 2425544f63..ea67fc1e38 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1,3 @@ -addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.15.0") +addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.1.1") addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.4") addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.5.3") diff --git a/variables.mk b/variables.mk index a89d23a0f4..d607e11343 100644 --- a/variables.mk +++ b/variables.mk @@ -8,7 +8,7 @@ HELP_COMPILATION_VARIABLES = \ " JAVA_TOOL_OPTIONS = if overridden, set underlying java tool options (default sets misc. sizes and tmp dir)" \ " SBT_OPTS = set additional sbt command line options (these take the form -Dsbt.