From 37241af1fca7be9dec04be37f8d477e7bcd91003 Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Tue, 4 Jun 2019 10:36:25 -0700 Subject: [PATCH 01/55] Add initial VLSI flow scripts --- .gitmodules | 4 ++ vlsi/.gitignore | 6 +++ vlsi/Makefile | 122 ++++++++++++++++++++++++++++++++++++++++++++++ vlsi/README.md | 5 ++ vlsi/example-vlsi | 36 ++++++++++++++ vlsi/hammer | 1 + 6 files changed, 174 insertions(+) create mode 100644 vlsi/.gitignore create mode 100644 vlsi/Makefile create mode 100644 vlsi/README.md create mode 100755 vlsi/example-vlsi create mode 160000 vlsi/hammer diff --git a/.gitmodules b/.gitmodules index ca80d661..9e30fb35 100644 --- a/.gitmodules +++ b/.gitmodules @@ -40,3 +40,7 @@ [submodule "generators/block-inclusivecache-sifive"] path = generators/sifive-cache url = https://github.com/sifive/block-inclusivecache-sifive.git +[submodule "vlsi/hammer"] + path = vlsi/hammer + url = git@github.com:ucb-bar/hammer.git + diff --git a/vlsi/.gitignore b/vlsi/.gitignore new file mode 100644 index 00000000..4cbcfe8f --- /dev/null +++ b/vlsi/.gitignore @@ -0,0 +1,6 @@ +inputs.yml +__pycache__ +hammer*.log +build +src/test/output-*.json +generated-src \ No newline at end of file diff --git a/vlsi/Makefile b/vlsi/Makefile new file mode 100644 index 00000000..5b6390b7 --- /dev/null +++ b/vlsi/Makefile @@ -0,0 +1,122 @@ +######################################################################################### +# vlsi makefile +######################################################################################### + +######################################################################################### +# general path variables +######################################################################################### +base_dir=$(abspath ..) +vlsi_dir=$(abspath .) +sim_dir=$(abspath .) + +######################################################################################### +# include shared variables +######################################################################################### +include $(base_dir)/variables.mk + +######################################################################################### +# import other necessary rules and variables +######################################################################################### +include $(base_dir)/common.mk + +######################################################################################### +# vlsi types and rules +######################################################################################### + +#sim_name is unused, but GenerateSimFiles expects it +sim_name ?= vcs +tech_name ?= +tech_dir ?= $(vlsi_dir)/hammer-$(tech_nam)-plugin/$(tech_name) +SMEMS_COMP ?= $(tech_dir)/sram-compiler.json +SMEMS_HAMMER ?= $(build_dir)/$(long_name).mems.hammer.json +MACROCOMPILER_MODE ?= -l $(SMEMS_COMP) --use-compiler -hir $(SMEMS_HAMMER) +OBJ_DIR ?= $(vlsi_dir)/build +ENV_YML ?= $(vlsi_dir)/hammer-cad-plugins/bwrc-env.yml +INPUT_CONFS ?= example.yml $(dir $(tech_dir))/bwrc.yml +HAMMER_EXEC ?= ./example-vlsi + +ROCKET_SRC_DIR=$(ROCKETCHIP_DIR)/src/main/resources/vsrc + +ROCKET_SRCS = \ + $(ROCKET_SRC_DIR)/ClockDivider2.v \ + $(ROCKET_SRC_DIR)/ClockDivider3.v \ + $(ROCKET_SRC_DIR)/AsyncResetReg.v \ + $(ROCKET_SRC_DIR)/plusarg_reader.v \ + $(ROCKET_SRC_DIR)/EICG_wrapper.v \ + +ALL_RTL = $(ROCKET_SRCS) $(VERILOG_FILE) $(SMEMS_FILE) + +CLOCK_DOMAINS = $(build_dir)/$(long_name).domains + +.PHONY: default +default: all + +all: drc lvs + + +###################################################### SYN ############################################################ + +SYNTH_CONF = $(OBJ_DIR)/inputs.yml + +$(SYNTH_CONF): + mkdir -p $(dir $@) + echo "synthesis.inputs:" > $@ + echo " top_module: $(TOP)" >> $@ + echo " input_files:" >> $@ + for x in $(ALL_RTL); do \ + echo ' - "'$$x'"' >> $@; \ + done + +GENERATED_CONFS=$(SYNTH_CONF) $(SRAM_CONF) + +.PHONY: syn synthesis +syn: $(OBJ_DIR)/syn-rundir/$(TOP).mapped.v +synthesis: syn + +$(OBJ_DIR)/syn-rundir/$(TOP).mapped.v $(OBJ_DIR)/syn-rundir/syn-output.json: $(ENV_YML) $(INPUT_CONFS) $(GENERATED_CONFS) $(ALL_RTL) + mkdir -p $(dir $@) + $(HAMMER_EXEC) -e $(ENV_YML) $(foreach x,$(INPUT_CONFS) $(GENERATED_CONFS), -p $(x)) --obj_dir $(OBJ_DIR) syn + +$(OBJ_DIR)/par-input.json: $(OBJ_DIR)/syn-rundir/syn-output.json + mkdir -p $(dir $@) + $(HAMMER_EXEC) -e $(ENV_YML) $(foreach x,$(INPUT_CONFS) $<, -p $(x)) -o $@ syn_to_par + +###################################################### PAR ############################################################ + +.PHONY: par place-and-route +par: $(OBJ_DIR)/par-rundir/$(TOP).gds +place-and-route: par + +$(OBJ_DIR)/par-rundir/$(TOP).gds $(OBJ_DIR)/par-rundir/par-output.json: $(OBJ_DIR)/par-input.json $(OBJ_DIR)/syn-rundir/$(TOP).mapped.v + mkdir -p $(dir $@) + $(HAMMER_EXEC) -e $(ENV_YML) -p $< --obj_dir $(OBJ_DIR) par + +$(OBJ_DIR)/drc-input.json: $(OBJ_DIR)/par-input.json $(OBJ_DIR)/par-rundir/par-output.json + mkdir -p $(dir $@) + $(HAMMER_EXEC) -e $(ENV_YML) $(foreach x,$^, -p $(x)) -o $@ --obj_dir $(OBJ_DIR) par_to_drc + +###################################################### DRC ############################################################ +# TODO unimplemented +.PHONY: drc +drc: $(OBJ_DIR)/drc-rundir/drc_results.db + +$(OBJ_DIR)/drc-rundir/drc_results.db: $(OBJ_DIR)/drc-input.json $(OBJ_DIR)/par-rundir/$(TOP).gds + mkdir -p $(dir $@) + $(HAMMER_EXEC) -e $(ENV_YML) -p $< --obj_dir $(OBJ_DIR) drc + +###################################################### LVS ############################################################ +# TODO unimplemented +$(OBJ_DIR)/lvs-input.json: $(OBJ_DIR)/par-input.json $(OBJ_DIR)/par-rundir/par-output.json + mkdir -p $(dir $@) + $(HAMMER_EXEC) -e $(ENV_YML) $(foreach x,$^, -p $(x)) -o $@ --obj_dir $(OBJ_DIR) par_to_lvs + +.PHONY: lvs +lvs: $(OBJ_DIR)/lvs-rundir/lvs_results.rpt + +$(OBJ_DIR)/lvs-rundir/lvs_results.rpt: $(OBJ_DIR)/lvs-input.json $(OBJ_DIR)/par-rundir/$(TOP).gds + mkdir -p $(dir $@) + $(HAMMER_EXEC) -e $(ENV_YML) -p $< --obj_dir $(OBJ_DIR) lvs + +.PHONY: clean +clean: + rm -rf $(OBJ_DIR) hammer-vlsi*.log __pycache__ output.json $(GENERATED_CONFS) generated-src diff --git a/vlsi/README.md b/vlsi/README.md new file mode 100644 index 00000000..d09fb5d8 --- /dev/null +++ b/vlsi/README.md @@ -0,0 +1,5 @@ +This is the starting point for a vlsi flow from this repository. + +This flow will not work without the necessary CAD and technology plugins for HAMMER. + +If you are a UCB-affiliate, you may be able to acquire access to the tech-plugins. \ No newline at end of file diff --git a/vlsi/example-vlsi b/vlsi/example-vlsi new file mode 100755 index 00000000..90ddec3c --- /dev/null +++ b/vlsi/example-vlsi @@ -0,0 +1,36 @@ +#!/usr/bin/env python3 + +import hammer_vlsi +from hammer_vlsi import CLIDriver + +from typing import Dict, Callable, Optional + +def example_place_tap_cells(x: hammer_vlsi.HammerTool) -> bool: + x.append(''' +# TODO +''') + return True + +class ExampleDriver(CLIDriver): + + def action_map(self) -> Dict[str, Callable[[hammer_vlsi.HammerDriver, Callable[[str], None]], Optional[dict]]]: + par_action = self.create_par_action(custom_hooks=[ + hammer_vlsi.HammerTool.make_replacement_hook("place_tap_cells", example_place_tap_cells) + ]) + + new_dict = dict(super().action_map()) + new_dict.update({ + "par": par_action + }) + return new_dict + + def par_action(self, driver: hammer_vlsi.HammerDriver, append_error_func: Callable[[str], None]) -> Optional[dict]: + if not driver.load_par_tool(): + return None + success, par_output = driver.run_par(hook_actions=[ + hammer_vlsi.HammerTool.make_replacement_hook("place_tap_cells", example_place_tap_cells) + ]) + return par_output + +if __name__ == '__main__': + ExampleDriver().main() diff --git a/vlsi/hammer b/vlsi/hammer new file mode 160000 index 00000000..873b2c1a --- /dev/null +++ b/vlsi/hammer @@ -0,0 +1 @@ +Subproject commit 873b2c1af0a54cb339a19a7c8cf3a1e7905feb58 From f7735dedc0c3eb9744695af61de230864b05d12d Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Tue, 4 Jun 2019 12:18:34 -0700 Subject: [PATCH 02/55] Use new API for par hooks | fix typo --- vlsi/Makefile | 2 +- vlsi/example-vlsi | 25 ++++--------------------- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/vlsi/Makefile b/vlsi/Makefile index 5b6390b7..193ed0b4 100644 --- a/vlsi/Makefile +++ b/vlsi/Makefile @@ -26,7 +26,7 @@ include $(base_dir)/common.mk #sim_name is unused, but GenerateSimFiles expects it sim_name ?= vcs tech_name ?= -tech_dir ?= $(vlsi_dir)/hammer-$(tech_nam)-plugin/$(tech_name) +tech_dir ?= $(vlsi_dir)/hammer-$(tech_name)-plugin/$(tech_name) SMEMS_COMP ?= $(tech_dir)/sram-compiler.json SMEMS_HAMMER ?= $(build_dir)/$(long_name).mems.hammer.json MACROCOMPILER_MODE ?= -l $(SMEMS_COMP) --use-compiler -hir $(SMEMS_HAMMER) diff --git a/vlsi/example-vlsi b/vlsi/example-vlsi index 90ddec3c..3f65d9a5 100755 --- a/vlsi/example-vlsi +++ b/vlsi/example-vlsi @@ -1,9 +1,9 @@ #!/usr/bin/env python3 import hammer_vlsi -from hammer_vlsi import CLIDriver +from hammer_vlsi import CLIDriver, HammerToolHookAction -from typing import Dict, Callable, Optional +from typing import Dict, Callable, Optional, List def example_place_tap_cells(x: hammer_vlsi.HammerTool) -> bool: x.append(''' @@ -12,25 +12,8 @@ def example_place_tap_cells(x: hammer_vlsi.HammerTool) -> bool: return True class ExampleDriver(CLIDriver): - - def action_map(self) -> Dict[str, Callable[[hammer_vlsi.HammerDriver, Callable[[str], None]], Optional[dict]]]: - par_action = self.create_par_action(custom_hooks=[ - hammer_vlsi.HammerTool.make_replacement_hook("place_tap_cells", example_place_tap_cells) - ]) - - new_dict = dict(super().action_map()) - new_dict.update({ - "par": par_action - }) - return new_dict - - def par_action(self, driver: hammer_vlsi.HammerDriver, append_error_func: Callable[[str], None]) -> Optional[dict]: - if not driver.load_par_tool(): - return None - success, par_output = driver.run_par(hook_actions=[ - hammer_vlsi.HammerTool.make_replacement_hook("place_tap_cells", example_place_tap_cells) - ]) - return par_output + def get_extra_par_hooks(self) -> List[HammerToolHookAction]: + return [hammer_vlsi.HammerTool.make_replacement_hook("place_tap_cells", example_place_tap_cells)] if __name__ == '__main__': ExampleDriver().main() From 6e790abdeeb52a284f95c69f4a70343ad424eebb Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Mon, 15 Jul 2019 16:08:10 -0700 Subject: [PATCH 03/55] Add hammer-cad-plugins submodule --- .gitmodules | 3 +++ vlsi/Makefile | 2 +- vlsi/hammer-cad-plugins | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) create mode 160000 vlsi/hammer-cad-plugins diff --git a/.gitmodules b/.gitmodules index 9e30fb35..9729ae2e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -43,4 +43,7 @@ [submodule "vlsi/hammer"] path = vlsi/hammer url = git@github.com:ucb-bar/hammer.git +[submodule "vlsi/hammer-cad-plugins"] + path = vlsi/hammer-cad-plugins + url = git@github.com:ucb-bar/hammer-cad-plugins diff --git a/vlsi/Makefile b/vlsi/Makefile index 193ed0b4..7dc797c6 100644 --- a/vlsi/Makefile +++ b/vlsi/Makefile @@ -31,7 +31,7 @@ SMEMS_COMP ?= $(tech_dir)/sram-compiler.json SMEMS_HAMMER ?= $(build_dir)/$(long_name).mems.hammer.json MACROCOMPILER_MODE ?= -l $(SMEMS_COMP) --use-compiler -hir $(SMEMS_HAMMER) OBJ_DIR ?= $(vlsi_dir)/build -ENV_YML ?= $(vlsi_dir)/hammer-cad-plugins/bwrc-env.yml +ENV_YML ?= $(vlsi_dir)/bwrc-env.yml INPUT_CONFS ?= example.yml $(dir $(tech_dir))/bwrc.yml HAMMER_EXEC ?= ./example-vlsi diff --git a/vlsi/hammer-cad-plugins b/vlsi/hammer-cad-plugins new file mode 160000 index 00000000..72809f53 --- /dev/null +++ b/vlsi/hammer-cad-plugins @@ -0,0 +1 @@ +Subproject commit 72809f538c4bbe91c103de52e92baad9df6d8f9a From 906f5af809df17f97079f46870785175db25494d Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Mon, 15 Jul 2019 16:15:09 -0700 Subject: [PATCH 04/55] Don't pull hammer-cad-plugins in init script --- .circleci/check-commit.sh | 1 + scripts/init-submodules-no-riscv-tools.sh | 2 ++ 2 files changed, 3 insertions(+) diff --git a/.circleci/check-commit.sh b/.circleci/check-commit.sh index ea7e30f5..bcf4e2ea 100755 --- a/.circleci/check-commit.sh +++ b/.circleci/check-commit.sh @@ -9,6 +9,7 @@ set -ex cd $HOME/project # initialize submodules and get the hashes +git config submodule.vlsi/hammer-cad-plugins.update none git submodule update --init status=$(git submodule status) diff --git a/scripts/init-submodules-no-riscv-tools.sh b/scripts/init-submodules-no-riscv-tools.sh index 8bf6b300..99b1b497 100755 --- a/scripts/init-submodules-no-riscv-tools.sh +++ b/scripts/init-submodules-no-riscv-tools.sh @@ -16,6 +16,8 @@ git config --global submodule.esp-tools.update none git config --global submodule.experimental-blocks.update none # Disable updates to the FireSim submodule until explicitly requested git config submodule.sims/firesim.update none +# Disable updates to the hammer-cad-plugins repo +git config submodule.vlsi/hammer-cad-plugins.update none git submodule update --init --recursive #--jobs 8 # unignore riscv-tools,catapult-shell2 globally git config --global --unset submodule.riscv-tools.update From 3be2241c8a78c04297af972ce5769b00b833fb74 Mon Sep 17 00:00:00 2001 From: alonamid Date: Tue, 16 Jul 2019 11:14:42 -0700 Subject: [PATCH 05/55] toolchain script update --- scripts/build-toolchains.sh | 109 ++++++++++++++++++++++++++++++++++-- sims/firesim | 2 +- 2 files changed, 106 insertions(+), 5 deletions(-) diff --git a/scripts/build-toolchains.sh b/scripts/build-toolchains.sh index 20ce4800..40852767 100755 --- a/scripts/build-toolchains.sh +++ b/scripts/build-toolchains.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +#this script is based on the firesim build toolchains script + # exit script if any command fails set -e set -o pipefail @@ -8,10 +10,70 @@ unamestr=$(uname) RDIR=$(pwd) : ${CHIPYARD_DIR:=$(pwd)} #default value is the PWD unless overridden +function usage +{ + echo "usage: build-setup.sh [ firesim | --firesim] [--submodules-only]" + echo " firesim: if set, pulls in a pre-compiled RISC-V toolchain for an EC2 manager instance" + echo " submodules-only: if set, skips toolchain handling (cloning or building)" +} + +#taken from riscv-tools to check for open-ocd autoconf versions +check_version() { + $1 --version | awk "NR==1 {if (\$NF>$2) {exit 0} exit 1}" || ( + echo $3 requires at least version $2 of $1. Aborting. + exit 1 + ) +} + +if [ "$1" == "--help" -o "$1" == "-h" -o "$1" == "-H" ]; then + usage + exit 3 +fi + +while test $# -gt 0 +do + case "$1" in + firesim | --firesim) # I don't want to break this api + FIRESIMINSTALL=true + ;; + --submodules-only) + SUBMODULES_ONLY=true; + ;; + -h | -H | --help) + usage + exit + ;; + --*) echo "ERROR: bad option $1" + usage + exit 1 + ;; + *) echo "ERROR: bad argument $1" + usage + exit 2 + ;; + esac + shift +done + + if [ $# -ne 0 ]; then TOOLCHAIN=$1 if [ $1 == "riscv" ]; then TOOLCHAIN="riscv-tools" + if [ "$FIRESIMINSTALL" = "true" ]; then + cd sims/firesim/ + git clone https://github.com/firesim/firesim-riscv-tools-prebuilt.git + cd firesim-riscv-tools-prebuilt + git checkout 5fee18421a32058ab339572128201f4904354aaa + PREBUILTHASH="$(cat HASH)" + cd $RDIR/toolchain/riscv-tools/ + GITHASH="git rev-parse HEAD" + cd $RDIR + if [[ "$PREBUILTHASH" == "$GITHASH" && "$FIRESIMINSTALL" == "true" ]]; then + FASTINSTALL=true + #just call a fireism build-toolchain script? + fi + fi elif [ $1 == "hwacha" ]; then TOOLCHAIN="esp-tools" fi @@ -26,12 +88,51 @@ RISCV="$(pwd)/$INSTALL_DIR" # install risc-v tools export RISCV="$RISCV" -git -C $CHIPYARD_DIR submodule update --init --recursive toolchains/$TOOLCHAIN #--jobs 8 -cd "$CHIPYARD_DIR/toolchains/$TOOLCHAIN" -export MAKEFLAGS="-j16" -./build.sh + +if [ "$FASTINSTALL" = true ]; then + cd sims/firesim/firesim-riscv-tools-prebuilt + ./installrelease.sh + mv distrib $(pwd)/$INSTALL_DIR + # copy HASH in case user wants it later + cp HASH $(pwd)/$INSTALL_DIR + cd $RDIR + rm -rf sims/firesim/firesim-riscv-tools-prebuilt +else + git -C $CHIPYARD_DIR submodule update --init --recursive toolchains/$TOOLCHAIN #--jobs 8 + cd "$CHIPYARD_DIR/toolchains/$TOOLCHAIN" + export MAKEFLAGS="-j16" + #build the actual toolchain + #./build.sh + source build.common + echo "Starting RISC-V Toolchain build process" + build_project riscv-fesvr --prefix=$RISCV + build_project riscv-isa-sim --prefix=$RISCV --with-fesvr=$RISCV + build_project riscv-gnu-toolchain --prefix=$RISCV + CC= CXX= build_project riscv-pk --prefix=$RISCV --host=riscv64-unknown-elf + build_project riscv-tests --prefix=$RISCV/riscv64-unknown-elf + echo -e "\\nRISC-V Toolchain installation completed!" + + # build static libfesvr library for linking into firesim driver (or others) + cd riscv-fesvr/build + $CHIPYARD_DIR/sims/firesim/scripts/build-static-libfesvr.sh + cd $RDIR + # build linux toolchain + cd "$CHIPYARD_DIR/toolchains/$TOOLCHAIN/riscv-gnu-toolchain/build" + make -j16 linux + echo -e "\\nRISC-V Linux GNU Toolchain installation completed!" + + if [ "$FIRESIMINSTALL" = "false" ]; then + check_version automake 1.14 "OpenOCD build" + check_version autoconf 2.64 "OpenOCD build" + build_project riscv-openocd --prefix=$RISCV --enable-remote-bitbang --enable-jtag_vpi --disable-werror + echo -e "\\nRISC-V OpenOCD installation completed!" + fi + +fi + cd $RDIR +echo "export CHIPYARD_TOOLCHAIN_SOURCED=1" > env.sh echo "export RISCV=$RISCV" > env.sh echo "export PATH=$RISCV/bin:$RDIR/$DTCversion:\$PATH" >> env.sh echo "export LD_LIBRARY_PATH=$RISCV/lib" >> env.sh diff --git a/sims/firesim b/sims/firesim index 7f8152e5..b0b04d34 160000 --- a/sims/firesim +++ b/sims/firesim @@ -1 +1 @@ -Subproject commit 7f8152e5114c7f7793df54a41a53a9e6a04fa8cd +Subproject commit b0b04d343bf252ceb9c495ed7a6f87f30cafa2a3 From 56488ab1429f50b16ed2536f0e7ac2b91a3d7b6f Mon Sep 17 00:00:00 2001 From: alonamid Date: Tue, 16 Jul 2019 12:10:17 -0700 Subject: [PATCH 06/55] replace riscv-tools with rocket-tools --- .gitmodules | 6 +++--- toolchains/riscv-tools | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitmodules b/.gitmodules index ca80d661..55e8a98b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,9 +13,6 @@ [submodule "tools/firrtl"] path = tools/firrtl url = https://github.com/freechipsproject/firrtl -[submodule "riscv-tools"] - path = toolchains/riscv-tools - url = https://github.com/riscv/riscv-tools.git [submodule "esp-tools"] path = toolchains/esp-tools url = https://github.com/ucb-bar/esp-tools.git @@ -40,3 +37,6 @@ [submodule "generators/block-inclusivecache-sifive"] path = generators/sifive-cache url = https://github.com/sifive/block-inclusivecache-sifive.git +[submodule "toolchains/riscv-tools"] + path = toolchains/riscv-tools + url = https://github.com/freechipsproject/rocket-tools.git diff --git a/toolchains/riscv-tools b/toolchains/riscv-tools index bce7b5e3..190bb6ba 160000 --- a/toolchains/riscv-tools +++ b/toolchains/riscv-tools @@ -1 +1 @@ -Subproject commit bce7b5e363957c134f944769e677354467b7e4ed +Subproject commit 190bb6badf53673f29611796fa29a8ba7a37f002 From f28174f64188d7e733f691bbedfdc84b7045149b Mon Sep 17 00:00:00 2001 From: alonamid Date: Tue, 16 Jul 2019 21:32:13 +0000 Subject: [PATCH 07/55] move riscv-tools before fesvr merge --- toolchains/riscv-tools | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolchains/riscv-tools b/toolchains/riscv-tools index 190bb6ba..bce7b5e3 160000 --- a/toolchains/riscv-tools +++ b/toolchains/riscv-tools @@ -1 +1 @@ -Subproject commit 190bb6badf53673f29611796fa29a8ba7a37f002 +Subproject commit bce7b5e363957c134f944769e677354467b7e4ed From b74aff9ba8713bf1e4caa4742d2f36832fe536d4 Mon Sep 17 00:00:00 2001 From: alonamid Date: Tue, 16 Jul 2019 23:09:23 +0000 Subject: [PATCH 08/55] toolchain script fixes --- scripts/build-toolchains.sh | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/scripts/build-toolchains.sh b/scripts/build-toolchains.sh index 40852767..fad50914 100755 --- a/scripts/build-toolchains.sh +++ b/scripts/build-toolchains.sh @@ -12,9 +12,10 @@ RDIR=$(pwd) function usage { - echo "usage: build-setup.sh [ firesim | --firesim] [--submodules-only]" + echo "usage: ./scripts/build-toolchains.sh [riscv] [hwacha] [ firesim | --firesim] [--submodules-only]" + echo " riscv: if set, builds the riscv toolchain (this is also the default)" + echo " hwacha: if set, builds esp-tools toolchain" echo " firesim: if set, pulls in a pre-compiled RISC-V toolchain for an EC2 manager instance" - echo " submodules-only: if set, skips toolchain handling (cloning or building)" } #taken from riscv-tools to check for open-ocd autoconf versions @@ -30,15 +31,20 @@ if [ "$1" == "--help" -o "$1" == "-h" -o "$1" == "-H" ]; then exit 3 fi +TOOLCHAIN="riscv-tools" +FIRESIMINSTALL="false" while test $# -gt 0 do case "$1" in + riscv) + TOOLCHAIN="riscv-tools" + ;; + hwacha) + TOOLCHAIN="esp-tools" + ;; firesim | --firesim) # I don't want to break this api FIRESIMINSTALL=true ;; - --submodules-only) - SUBMODULES_ONLY=true; - ;; -h | -H | --help) usage exit @@ -55,11 +61,7 @@ do shift done - -if [ $# -ne 0 ]; then - TOOLCHAIN=$1 - if [ $1 == "riscv" ]; then - TOOLCHAIN="riscv-tools" +if [ "TOOLCHAINS" = "riscv-tools" ]; then if [ "$FIRESIMINSTALL" = "true" ]; then cd sims/firesim/ git clone https://github.com/firesim/firesim-riscv-tools-prebuilt.git @@ -74,11 +76,6 @@ if [ $# -ne 0 ]; then #just call a fireism build-toolchain script? fi fi - elif [ $1 == "hwacha" ]; then - TOOLCHAIN="esp-tools" - fi -else - TOOLCHAIN="riscv-tools" fi INSTALL_DIR="$TOOLCHAIN-install" From 160dbd263693814264c0b92df3d9c7643d3a7162 Mon Sep 17 00:00:00 2001 From: alonamid Date: Wed, 17 Jul 2019 01:54:55 +0000 Subject: [PATCH 09/55] fix env.sh --- scripts/build-toolchains.sh | 21 +++++++++++++-------- sims/firesim | 2 +- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/scripts/build-toolchains.sh b/scripts/build-toolchains.sh index fad50914..69923c00 100755 --- a/scripts/build-toolchains.sh +++ b/scripts/build-toolchains.sh @@ -33,6 +33,7 @@ fi TOOLCHAIN="riscv-tools" FIRESIMINSTALL="false" +FASTINSTALL="false" while test $# -gt 0 do case "$1" in @@ -118,19 +119,23 @@ else make -j16 linux echo -e "\\nRISC-V Linux GNU Toolchain installation completed!" - if [ "$FIRESIMINSTALL" = "false" ]; then - check_version automake 1.14 "OpenOCD build" - check_version autoconf 2.64 "OpenOCD build" - build_project riscv-openocd --prefix=$RISCV --enable-remote-bitbang --enable-jtag_vpi --disable-werror - echo -e "\\nRISC-V OpenOCD installation completed!" - fi - fi cd $RDIR echo "export CHIPYARD_TOOLCHAIN_SOURCED=1" > env.sh -echo "export RISCV=$RISCV" > env.sh +echo "export RISCV=$RISCV" >> env.sh echo "export PATH=$RISCV/bin:$RDIR/$DTCversion:\$PATH" >> env.sh echo "export LD_LIBRARY_PATH=$RISCV/lib" >> env.sh echo "Toolchain Build Complete!" + + +if [ "$FASTINSTALL" = "false" ]; then + if [ "$FIRESIMINSTALL" = "false" ]; then + echo "Building RISC-V OpenOCD Complete!" + check_version automake 1.14 "OpenOCD build" + check_version autoconf 2.64 "OpenOCD build" + build_project riscv-openocd --prefix=$RISCV --enable-remote-bitbang --enable-jtag_vpi --disable-werror + echo -e "\\nRISC-V OpenOCD installation completed!" + fi +fi diff --git a/sims/firesim b/sims/firesim index b0b04d34..08409e85 160000 --- a/sims/firesim +++ b/sims/firesim @@ -1 +1 @@ -Subproject commit b0b04d343bf252ceb9c495ed7a6f87f30cafa2a3 +Subproject commit 08409e85ac2ee9f6de672e1785b1414857091117 From d3a3c9bc16e696237a5f05608829725d45be6bad Mon Sep 17 00:00:00 2001 From: alonamid Date: Wed, 17 Jul 2019 03:33:52 +0000 Subject: [PATCH 10/55] bump firesim --- sims/firesim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sims/firesim b/sims/firesim index 08409e85..4cad8b72 160000 --- a/sims/firesim +++ b/sims/firesim @@ -1 +1 @@ -Subproject commit 08409e85ac2ee9f6de672e1785b1414857091117 +Subproject commit 4cad8b72b4edbd83d782c8b09a5f18a18b09e74c From 44f2c594da80519405bdb1c38bbea0f1b491c1d6 Mon Sep 17 00:00:00 2001 From: alonamid Date: Wed, 17 Jul 2019 03:59:57 +0000 Subject: [PATCH 11/55] bump firesim --- sims/firesim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sims/firesim b/sims/firesim index 4cad8b72..21c8a5e5 160000 --- a/sims/firesim +++ b/sims/firesim @@ -1 +1 @@ -Subproject commit 4cad8b72b4edbd83d782c8b09a5f18a18b09e74c +Subproject commit 21c8a5e5f1e5f329232473380b067d9d5a8e0f8c From baf3753b91f6d205eb1d13d0b16b1522d64cdca9 Mon Sep 17 00:00:00 2001 From: alonamid Date: Wed, 17 Jul 2019 07:08:27 +0000 Subject: [PATCH 12/55] update pre-compiled hash --- scripts/build-toolchains.sh | 4 ++-- sims/firesim | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/build-toolchains.sh b/scripts/build-toolchains.sh index 69923c00..ec2e31b9 100755 --- a/scripts/build-toolchains.sh +++ b/scripts/build-toolchains.sh @@ -62,12 +62,12 @@ do shift done -if [ "TOOLCHAINS" = "riscv-tools" ]; then +if [ "$TOOLCHAINS" = "riscv-tools" ]; then if [ "$FIRESIMINSTALL" = "true" ]; then cd sims/firesim/ git clone https://github.com/firesim/firesim-riscv-tools-prebuilt.git cd firesim-riscv-tools-prebuilt - git checkout 5fee18421a32058ab339572128201f4904354aaa + git checkout 56a40961c98db5e8f904f15dc6efd0870bfefd9e PREBUILTHASH="$(cat HASH)" cd $RDIR/toolchain/riscv-tools/ GITHASH="git rev-parse HEAD" diff --git a/sims/firesim b/sims/firesim index 21c8a5e5..fe20b389 160000 --- a/sims/firesim +++ b/sims/firesim @@ -1 +1 @@ -Subproject commit 21c8a5e5f1e5f329232473380b067d9d5a8e0f8c +Subproject commit fe20b389a9c19ae672500868e850e84fd8671fca From 5cedeea35204188deedc446124d0ed04ecd982e3 Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Wed, 17 Jul 2019 11:45:32 -0700 Subject: [PATCH 13/55] model verilator args after vcs make --- sims/verilator/Makefile | 47 +++++++++++++++++++++++-------------- sims/verilator/verilator.mk | 13 ---------- 2 files changed, 29 insertions(+), 31 deletions(-) diff --git a/sims/verilator/Makefile b/sims/verilator/Makefile index c97f9844..d717aa63 100644 --- a/sims/verilator/Makefile +++ b/sims/verilator/Makefile @@ -40,6 +40,31 @@ debug: $(sim_debug) include $(base_dir)/common.mk include $(sim_dir)/verilator.mk +######################################################################################### +# verilator binary and flags +######################################################################################### +VERILATOR := $(INSTALLED_VERILATOR) --cc --exe + +CXXFLAGS := $(CXXFLAGS) -O1 -std=c++11 -I$(RISCV)/include -D__STDC_FORMAT_MACROS +LDFLAGS := $(LDFLAGS) -L$(RISCV)/lib -Wl,-rpath,$(RISCV)/lib -L$(sim_dir) -lfesvr -lpthread + +VERILATOR_CC_OPTS = \ + -O3 \ + -CFLAGS "$(CXXFLAGS) -DTEST_HARNESS=V$(VLOG_MODEL) -DVERILATOR" \ + -CFLAGS "-I$(build_dir) -include $(build_dir)/$(long_name).plusArgs" \ + -LDFLAGS "$(LDFLAGS)" + +VERILATOR_NONCC_OPTS = \ + --top-module $(VLOG_MODEL) \ + +define+PRINTF_COND=\$$c\(\"verbose\",\"\&\&\"\,\"done_reset\"\) \ + +define+STOP_COND=\$$c\(\"done_reset\"\) \ + --assert \ + --output-split 20000 \ + $(sim_vsrcs) \ + -f $(sim_common_files) + +VERILATOR_OPTS = $(VERILATOR_CC_OPTS) $(VERILATOR_NONCC_OPTS) + ######################################################################################### # verilator build paths and file names ######################################################################################### @@ -55,41 +80,27 @@ model_mk_debug = $(model_dir_debug)/V$(VLOG_MODEL).mk ######################################################################################### # build makefile fragment that builds the verilator sim rules ######################################################################################### -LDFLAGS := $(LDFLAGS) -L$(RISCV)/lib -Wl,-rpath,$(RISCV)/lib -L$(sim_dir) -lfesvr -lpthread -SHARED_FLAGS := \ - $(sim_vsrcs) \ - -f $(sim_common_files) \ - -LDFLAGS "$(LDFLAGS)" $(model_mk): $(sim_vsrcs) $(sim_common_files) $(INSTALLED_VERILATOR) rm -rf $(build_dir)/$(long_name) mkdir -p $(build_dir)/$(long_name) - $(VERILATOR) $(VERILATOR_FLAGS) \ - -Mdir $(build_dir)/$(long_name) \ - -o $(sim) \ - $(SHARED_FLAGS) \ - -CFLAGS "-I$(build_dir) -include $(build_dir)/$(long_name).plusArgs -include $(model_header)" + $(VERILATOR) $(VERILATOR_OPTS) -o $(sim) -Mdir $(model_dir) -CFLAGS "-include $(model_header)" touch $@ $(model_mk_debug): $(sim_vsrcs) $(sim_common_files) $(INSTALLED_VERILATOR) rm -rf $(build_dir)/$(long_name) mkdir -p $(build_dir)/$(long_name).debug - $(VERILATOR) $(VERILATOR_FLAGS) \ - -Mdir $(build_dir)/$(long_name).debug \ - --trace \ - -o $(sim_debug) \ - $(SHARED_FLAGS) \ - -CFLAGS "-I$(build_dir) -include $(build_dir)/$(long_name).plusArgs -include $(model_header_debug)" + $(VERILATOR) $(VERILATOR_OPTS) -o $(sim_debug) --trace -Mdir $(model_dir_debug) -CFLAGS "-include $(model_header_debug)" touch $@ ######################################################################################### # invoke make to make verilator sim rules ######################################################################################### $(sim): $(model_mk) - $(MAKE) VM_PARALLEL_BUILDS=1 -C $(build_dir)/$(long_name) -f V$(VLOG_MODEL).mk + $(MAKE) VM_PARALLEL_BUILDS=1 -C $(model_dir) -f V$(VLOG_MODEL).mk $(sim_debug): $(model_mk_debug) - $(MAKE) VM_PARALLEL_BUILDS=1 -C $(build_dir)/$(long_name).debug -f V$(VLOG_MODEL).mk + $(MAKE) VM_PARALLEL_BUILDS=1 -C $(model_dir_debug) -f V$(VLOG_MODEL).mk ######################################################################################### # create a verilator vpd rule diff --git a/sims/verilator/verilator.mk b/sims/verilator/verilator.mk index 382715ca..7f8a8c46 100644 --- a/sims/verilator/verilator.mk +++ b/sims/verilator/verilator.mk @@ -37,16 +37,3 @@ $(VERILATOR_SRCDIR)/configure: $(VERILATOR_INSTALL_DIR)/verilator-$(VERILATOR_VE $(VERILATOR_INSTALL_DIR)/verilator-$(VERILATOR_VERSION).tar.gz: mkdir -p $(dir $@) wget http://www.veripool.org/ftp/verilator-$(VERILATOR_VERSION).tgz -O $@ - -######################################################################################### -# verilator binary and flags -######################################################################################### -VERILATOR := $(INSTALLED_VERILATOR) --cc --exe -CXXFLAGS := $(CXXFLAGS) -O1 -std=c++11 -I$(RISCV)/include -D__STDC_FORMAT_MACROS -VERILATOR_FLAGS := --top-module $(VLOG_MODEL) \ - +define+PRINTF_COND=\$$c\(\"verbose\",\"\&\&\"\,\"done_reset\"\) \ - +define+STOP_COND=\$$c\(\"done_reset\"\) \ - --assert \ - --output-split 20000 \ - -Wno-STMTDLY --x-assign unique \ - -O3 -CFLAGS "$(CXXFLAGS) -DTEST_HARNESS=V$(VLOG_MODEL) -DVERILATOR" From 89f1271734c259318e712355cbd86d17c9b7a48f Mon Sep 17 00:00:00 2001 From: alonamid Date: Wed, 17 Jul 2019 21:47:02 +0000 Subject: [PATCH 14/55] typo fix --- scripts/build-toolchains.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build-toolchains.sh b/scripts/build-toolchains.sh index ec2e31b9..74c12938 100755 --- a/scripts/build-toolchains.sh +++ b/scripts/build-toolchains.sh @@ -62,7 +62,7 @@ do shift done -if [ "$TOOLCHAINS" = "riscv-tools" ]; then +if [ "$TOOLCHAIN" = "riscv-tools" ]; then if [ "$FIRESIMINSTALL" = "true" ]; then cd sims/firesim/ git clone https://github.com/firesim/firesim-riscv-tools-prebuilt.git From 9976bc192acd20e86efcb93b471d88de2f6a335d Mon Sep 17 00:00:00 2001 From: alonamid Date: Wed, 17 Jul 2019 22:17:24 +0000 Subject: [PATCH 15/55] more typos --- scripts/build-toolchains.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/build-toolchains.sh b/scripts/build-toolchains.sh index 74c12938..4a8a5d89 100755 --- a/scripts/build-toolchains.sh +++ b/scripts/build-toolchains.sh @@ -69,10 +69,10 @@ if [ "$TOOLCHAIN" = "riscv-tools" ]; then cd firesim-riscv-tools-prebuilt git checkout 56a40961c98db5e8f904f15dc6efd0870bfefd9e PREBUILTHASH="$(cat HASH)" - cd $RDIR/toolchain/riscv-tools/ - GITHASH="git rev-parse HEAD" + cd $RDIR/toolchains/riscv-tools/ + GITHASH="$(git rev-parse HEAD)" cd $RDIR - if [[ "$PREBUILTHASH" == "$GITHASH" && "$FIRESIMINSTALL" == "true" ]]; then + if [[ $PREBUILTHASH == $GITHASH && "$FIRESIMINSTALL" == "true" ]]; then FASTINSTALL=true #just call a fireism build-toolchain script? fi From f97beed12d836e6e9e509321c8b8e63540c870e8 Mon Sep 17 00:00:00 2001 From: Abraham Gonzalez Date: Wed, 17 Jul 2019 15:31:03 -0700 Subject: [PATCH 16/55] Add phony targets --- common.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common.mk b/common.mk index fe0cb023..f9d5896b 100644 --- a/common.mk +++ b/common.mk @@ -82,7 +82,7 @@ verilog: $(sim_vsrcs) ######################################################################################### # helper rules to run simulations ######################################################################################### -.PHONY: run-binary run-fast +.PHONY: run-binary run-binary-fast run-binary-debug run-fast run-binary: $(sim) (set -o pipefail && $(sim) $(PERMISSIVE_ON) +max-cycles=$(timeout_cycles) $(SIM_FLAGS) $(VERBOSE_FLAGS) $(PERMISSIVE_OFF) $(BINARY) 3>&1 1>&2 2>&3 | spike-dasm > $(sim_out_name).out) From fdb21fc6039e57de88f4c6fe195403bef69d0a8d Mon Sep 17 00:00:00 2001 From: alonamid Date: Thu, 18 Jul 2019 00:57:24 +0000 Subject: [PATCH 17/55] pull toolchain from firesim --- scripts/build-toolchains.sh | 32 ++++++++++++++++++++++---------- sims/firesim | 2 +- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/scripts/build-toolchains.sh b/scripts/build-toolchains.sh index 4a8a5d89..e2f741b5 100755 --- a/scripts/build-toolchains.sh +++ b/scripts/build-toolchains.sh @@ -15,7 +15,7 @@ function usage echo "usage: ./scripts/build-toolchains.sh [riscv] [hwacha] [ firesim | --firesim] [--submodules-only]" echo " riscv: if set, builds the riscv toolchain (this is also the default)" echo " hwacha: if set, builds esp-tools toolchain" - echo " firesim: if set, pulls in a pre-compiled RISC-V toolchain for an EC2 manager instance" + echo " ec2fast: if set, pulls in a pre-compiled RISC-V toolchain for an EC2 manager instance" } #taken from riscv-tools to check for open-ocd autoconf versions @@ -33,6 +33,7 @@ fi TOOLCHAIN="riscv-tools" FIRESIMINSTALL="false" +EC2FASTINSTALL="false" FASTINSTALL="false" while test $# -gt 0 do @@ -46,6 +47,9 @@ do firesim | --firesim) # I don't want to break this api FIRESIMINSTALL=true ;; + ec2fast | --ec2fast) # I don't want to break this api + EC2FASTINSTALL=true + ;; -h | -H | --help) usage exit @@ -62,9 +66,9 @@ do shift done -if [ "$TOOLCHAIN" = "riscv-tools" ]; then - if [ "$FIRESIMINSTALL" = "true" ]; then - cd sims/firesim/ +if [ "$EC2FASTINSTALL" = "true" ]; then + if [ "$TOOLCHAIN" = "riscv-tools" ]; then + cd $RDIR git clone https://github.com/firesim/firesim-riscv-tools-prebuilt.git cd firesim-riscv-tools-prebuilt git checkout 56a40961c98db5e8f904f15dc6efd0870bfefd9e @@ -72,10 +76,18 @@ if [ "$TOOLCHAIN" = "riscv-tools" ]; then cd $RDIR/toolchains/riscv-tools/ GITHASH="$(git rev-parse HEAD)" cd $RDIR - if [[ $PREBUILTHASH == $GITHASH && "$FIRESIMINSTALL" == "true" ]]; then + echo "prebuilt hash: $PREBUILTHASH" + echo "git hash: $GITHASH" + if [[ $PREBUILTHASH == $GITHASH && "$EC2FASTINSTALL" == "true" ]]; then FASTINSTALL=true - #just call a fireism build-toolchain script? + echo "Using fast pre-compiled install for riscv-tools" + else + echo "Error: hash of precompiled toolchain doesn't match the riscv-tools submodule hash." + exit fi + else + echo "Error: No precompiled toolchain for esp-tools or other non-native riscv-tools." + exit fi fi @@ -88,13 +100,13 @@ RISCV="$(pwd)/$INSTALL_DIR" export RISCV="$RISCV" if [ "$FASTINSTALL" = true ]; then - cd sims/firesim/firesim-riscv-tools-prebuilt + cd firesim-riscv-tools-prebuilt ./installrelease.sh - mv distrib $(pwd)/$INSTALL_DIR + mv distrib $RISCV # copy HASH in case user wants it later - cp HASH $(pwd)/$INSTALL_DIR + cp HASH $RISCV cd $RDIR - rm -rf sims/firesim/firesim-riscv-tools-prebuilt + rm -rf firesim-riscv-tools-prebuilt else git -C $CHIPYARD_DIR submodule update --init --recursive toolchains/$TOOLCHAIN #--jobs 8 cd "$CHIPYARD_DIR/toolchains/$TOOLCHAIN" diff --git a/sims/firesim b/sims/firesim index fe20b389..bb6c51a7 160000 --- a/sims/firesim +++ b/sims/firesim @@ -1 +1 @@ -Subproject commit fe20b389a9c19ae672500868e850e84fd8671fca +Subproject commit bb6c51a788ba1b947afc159a0f032bfcf8cb7fa5 From f331ec13d0519e3ffb313d30f4ca0f3376255e48 Mon Sep 17 00:00:00 2001 From: alonamid Date: Thu, 18 Jul 2019 01:38:44 +0000 Subject: [PATCH 18/55] move libfesvr script --- scripts/build-toolchains.sh | 2 +- sims/firesim | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/build-toolchains.sh b/scripts/build-toolchains.sh index e2f741b5..7bdeb5b6 100755 --- a/scripts/build-toolchains.sh +++ b/scripts/build-toolchains.sh @@ -124,7 +124,7 @@ else # build static libfesvr library for linking into firesim driver (or others) cd riscv-fesvr/build - $CHIPYARD_DIR/sims/firesim/scripts/build-static-libfesvr.sh + $CHIPYARD_DIR/scripts/build-static-libfesvr.sh cd $RDIR # build linux toolchain cd "$CHIPYARD_DIR/toolchains/$TOOLCHAIN/riscv-gnu-toolchain/build" diff --git a/sims/firesim b/sims/firesim index bb6c51a7..c2e1ad83 160000 --- a/sims/firesim +++ b/sims/firesim @@ -1 +1 @@ -Subproject commit bb6c51a788ba1b947afc159a0f032bfcf8cb7fa5 +Subproject commit c2e1ad830a3cce9e6dc97adf041e6b566330d7c9 From ac23632ef18746838d4ddcec2a6f193c560c1a57 Mon Sep 17 00:00:00 2001 From: alonamid Date: Thu, 18 Jul 2019 02:23:23 +0000 Subject: [PATCH 19/55] bump firesim --- sims/firesim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sims/firesim b/sims/firesim index c2e1ad83..565ab98b 160000 --- a/sims/firesim +++ b/sims/firesim @@ -1 +1 @@ -Subproject commit c2e1ad830a3cce9e6dc97adf041e6b566330d7c9 +Subproject commit 565ab98ba690586bf27fe9b2dddc8ab851d93e40 From 9e8eed8db471403549ba332d9c1ac662524152d6 Mon Sep 17 00:00:00 2001 From: alonamid Date: Thu, 18 Jul 2019 02:26:42 +0000 Subject: [PATCH 20/55] bump firesim --- sims/firesim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sims/firesim b/sims/firesim index 565ab98b..0e80ba73 160000 --- a/sims/firesim +++ b/sims/firesim @@ -1 +1 @@ -Subproject commit 565ab98ba690586bf27fe9b2dddc8ab851d93e40 +Subproject commit 0e80ba734e87435a8c6c6d445e83e2c896195134 From 171923d3b60efc9b6acb5b448ee791b53380bbf4 Mon Sep 17 00:00:00 2001 From: alonamid Date: Thu, 18 Jul 2019 02:52:54 +0000 Subject: [PATCH 21/55] fix path --- scripts/build-toolchains.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build-toolchains.sh b/scripts/build-toolchains.sh index 7bdeb5b6..d75d50ec 100755 --- a/scripts/build-toolchains.sh +++ b/scripts/build-toolchains.sh @@ -73,7 +73,7 @@ if [ "$EC2FASTINSTALL" = "true" ]; then cd firesim-riscv-tools-prebuilt git checkout 56a40961c98db5e8f904f15dc6efd0870bfefd9e PREBUILTHASH="$(cat HASH)" - cd $RDIR/toolchains/riscv-tools/ + cd "$CHIPYARD_DIR/toolchains/$TOOLCHAIN" GITHASH="$(git rev-parse HEAD)" cd $RDIR echo "prebuilt hash: $PREBUILTHASH" From 955903759e0ef00e87fabc90db7b38c89477c7a5 Mon Sep 17 00:00:00 2001 From: alonamid Date: Thu, 18 Jul 2019 03:13:59 +0000 Subject: [PATCH 22/55] add firesim chipyard path --- scripts/build-toolchains.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/build-toolchains.sh b/scripts/build-toolchains.sh index d75d50ec..0ba5117f 100755 --- a/scripts/build-toolchains.sh +++ b/scripts/build-toolchains.sh @@ -66,6 +66,10 @@ do shift done +if [ "$FIRESIMINSTALL" = "true" ]; then + CHIPYARD_DIR="$RDIR/target-design/chipyard" +fi + if [ "$EC2FASTINSTALL" = "true" ]; then if [ "$TOOLCHAIN" = "riscv-tools" ]; then cd $RDIR From eba7b4ec165529f9ad83e52ae20aa0bb7a356e8b Mon Sep 17 00:00:00 2001 From: alonamid Date: Thu, 18 Jul 2019 03:28:22 +0000 Subject: [PATCH 23/55] correct libfesvr script --- scripts/build-static-libfesvr.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 scripts/build-static-libfesvr.sh diff --git a/scripts/build-static-libfesvr.sh b/scripts/build-static-libfesvr.sh new file mode 100755 index 00000000..5dc0eac3 --- /dev/null +++ b/scripts/build-static-libfesvr.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# This ungodly script surreptitiously builds an archive from existing fesvr objects +# Invoke from riscv-fesvr/build + +if [ "x$RISCV" = "x" ] +then + echo "Please set the RISCV environment variable to your preferred install path." + exit 1 +fi + +set -e + +objs=$(head -n 1 <(make -f <( echo -e 'include Makefile\n$(info $(value fesvr_objs))') -n)) +ar rcs -o libfesvr.a $objs +cp -f libfesvr.a $RISCV/lib + From 9fa1d8d971a5d0a634356163a00c77381dc34a9d Mon Sep 17 00:00:00 2001 From: alonamid Date: Thu, 18 Jul 2019 04:12:41 +0000 Subject: [PATCH 24/55] update arg --- scripts/build-toolchains.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/scripts/build-toolchains.sh b/scripts/build-toolchains.sh index 0ba5117f..d75d50ec 100755 --- a/scripts/build-toolchains.sh +++ b/scripts/build-toolchains.sh @@ -66,10 +66,6 @@ do shift done -if [ "$FIRESIMINSTALL" = "true" ]; then - CHIPYARD_DIR="$RDIR/target-design/chipyard" -fi - if [ "$EC2FASTINSTALL" = "true" ]; then if [ "$TOOLCHAIN" = "riscv-tools" ]; then cd $RDIR From d7d25fb840bb0d49f25bcc13e2b136baf05bd68c Mon Sep 17 00:00:00 2001 From: alonamid Date: Thu, 18 Jul 2019 04:14:11 +0000 Subject: [PATCH 25/55] bump firesim --- sims/firesim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sims/firesim b/sims/firesim index 0e80ba73..4bb74da2 160000 --- a/sims/firesim +++ b/sims/firesim @@ -1 +1 @@ -Subproject commit 0e80ba734e87435a8c6c6d445e83e2c896195134 +Subproject commit 4bb74da2a87a3519d5095a31023cadd256e592a6 From 40203f60a3636e263b6dc02d48fbb9fbd920fd3b Mon Sep 17 00:00:00 2001 From: alonamid Date: Thu, 18 Jul 2019 04:35:31 +0000 Subject: [PATCH 26/55] update deinit name --- scripts/init-submodules-no-riscv-tools.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/init-submodules-no-riscv-tools.sh b/scripts/init-submodules-no-riscv-tools.sh index 8bf6b300..56934885 100755 --- a/scripts/init-submodules-no-riscv-tools.sh +++ b/scripts/init-submodules-no-riscv-tools.sh @@ -11,14 +11,14 @@ scripts_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # ignore riscv-tools for submodule init recursive # you must do this globally (otherwise riscv-tools deep # in the submodule tree will get pulled anyway -git config --global submodule.riscv-tools.update none +git config --global submodule.toolchains/riscv-tools.update none git config --global submodule.esp-tools.update none git config --global submodule.experimental-blocks.update none # Disable updates to the FireSim submodule until explicitly requested git config submodule.sims/firesim.update none git submodule update --init --recursive #--jobs 8 # unignore riscv-tools,catapult-shell2 globally -git config --global --unset submodule.riscv-tools.update +git config --global --unset submodule.toolchains/riscv-tools.update git config --global --unset submodule.esp-tools.update git config --global --unset submodule.experimental-blocks.update From 302ffe786905f3e801889693d5a664e4d8d35ec6 Mon Sep 17 00:00:00 2001 From: alonamid Date: Thu, 18 Jul 2019 05:10:18 +0000 Subject: [PATCH 27/55] fix fast init --- scripts/build-toolchains.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/build-toolchains.sh b/scripts/build-toolchains.sh index d75d50ec..641fde86 100755 --- a/scripts/build-toolchains.sh +++ b/scripts/build-toolchains.sh @@ -66,6 +66,7 @@ do shift done + if [ "$EC2FASTINSTALL" = "true" ]; then if [ "$TOOLCHAIN" = "riscv-tools" ]; then cd $RDIR @@ -73,6 +74,7 @@ if [ "$EC2FASTINSTALL" = "true" ]; then cd firesim-riscv-tools-prebuilt git checkout 56a40961c98db5e8f904f15dc6efd0870bfefd9e PREBUILTHASH="$(cat HASH)" + git -C $CHIPYARD_DIR submodule update --init toolchains/$TOOLCHAIN cd "$CHIPYARD_DIR/toolchains/$TOOLCHAIN" GITHASH="$(git rev-parse HEAD)" cd $RDIR From 1f0fb1a39954697982f28b2fa580870e9373a792 Mon Sep 17 00:00:00 2001 From: alonamid Date: Thu, 18 Jul 2019 05:28:09 +0000 Subject: [PATCH 28/55] change flag name --- scripts/build-toolchains.sh | 8 ++++---- sims/firesim | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/build-toolchains.sh b/scripts/build-toolchains.sh index 641fde86..6996b279 100755 --- a/scripts/build-toolchains.sh +++ b/scripts/build-toolchains.sh @@ -32,7 +32,7 @@ if [ "$1" == "--help" -o "$1" == "-h" -o "$1" == "-H" ]; then fi TOOLCHAIN="riscv-tools" -FIRESIMINSTALL="false" +EC2INSTALL="false" EC2FASTINSTALL="false" FASTINSTALL="false" while test $# -gt 0 @@ -44,8 +44,8 @@ do hwacha) TOOLCHAIN="esp-tools" ;; - firesim | --firesim) # I don't want to break this api - FIRESIMINSTALL=true + ec2 | --ec2) + EC2INSTALL=true ;; ec2fast | --ec2fast) # I don't want to break this api EC2FASTINSTALL=true @@ -145,7 +145,7 @@ echo "Toolchain Build Complete!" if [ "$FASTINSTALL" = "false" ]; then - if [ "$FIRESIMINSTALL" = "false" ]; then + if [ "$EC2INSTALL" = "false" ]; then echo "Building RISC-V OpenOCD Complete!" check_version automake 1.14 "OpenOCD build" check_version autoconf 2.64 "OpenOCD build" diff --git a/sims/firesim b/sims/firesim index 4bb74da2..536237ba 160000 --- a/sims/firesim +++ b/sims/firesim @@ -1 +1 @@ -Subproject commit 4bb74da2a87a3519d5095a31023cadd256e592a6 +Subproject commit 536237ba19249258b7dd1d8c29439417c21396ed From b3f9398faacc585e3e61fcadd990cca1d33267c5 Mon Sep 17 00:00:00 2001 From: alonamid Date: Thu, 18 Jul 2019 06:02:44 +0000 Subject: [PATCH 29/55] fix message --- scripts/build-toolchains.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build-toolchains.sh b/scripts/build-toolchains.sh index 6996b279..7885dafc 100755 --- a/scripts/build-toolchains.sh +++ b/scripts/build-toolchains.sh @@ -146,7 +146,7 @@ echo "Toolchain Build Complete!" if [ "$FASTINSTALL" = "false" ]; then if [ "$EC2INSTALL" = "false" ]; then - echo "Building RISC-V OpenOCD Complete!" + echo "Building RISC-V OpenOCD" check_version automake 1.14 "OpenOCD build" check_version autoconf 2.64 "OpenOCD build" build_project riscv-openocd --prefix=$RISCV --enable-remote-bitbang --enable-jtag_vpi --disable-werror From 85aabf62973bbe34d49afc75b656863f37c5ac67 Mon Sep 17 00:00:00 2001 From: alonamid Date: Thu, 18 Jul 2019 07:29:11 +0000 Subject: [PATCH 30/55] bump firesim --- sims/firesim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sims/firesim b/sims/firesim index 536237ba..7019da24 160000 --- a/sims/firesim +++ b/sims/firesim @@ -1 +1 @@ -Subproject commit 536237ba19249258b7dd1d8c29439417c21396ed +Subproject commit 7019da24e2e65b659df9e73e73425f84460bd3d4 From e967667d1b208d835774cfd222cb503f26bcd054 Mon Sep 17 00:00:00 2001 From: alonamid Date: Thu, 18 Jul 2019 21:47:29 +0000 Subject: [PATCH 31/55] remove ec2 arg --- scripts/build-toolchains.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/scripts/build-toolchains.sh b/scripts/build-toolchains.sh index 7885dafc..8fe55960 100755 --- a/scripts/build-toolchains.sh +++ b/scripts/build-toolchains.sh @@ -32,7 +32,6 @@ if [ "$1" == "--help" -o "$1" == "-h" -o "$1" == "-H" ]; then fi TOOLCHAIN="riscv-tools" -EC2INSTALL="false" EC2FASTINSTALL="false" FASTINSTALL="false" while test $# -gt 0 @@ -44,9 +43,6 @@ do hwacha) TOOLCHAIN="esp-tools" ;; - ec2 | --ec2) - EC2INSTALL=true - ;; ec2fast | --ec2fast) # I don't want to break this api EC2FASTINSTALL=true ;; @@ -145,7 +141,10 @@ echo "Toolchain Build Complete!" if [ "$FASTINSTALL" = "false" ]; then - if [ "$EC2INSTALL" = "false" ]; then + # commands to run only on EC2 + # see if the instance info page exists. if not, we are not on ec2. + # this is one of the few methods that works without sudo + if wget -T 1 -t 3 -O /dev/null http://169.254.169.254/; then echo "Building RISC-V OpenOCD" check_version automake 1.14 "OpenOCD build" check_version autoconf 2.64 "OpenOCD build" From 4bf789d2bf6be473aaadbccab159b714dcd99026 Mon Sep 17 00:00:00 2001 From: alonamid Date: Thu, 18 Jul 2019 22:34:04 +0000 Subject: [PATCH 32/55] bump firesim --- sims/firesim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sims/firesim b/sims/firesim index 7019da24..37a60cb7 160000 --- a/sims/firesim +++ b/sims/firesim @@ -1 +1 @@ -Subproject commit 7019da24e2e65b659df9e73e73425f84460bd3d4 +Subproject commit 37a60cb77b506a88467bdeeddd6f63f398ff2710 From d513d1ac6b8e5a30fac39bb56c7b55c579118568 Mon Sep 17 00:00:00 2001 From: alonamid Date: Thu, 18 Jul 2019 23:00:55 +0000 Subject: [PATCH 33/55] bump firesim --- sims/firesim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sims/firesim b/sims/firesim index 37a60cb7..461b500d 160000 --- a/sims/firesim +++ b/sims/firesim @@ -1 +1 @@ -Subproject commit 37a60cb77b506a88467bdeeddd6f63f398ff2710 +Subproject commit 461b500d40d7c366a52486276f20eaaa0c9d5aeb From e29acc2b56e1de087215c06a25555680ad8b028f Mon Sep 17 00:00:00 2001 From: alonamid Date: Thu, 18 Jul 2019 23:35:53 +0000 Subject: [PATCH 34/55] fix openocd --- scripts/build-toolchains.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/build-toolchains.sh b/scripts/build-toolchains.sh index 8fe55960..e9b51ae7 100755 --- a/scripts/build-toolchains.sh +++ b/scripts/build-toolchains.sh @@ -145,6 +145,8 @@ if [ "$FASTINSTALL" = "false" ]; then # see if the instance info page exists. if not, we are not on ec2. # this is one of the few methods that works without sudo if wget -T 1 -t 3 -O /dev/null http://169.254.169.254/; then + echo "Skipping RISC-V OpenOCD" + else echo "Building RISC-V OpenOCD" check_version automake 1.14 "OpenOCD build" check_version autoconf 2.64 "OpenOCD build" From c35bc3335661b57be5d3084dc4986fe614985611 Mon Sep 17 00:00:00 2001 From: alonamid Date: Thu, 18 Jul 2019 23:37:52 +0000 Subject: [PATCH 35/55] bump firesim --- sims/firesim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sims/firesim b/sims/firesim index 461b500d..671a7cf8 160000 --- a/sims/firesim +++ b/sims/firesim @@ -1 +1 @@ -Subproject commit 461b500d40d7c366a52486276f20eaaa0c9d5aeb +Subproject commit 671a7cf88890ec3da0c07dd203d5c944cd16b840 From b47c8a5f30a0a61a5095d7633b56f5e47bce4e84 Mon Sep 17 00:00:00 2001 From: alonamid Date: Fri, 19 Jul 2019 00:24:07 +0000 Subject: [PATCH 36/55] fix usage --- scripts/build-toolchains.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build-toolchains.sh b/scripts/build-toolchains.sh index e9b51ae7..cbbfbac7 100755 --- a/scripts/build-toolchains.sh +++ b/scripts/build-toolchains.sh @@ -12,7 +12,7 @@ RDIR=$(pwd) function usage { - echo "usage: ./scripts/build-toolchains.sh [riscv] [hwacha] [ firesim | --firesim] [--submodules-only]" + echo "usage: ./scripts/build-toolchains.sh [riscv] [hwacha] [ ec2fast | --ec2fast] " echo " riscv: if set, builds the riscv toolchain (this is also the default)" echo " hwacha: if set, builds esp-tools toolchain" echo " ec2fast: if set, pulls in a pre-compiled RISC-V toolchain for an EC2 manager instance" From b76e89659802bc03a0a1125bee07c777646c5616 Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Thu, 18 Jul 2019 17:45:13 -0700 Subject: [PATCH 37/55] Update vlsi/Makefile to match variables.mk naming --- vlsi/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vlsi/Makefile b/vlsi/Makefile index 7dc797c6..fc0b4ac6 100644 --- a/vlsi/Makefile +++ b/vlsi/Makefile @@ -44,7 +44,7 @@ ROCKET_SRCS = \ $(ROCKET_SRC_DIR)/plusarg_reader.v \ $(ROCKET_SRC_DIR)/EICG_wrapper.v \ -ALL_RTL = $(ROCKET_SRCS) $(VERILOG_FILE) $(SMEMS_FILE) +ALL_RTL = $(ROCKET_SRCS) $(TOP_FILE) $(TOP_SMEMS_FILE) CLOCK_DOMAINS = $(build_dir)/$(long_name).domains From dc585609cf59a2abb2028f8dfcb75ab91b5b803a Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Thu, 18 Jul 2019 17:52:37 -0700 Subject: [PATCH 38/55] update hwacha ci to use L2 --- .circleci/defaults.sh | 2 +- generators/example/src/main/scala/Configs.scala | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.circleci/defaults.sh b/.circleci/defaults.sh index e777af65..25b365d8 100755 --- a/.circleci/defaults.sh +++ b/.circleci/defaults.sh @@ -41,4 +41,4 @@ mapping["boomrocketexample"]="SUB_PROJECT=example CONFIG=DefaultBoomAndRocketCon mapping["boom"]="SUB_PROJECT=boom" mapping["rocketchip"]="SUB_PROJECT=rocketchip" mapping["blockdevrocketchip"]="SUB_PROJECT=example CONFIG=BlockDeviceModelRocketConfig TOP=BoomRocketTopWithBlockDevice" -mapping["hwacha"]="SUB_PROJECT=hwacha" +mapping["hwacha"]="SUB_PROJECT=example CONFIG=HwachaL2Config GENERATOR_PACKAGE=hwacha" diff --git a/generators/example/src/main/scala/Configs.scala b/generators/example/src/main/scala/Configs.scala index c2334ca8..c6cfa7a5 100644 --- a/generators/example/src/main/scala/Configs.scala +++ b/generators/example/src/main/scala/Configs.scala @@ -63,7 +63,13 @@ class GB1MemoryConfig extends Config( new DefaultRocketConfig) class RocketL2Config extends Config( - new WithInclusiveCache ++ new DefaultRocketConfig) + new WithInclusiveCache ++ + new DefaultRocketConfig) + +class HwachaL2Config extends Config( + new hwacha.DefaultHwachaConfig ++ + new WithInclusiveCache ++ + new DefaultRocketConfig) // ------------ // BOOM Configs @@ -146,7 +152,8 @@ class RV32UnifiedBoomConfig extends Config( new boom.system.SmallRV32UnifiedBoomConfig) class BoomL2Config extends Config( - new WithInclusiveCache ++ new SmallDefaultBoomConfig) + new WithInclusiveCache ++ + new SmallDefaultBoomConfig) // --------------------- // BOOM and Rocket Configs @@ -255,4 +262,5 @@ class RV32BoomAndRocketConfig extends Config( new freechips.rocketchip.system.BaseConfig) class DualCoreRocketL2Config extends Config( - new WithInclusiveCache ++ new DualCoreRocketConfig) + new WithInclusiveCache ++ + new DualCoreRocketConfig) From 121c572d72b3384cd8ed9b3ec29c7631a0f2ad71 Mon Sep 17 00:00:00 2001 From: alonamid Date: Fri, 19 Jul 2019 00:54:34 +0000 Subject: [PATCH 39/55] pr comments --- .gitmodules | 6 +++--- scripts/build-toolchains.sh | 6 ++++-- scripts/init-submodules-no-riscv-tools.sh | 4 ++-- sims/firesim | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.gitmodules b/.gitmodules index 55e8a98b..66bbbce3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,9 +13,6 @@ [submodule "tools/firrtl"] path = tools/firrtl url = https://github.com/freechipsproject/firrtl -[submodule "esp-tools"] - path = toolchains/esp-tools - url = https://github.com/ucb-bar/esp-tools.git [submodule "tools/torture"] path = tools/torture url = https://github.com/ucb-bar/riscv-torture.git @@ -40,3 +37,6 @@ [submodule "toolchains/riscv-tools"] path = toolchains/riscv-tools url = https://github.com/freechipsproject/rocket-tools.git +[submodule "toolchains/esp-tools"] + path = toolchains/esp-tools + url = https://github.com/ucb-bar/esp-tools.git diff --git a/scripts/build-toolchains.sh b/scripts/build-toolchains.sh index cbbfbac7..36c2abd2 100755 --- a/scripts/build-toolchains.sh +++ b/scripts/build-toolchains.sh @@ -10,6 +10,8 @@ unamestr=$(uname) RDIR=$(pwd) : ${CHIPYARD_DIR:=$(pwd)} #default value is the PWD unless overridden +PRECOMPILED_REPO_HASH=56a40961c98db5e8f904f15dc6efd0870bfefd9e + function usage { echo "usage: ./scripts/build-toolchains.sh [riscv] [hwacha] [ ec2fast | --ec2fast] " @@ -68,7 +70,7 @@ if [ "$EC2FASTINSTALL" = "true" ]; then cd $RDIR git clone https://github.com/firesim/firesim-riscv-tools-prebuilt.git cd firesim-riscv-tools-prebuilt - git checkout 56a40961c98db5e8f904f15dc6efd0870bfefd9e + git checkout $PRECOMPILED_REPO_HASH PREBUILTHASH="$(cat HASH)" git -C $CHIPYARD_DIR submodule update --init toolchains/$TOOLCHAIN cd "$CHIPYARD_DIR/toolchains/$TOOLCHAIN" @@ -141,7 +143,7 @@ echo "Toolchain Build Complete!" if [ "$FASTINSTALL" = "false" ]; then - # commands to run only on EC2 + # commands that can't run on EC2 (specifically, OpenOCD because of autoconf version_ # see if the instance info page exists. if not, we are not on ec2. # this is one of the few methods that works without sudo if wget -T 1 -t 3 -O /dev/null http://169.254.169.254/; then diff --git a/scripts/init-submodules-no-riscv-tools.sh b/scripts/init-submodules-no-riscv-tools.sh index 56934885..40f530e6 100755 --- a/scripts/init-submodules-no-riscv-tools.sh +++ b/scripts/init-submodules-no-riscv-tools.sh @@ -12,14 +12,14 @@ scripts_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # you must do this globally (otherwise riscv-tools deep # in the submodule tree will get pulled anyway git config --global submodule.toolchains/riscv-tools.update none -git config --global submodule.esp-tools.update none +git config --global submodule.toolchains/esp-tools.update none git config --global submodule.experimental-blocks.update none # Disable updates to the FireSim submodule until explicitly requested git config submodule.sims/firesim.update none git submodule update --init --recursive #--jobs 8 # unignore riscv-tools,catapult-shell2 globally git config --global --unset submodule.toolchains/riscv-tools.update -git config --global --unset submodule.esp-tools.update +git config --global --unset submodule.toolchains/esp-tools.update git config --global --unset submodule.experimental-blocks.update # Renable firesim and init only the required submodules to provide diff --git a/sims/firesim b/sims/firesim index 671a7cf8..0d7bc1db 160000 --- a/sims/firesim +++ b/sims/firesim @@ -1 +1 @@ -Subproject commit 671a7cf88890ec3da0c07dd203d5c944cd16b840 +Subproject commit 0d7bc1db078d37731dd3d6c3d137a12a7ac42b0e From b74b23aad0bfdc3a2279b2e55a1f7d2180331c51 Mon Sep 17 00:00:00 2001 From: alonamid Date: Fri, 19 Jul 2019 05:57:43 +0000 Subject: [PATCH 40/55] remove global --- scripts/init-submodules-no-riscv-tools.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/init-submodules-no-riscv-tools.sh b/scripts/init-submodules-no-riscv-tools.sh index 778a991a..cd5924a2 100755 --- a/scripts/init-submodules-no-riscv-tools.sh +++ b/scripts/init-submodules-no-riscv-tools.sh @@ -11,8 +11,8 @@ scripts_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # ignore riscv-tools for submodule init recursive # you must do this globally (otherwise riscv-tools deep # in the submodule tree will get pulled anyway -git config --global submodule.toolchains/riscv-tools.update none -git config --global submodule.toolchains/esp-tools.update none +git config submodule.toolchains/riscv-tools.update none +git config submodule.toolchains/esp-tools.update none git config --global submodule.experimental-blocks.update none # Disable updates to the FireSim submodule until explicitly requested git config submodule.sims/firesim.update none @@ -20,8 +20,8 @@ git config submodule.sims/firesim.update none git config submodule.vlsi/hammer-cad-plugins.update none git submodule update --init --recursive #--jobs 8 # unignore riscv-tools,catapult-shell2 globally -git config --global --unset submodule.toolchains/riscv-tools.update -git config --global --unset submodule.toolchains/esp-tools.update +git config --unset submodule.toolchains/riscv-tools.update +git config --unset submodule.toolchains/esp-tools.update git config --global --unset submodule.experimental-blocks.update # Renable firesim and init only the required submodules to provide From 265380d960b3dedab7cebf08d787237dd9de3435 Mon Sep 17 00:00:00 2001 From: alonamid Date: Fri, 19 Jul 2019 16:59:40 +0000 Subject: [PATCH 41/55] fix install path --- scripts/build-toolchains.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/build-toolchains.sh b/scripts/build-toolchains.sh index 36c2abd2..a334c2cf 100755 --- a/scripts/build-toolchains.sh +++ b/scripts/build-toolchains.sh @@ -92,7 +92,6 @@ if [ "$EC2FASTINSTALL" = "true" ]; then fi INSTALL_DIR="$TOOLCHAIN-install" -mkdir -p "$(pwd)/$INSTALL_DIR" RISCV="$(pwd)/$INSTALL_DIR" @@ -102,12 +101,13 @@ export RISCV="$RISCV" if [ "$FASTINSTALL" = true ]; then cd firesim-riscv-tools-prebuilt ./installrelease.sh - mv distrib $RISCV + mv distrib "$RISCV" # copy HASH in case user wants it later - cp HASH $RISCV + cp HASH "$RISCV" cd $RDIR rm -rf firesim-riscv-tools-prebuilt else + mkdir -p "$RISCV" git -C $CHIPYARD_DIR submodule update --init --recursive toolchains/$TOOLCHAIN #--jobs 8 cd "$CHIPYARD_DIR/toolchains/$TOOLCHAIN" export MAKEFLAGS="-j16" From e63db54b9c28505779fc726fd0cd6e5b69b5d4dd Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Fri, 19 Jul 2019 15:03:28 -0700 Subject: [PATCH 42/55] Add first-time-run instructions to vlsi/README --- scripts/init-vlsi.sh | 6 ++++++ vlsi/README.md | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100755 scripts/init-vlsi.sh diff --git a/scripts/init-vlsi.sh b/scripts/init-vlsi.sh new file mode 100755 index 00000000..ab947dd1 --- /dev/null +++ b/scripts/init-vlsi.sh @@ -0,0 +1,6 @@ +# Initialize HAMMER and CAD-plugins +git submodule update --init --recursive vlsi/hammer +git submodule update --init --recursive vlsi/hammer-cad-plugins + +# Initialize HAMMER tech plugin +git submodule update --init --recursive vlsi/hammer-$1-plugin \ No newline at end of file diff --git a/vlsi/README.md b/vlsi/README.md index d09fb5d8..aa07dd0f 100644 --- a/vlsi/README.md +++ b/vlsi/README.md @@ -2,4 +2,8 @@ This is the starting point for a vlsi flow from this repository. This flow will not work without the necessary CAD and technology plugins for HAMMER. -If you are a UCB-affiliate, you may be able to acquire access to the tech-plugins. \ No newline at end of file +If you are a UCB-affiliate, you may be able to acquire access to the tech-plugins. + +# Initial Setup Instructions (For All technologies) +Run the `init-vlsi.sh` script to pull correct versions of hammer, hammer-cad-plugins, and the hammer-tech-plugins +```scripts/init-vlsi.sh TECH_NAME``` \ No newline at end of file From b923617f644eed0d1777b1ffa50662f02369acba Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Fri, 19 Jul 2019 15:06:51 -0700 Subject: [PATCH 43/55] Fixup init-vlsi.sh --- scripts/init-vlsi.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/init-vlsi.sh b/scripts/init-vlsi.sh index ab947dd1..294f8628 100755 --- a/scripts/init-vlsi.sh +++ b/scripts/init-vlsi.sh @@ -1,3 +1,10 @@ +#!/usr/bin/env bash +# exit script if any command fails +set -e +set -o pipefail + + + # Initialize HAMMER and CAD-plugins git submodule update --init --recursive vlsi/hammer git submodule update --init --recursive vlsi/hammer-cad-plugins From 0894919404fccc0e34e8f936778f6f053945113e Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Fri, 19 Jul 2019 15:07:03 -0700 Subject: [PATCH 44/55] Ignore emacs temp files --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 8450e9b8..08493eec 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ target env.sh riscv-tools-install tags +*~ \ No newline at end of file From 6ec5cd4ccdea0acaef2b56a1b2f0ff9237a1b02e Mon Sep 17 00:00:00 2001 From: Howard Mao Date: Wed, 10 Jul 2019 13:34:14 -0700 Subject: [PATCH 45/55] replace DefaultBusConfiguration trait with HierarchicalBusTopology trait from FireSim --- .../src/main/scala/TargetMixins.scala | 24 ------------------- .../firechip/src/main/scala/Targets.scala | 8 +++---- 2 files changed, 4 insertions(+), 28 deletions(-) diff --git a/generators/firechip/src/main/scala/TargetMixins.scala b/generators/firechip/src/main/scala/TargetMixins.scala index 5544376f..7b4d5d4f 100644 --- a/generators/firechip/src/main/scala/TargetMixins.scala +++ b/generators/firechip/src/main/scala/TargetMixins.scala @@ -14,30 +14,6 @@ import firesim.endpoints.{TraceOutputTop, DeclockedTracedInstruction} import midas.models.AXI4BundleWithEdge import midas.targetutils.ExcludeInstanceAsserts -/** Ties together Subsystem buses in the same fashion done in the example top of Rocket Chip */ -trait HasDefaultBusConfiguration { - this: BaseSubsystem => - // The sbus masters the cbus; here we convert TL-UH -> TL-UL - sbus.crossToBus(cbus, NoCrossing) - - // The cbus masters the pbus; which might be clocked slower - cbus.crossToBus(pbus, SynchronousCrossing()) - - // The fbus masters the sbus; both are TL-UH or TL-C - FlipRendering { implicit p => - sbus.crossFromBus(fbus, SynchronousCrossing()) - } - - // The sbus masters the mbus; here we convert TL-C -> TL-UH - private val BankedL2Params(nBanks, coherenceManager) = p(BankedL2Key) - private val (in, out, halt) = coherenceManager(this) - if (nBanks != 0) { - sbus.coupleTo("coherence_manager") { in :*= _ } - mbus.coupleFrom("coherence_manager") { _ :=* BankBinder(mbus.blockBytes * (nBanks-1)) :*= out } - } -} - - /** Copied from RC and modified to change the IO type of the Imp to include the Diplomatic edges * associated with each port. This drives FASED functional model sizing */ diff --git a/generators/firechip/src/main/scala/Targets.scala b/generators/firechip/src/main/scala/Targets.scala index c9077044..7f8bb830 100644 --- a/generators/firechip/src/main/scala/Targets.scala +++ b/generators/firechip/src/main/scala/Targets.scala @@ -31,7 +31,7 @@ import java.io.File *******************************************************************************/ class FireSim(implicit p: Parameters) extends RocketSubsystem - with HasDefaultBusConfiguration + with HasHierarchicalBusTopology with CanHaveFASEDOptimizedMasterAXI4MemPort with HasPeripheryBootROM with HasNoDebug @@ -57,7 +57,7 @@ class FireSimModuleImp[+L <: FireSim](l: L) extends RocketSubsystemModuleImp(l) class FireSimNoNIC(implicit p: Parameters) extends RocketSubsystem - with HasDefaultBusConfiguration + with HasHierarchicalBusTopology with CanHaveFASEDOptimizedMasterAXI4MemPort with HasPeripheryBootROM with HasNoDebug @@ -81,7 +81,7 @@ class FireSimNoNICModuleImp[+L <: FireSimNoNIC](l: L) extends RocketSubsystemMod class FireBoom(implicit p: Parameters) extends BoomRocketSubsystem - with HasDefaultBusConfiguration + with HasHierarchicalBusTopology with CanHaveFASEDOptimizedMasterAXI4MemPort with HasPeripheryBootROM with HasNoDebug @@ -107,7 +107,7 @@ class FireBoomModuleImp[+L <: FireBoom](l: L) extends BoomRocketSubsystemModuleI with ExcludeInvalidBoomAssertions class FireBoomNoNIC(implicit p: Parameters) extends BoomRocketSubsystem - with HasDefaultBusConfiguration + with HasHierarchicalBusTopology with CanHaveFASEDOptimizedMasterAXI4MemPort with HasPeripheryBootROM with HasNoDebug From 52322376e619d5d2c2e897ebc2c642ac3c270248 Mon Sep 17 00:00:00 2001 From: Abraham Gonzalez Date: Fri, 19 Jul 2019 16:44:46 -0700 Subject: [PATCH 46/55] Unset the init for `hammer-cad-plugins` This allows the user to not run the `unset` command after the init script to update the submodules. --- scripts/init-submodules-no-riscv-tools.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/init-submodules-no-riscv-tools.sh b/scripts/init-submodules-no-riscv-tools.sh index 99b1b497..50c41f7a 100755 --- a/scripts/init-submodules-no-riscv-tools.sh +++ b/scripts/init-submodules-no-riscv-tools.sh @@ -23,6 +23,7 @@ git submodule update --init --recursive #--jobs 8 git config --global --unset submodule.riscv-tools.update git config --global --unset submodule.esp-tools.update git config --global --unset submodule.experimental-blocks.update +git config --unset submodule.vlsi/hammer-cad-plugins.update # Renable firesim and init only the required submodules to provide # all required scala deps, without doing a full build-setup From 59bd39a335beb6d1b69433a08d2f73e70a74122f Mon Sep 17 00:00:00 2001 From: alonamid Date: Mon, 22 Jul 2019 06:46:55 +0000 Subject: [PATCH 47/55] bump firesim --- sims/firesim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sims/firesim b/sims/firesim index 0d7bc1db..ce44b13e 160000 --- a/sims/firesim +++ b/sims/firesim @@ -1 +1 @@ -Subproject commit 0d7bc1db078d37731dd3d6c3d137a12a7ac42b0e +Subproject commit ce44b13e976524238746d67b2ff45bde04e4e9ce From 8646283a17c6637379f311e0d412f3ae18b812c0 Mon Sep 17 00:00:00 2001 From: alonamid Date: Mon, 22 Jul 2019 16:35:15 +0000 Subject: [PATCH 48/55] colin comments --- scripts/build-static-libfesvr.sh | 2 +- scripts/build-toolchains.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/build-static-libfesvr.sh b/scripts/build-static-libfesvr.sh index 5dc0eac3..360028ad 100755 --- a/scripts/build-static-libfesvr.sh +++ b/scripts/build-static-libfesvr.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # This ungodly script surreptitiously builds an archive from existing fesvr objects # Invoke from riscv-fesvr/build diff --git a/scripts/build-toolchains.sh b/scripts/build-toolchains.sh index a334c2cf..2d78c874 100755 --- a/scripts/build-toolchains.sh +++ b/scripts/build-toolchains.sh @@ -50,7 +50,7 @@ do ;; -h | -H | --help) usage - exit + exit 3 ;; --*) echo "ERROR: bad option $1" usage From 9e5ed591b9f1e7d7cd35f18c941252e2543d137b Mon Sep 17 00:00:00 2001 From: alonamid Date: Mon, 22 Jul 2019 16:54:23 +0000 Subject: [PATCH 49/55] try to fix CI --- .circleci/build-toolchains.sh | 2 +- scripts/build-toolchains.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/build-toolchains.sh b/.circleci/build-toolchains.sh index d0be57c2..63f47505 100755 --- a/.circleci/build-toolchains.sh +++ b/.circleci/build-toolchains.sh @@ -14,5 +14,5 @@ if [ ! -d "$HOME/$1-install" ]; then cd $HOME # init all submodules including the tools - CHIPYARD_DIR=$LOCAL_CHIPYARD_DIR .$LOCAL_CHIPYARD_DIR/scripts/build-toolchains.sh $1 + CHIPYARD_DIR=$LOCAL_CHIPYARD_DIR $LOCAL_CHIPYARD_DIR/scripts/build-toolchains.sh $1 fi diff --git a/scripts/build-toolchains.sh b/scripts/build-toolchains.sh index 2d78c874..a39c24cd 100755 --- a/scripts/build-toolchains.sh +++ b/scripts/build-toolchains.sh @@ -14,7 +14,7 @@ PRECOMPILED_REPO_HASH=56a40961c98db5e8f904f15dc6efd0870bfefd9e function usage { - echo "usage: ./scripts/build-toolchains.sh [riscv] [hwacha] [ ec2fast | --ec2fast] " + echo "usage: ./scripts/build-toolchains.sh [riscv-tools] [esp-tools] [ec2fast | --ec2fast] " echo " riscv: if set, builds the riscv toolchain (this is also the default)" echo " hwacha: if set, builds esp-tools toolchain" echo " ec2fast: if set, pulls in a pre-compiled RISC-V toolchain for an EC2 manager instance" @@ -39,10 +39,10 @@ FASTINSTALL="false" while test $# -gt 0 do case "$1" in - riscv) + riscv-tools) TOOLCHAIN="riscv-tools" ;; - hwacha) + esp-tools) TOOLCHAIN="esp-tools" ;; ec2fast | --ec2fast) # I don't want to break this api From e177fcd41413c8192a32d224acf2f6ef43fcb76e Mon Sep 17 00:00:00 2001 From: alonamid Date: Mon, 22 Jul 2019 17:41:31 +0000 Subject: [PATCH 50/55] try to fix openocd path --- scripts/build-toolchains.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/build-toolchains.sh b/scripts/build-toolchains.sh index a39c24cd..8d5676ce 100755 --- a/scripts/build-toolchains.sh +++ b/scripts/build-toolchains.sh @@ -150,6 +150,7 @@ if [ "$FASTINSTALL" = "false" ]; then echo "Skipping RISC-V OpenOCD" else echo "Building RISC-V OpenOCD" + cd "$CHIPYARD_DIR/toolchains/$TOOLCHAIN" check_version automake 1.14 "OpenOCD build" check_version autoconf 2.64 "OpenOCD build" build_project riscv-openocd --prefix=$RISCV --enable-remote-bitbang --enable-jtag_vpi --disable-werror From 72b5df057a241351888c8e793f45c2bff0d2fc53 Mon Sep 17 00:00:00 2001 From: alonamid Date: Mon, 22 Jul 2019 17:43:51 +0000 Subject: [PATCH 51/55] Return to main dir --- scripts/build-toolchains.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/build-toolchains.sh b/scripts/build-toolchains.sh index 8d5676ce..ac4316b7 100755 --- a/scripts/build-toolchains.sh +++ b/scripts/build-toolchains.sh @@ -155,5 +155,6 @@ if [ "$FASTINSTALL" = "false" ]; then check_version autoconf 2.64 "OpenOCD build" build_project riscv-openocd --prefix=$RISCV --enable-remote-bitbang --enable-jtag_vpi --disable-werror echo -e "\\nRISC-V OpenOCD installation completed!" + cd $RDIR fi fi From 3b4f52ab59705ce2c3fa8012d82e29ea17e1a172 Mon Sep 17 00:00:00 2001 From: alonamid Date: Mon, 22 Jul 2019 21:06:52 +0000 Subject: [PATCH 52/55] bump firesim --- sims/firesim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sims/firesim b/sims/firesim index ce44b13e..4cd75833 160000 --- a/sims/firesim +++ b/sims/firesim @@ -1 +1 @@ -Subproject commit ce44b13e976524238746d67b2ff45bde04e4e9ce +Subproject commit 4cd75833dfc1f9f796a1c5505ece6937fd253189 From fe45d9497428444eda1871e5751f615bf5d2e177 Mon Sep 17 00:00:00 2001 From: Howard Mao Date: Thu, 11 Jul 2019 03:38:11 +0000 Subject: [PATCH 53/55] make sure git submodule update --init run from top-level directories --- scripts/firesim-setup.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/firesim-setup.sh b/scripts/firesim-setup.sh index 53dee5ab..302294bf 100755 --- a/scripts/firesim-setup.sh +++ b/scripts/firesim-setup.sh @@ -7,12 +7,12 @@ set -o pipefail RDIR=$(pwd) scripts_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -sims_dir=$scripts_dir/../sims/ + +cd $scripts_dir/.. # Reenable the FireSim submodule git config --unset submodule.sims/firesim.update || true -cd $sims_dir -git submodule update --init firesim -cd firesim +git submodule update --init sims/firesim +cd sims/firesim ./build-setup.sh $@ --library cd $RDIR From ce0806a37148c180edad177d5e41c5169ca8720d Mon Sep 17 00:00:00 2001 From: Abraham Gonzalez Date: Wed, 24 Jul 2019 10:51:40 -0700 Subject: [PATCH 54/55] Switch submodules to https --- .gitmodules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 03507b25..20898374 100644 --- a/.gitmodules +++ b/.gitmodules @@ -42,7 +42,7 @@ url = https://github.com/ucb-bar/esp-tools.git [submodule "vlsi/hammer"] path = vlsi/hammer - url = git@github.com:ucb-bar/hammer.git + url = https://github.com/ucb-bar/hammer.git [submodule "vlsi/hammer-cad-plugins"] path = vlsi/hammer-cad-plugins - url = git@github.com:ucb-bar/hammer-cad-plugins + url = https://github.com/ucb-bar/hammer-cad-plugins From 87195152abe742f932e19185a0bd2efb40a9f1ea Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Wed, 24 Jul 2019 13:24:32 -0700 Subject: [PATCH 55/55] added .git to end of hammer-cad-plugins --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 20898374..5bbbedd0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -45,4 +45,4 @@ url = https://github.com/ucb-bar/hammer.git [submodule "vlsi/hammer-cad-plugins"] path = vlsi/hammer-cad-plugins - url = https://github.com/ucb-bar/hammer-cad-plugins + url = https://github.com/ucb-bar/hammer-cad-plugins.git