diff --git a/Makefile b/Makefile index 3fac66b0..89defd4f 100644 --- a/Makefile +++ b/Makefile @@ -18,6 +18,7 @@ OPEN_PDKS_GIT_REPO ?= https://github.com/RTimothyEdwards/open_pdks.git OPEN_PDKS_GIT_COMMIT ?= 1.0.311 #OPEN_PDKS_GIT_COMMIT ?= 7ea416610339d3c29af9d0d748ceadd3fd368608 SKY130_PDK ?= $(PDK_ROOT)/sky130A +INSTALL_SRAM = false # Skywater PDK SKY130_PDKS_DIR ?= $(PDK_ROOT)/skywater-pdk @@ -53,32 +54,36 @@ ifndef PDK_ROOT endif $(SKY130_PDKS_DIR): check-pdk-root - git clone https://github.com/google/skywater-pdk.git $(PDK_ROOT)/skywater-pdk - cd $(SKY130_PDKS_DIR) && \ + @echo "Cloning skywater PDK..." + @[ -d $(PDK_ROOT)/skywater-pdk ] || \ + git clone https://github.com/google/skywater-pdk.git $(PDK_ROOT)/skywater-pdk + @cd $(SKY130_PDKS_DIR) && \ git checkout main && git pull && \ git checkout -qf $(SKY130_PDKS_GIT_COMMIT) && \ git submodule update --init libraries/sky130_fd_pr/latest $(OPEN_PDKS_DIR): $(SKY130_PDKS_DIR) @echo "Cloning open_pdks..." - git clone $(OPEN_PDKS_GIT_REPO) $(OPEN_PDKS_DIR) - cd $(OPEN_PDKS_DIR) && git checkout $(OPEN_PDKS_GIT_COMMIT) + @[ -d $(OPEN_PDKS_DIR) ] || \ + git clone $(OPEN_PDKS_GIT_REPO) $(OPEN_PDKS_DIR) + @cd $(OPEN_PDKS_DIR) && git pull && git checkout $(OPEN_PDKS_GIT_COMMIT) -$(SKY130_PDK): $(OPEN_PDKS_DIR) +$(SKY130_PDK): $(OPEN_PDKS_DIR) $(SKY130_PDKS_DIR) @echo "Installing open_pdks..." - cd $(OPEN_PDKS_DIR) && \ - ./configure --enable-sky130-pdk=$(PDK_ROOT)/skywater-pdk/libraries --with-sky130-local-path=$(PDK_ROOT) --enable-sram-sky130=$(INSTALL_SRAM) && \ + $(DOCKER_CMD) sh -c ". /home/cad-user/.bashrc && cd /pdk/open_pdks && \ + ./configure --enable-sky130-pdk=/pdk/skywater-pdk/libraries --with-sky130-local-path=/pdk --enable-sram-sky130=$(INSTALL_SRAM) && \ cd sky130 && \ make veryclean && \ make && \ - make SHARED_PDKS_PATH=$(PDK_ROOT) install + make SHARED_PDKS_PATH=/pdk install" $(SRAM_LIB_DIR): check-pdk-root + @echo "Cloning SRAM library..." @[ -d $(SRAM_LIB_DIR) ] || (\ - echo "Cloning SRAM library..." && git clone $(SRAM_LIB_GIT_REPO) $(SRAM_LIB_DIR) && \ - cd $(SRAM_LIB_DIR) && git checkout $(SRAM_LIB_GIT_COMMIT)) + git clone $(SRAM_LIB_GIT_REPO) $(SRAM_LIB_DIR) && \ + cd $(SRAM_LIB_DIR) && git pull && git checkout $(SRAM_LIB_GIT_COMMIT)) -install: $(SRAM_LIB_DIR) +install: $(SRAM_LIB_DIR) pdk @[ -d $(PDK_ROOT)/sky130A ] || \ (echo "Warning: $(PDK_ROOT)/sky130A not found!! Run make pdk first." && false) @[ -d $(PDK_ROOT)/skywater-pdk ] || \ diff --git a/compiler/tests/Makefile b/compiler/tests/Makefile index 5c09d88f..f7bbc91b 100644 --- a/compiler/tests/Makefile +++ b/compiler/tests/Makefile @@ -118,18 +118,7 @@ $(TEST_BASES): @rm -rf results/$* @rm -rf results/$*.* @mkdir -p results/$*/tmp - @docker run \ - -v $(TOP_DIR):/openram \ - -v $(FREEPDK45):/freepdk45 \ - -e FREEPDK45=/freepdk45 \ - -v $(PDK_ROOT):/pdk \ - -e PDK_ROOT=/pdk \ - -e PDKPATH=/pdk/sky130A \ - -v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro \ - --user $(UID):$(GID) \ - -e OPENRAM_TMP=$(OPENRAM_DIR)/results/$*/tmp \ - vlsida/openram-ubuntu:latest \ - sh -c ". /home/cad-user/.bashrc && sleep 1 && python3 -u $(OPENRAM_DIR)/$(getfile).py \ + @$(DOCKER_CMD) sh -c ". /home/cad-user/.bashrc && sleep 1 && python3 -u $(OPENRAM_DIR)/$(getfile).py \ -t $(gettech) -k -v $(ARGS) -p $(OPENRAM_DIR)/results/$* > $(OPENRAM_DIR)/results/$*.out 2>&1 && touch $(OPENRAM_DIR)/results/$*.ok || touch $(OPENRAM_DIR)/results/$*.bad" @test -f $(TOP_DIR)/compiler/tests/results/$*.ok && echo "$* ... PASS!" && \ rm -rf $(TOP_DIR)/compiler/tests/results/$* || echo "$* ... FAIL!" diff --git a/docker/Makefile b/docker/Makefile index 5ef0d273..0e6a0143 100644 --- a/docker/Makefile +++ b/docker/Makefile @@ -19,12 +19,3 @@ push: pull: docker pull vlsida/openram-ubuntu:latest -mount: - docker run -it -v $(TOP_DIR):/openram \ - -v $(SKY130_PDK):$(SKY130_PDK) \ - -e PDK_ROOT=$(PDK_ROOT) \ - -e OPENRAM_HOME=/openram/compiler \ - -e OPENRAM_TECH=/openram/technology \ - --user $(UID):$(GID) \ - vlsida/openram-ubuntu:latest -.PHONY: mount diff --git a/docker/set-paths.sh b/docker/set-paths.sh index bbe2023d..1435f7cb 100644 --- a/docker/set-paths.sh +++ b/docker/set-paths.sh @@ -13,10 +13,3 @@ export PATH=$PATH:$XYCE_PATH export XYCE_LIB=$XYCE_HOME/lib export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$XYCE_LIB export XYCE_NO_TRACKING="anything at all" - -# OpenRAM -export OPENRAM_HOME=/openram/compiler -export OPENRAM_TECH=/openram/technology - -# FreePDK45 -export FREEPDK45=/freepdk45 diff --git a/macros/Makefile b/macros/Makefile index a51cd678..f2b02466 100644 --- a/macros/Makefile +++ b/macros/Makefile @@ -64,12 +64,16 @@ scn4m_subm: $(SCN4M_SUBM_STAMPS) %.ok: configs/%.py @echo "Building $*" @mkdir -p $* - docker run -v $(TOP_DIR):/openram \ - -v $(SKY130_PDK):$(SKY130_PDK) \ - -e PDK_ROOT=$(PDK_ROOT) \ + @docker run -v $(TOP_DIR):/openram \ + -v $(FREEPDK45):/freepdk45 \ + -e FREEPDK45=/freepdk45 \ + -v $(PDK_ROOT):/pdk \ + -e PDK_ROOT=/pdk \ + -e PDKPATH=/pdk/sky130A \ -e OPENRAM_HOME=/openram/compiler \ -e OPENRAM_TECH=/openram/technology \ -e OPENRAM_TMP=/openram/macros/$*/tmp \ + -v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro \ --user $(UID):$(GID) \ vlsida/openram-ubuntu:latest \ python3 -u /openram/compiler/openram.py $(OPENRAM_OPTS) -o $* -p /openram/macros/$* /openram/macros/$< && touch $@ diff --git a/openram.mk b/openram.mk index 742b31d0..b0e57268 100644 --- a/openram.mk +++ b/openram.mk @@ -17,8 +17,25 @@ export PDK_ROOT UID = $(shell id -u) GID = $(shell id -g) +export DOCKER_CMD= docker run \ + -v $(TOP_DIR):/openram \ + -v $(FREEPDK45):/freepdk45 \ + -e FREEPDK45=/freepdk45 \ + -v $(PDK_ROOT):/pdk \ + -e PDK_ROOT=/pdk \ + -e PDKPATH=/pdk/sky130A \ + -e OPENRAM_HOME=/openram/compiler \ + -e OPENRAM_TECH=/openram/technology \ + -e OPENRAM_TMP=$(OPENRAM_DIR)/results/$*/tmp \ + -v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro \ + --user $(UID):$(GID) \ + vlsida/openram-ubuntu:latest + mount: - @docker run -it -v $(TOP_DIR):/openram \ + @docker run -it \ + -v $(TOP_DIR):/openram \ + -v $(FREEPDK45):/freepdk45 \ + -e FREEPDK45=/freepdk45 \ -v $(PDK_ROOT):/pdk \ -e PDK_ROOT=/pdk \ -e PDKPATH=/pdk/sky130A \