Skip to content

Commit

Permalink
fixes to the makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
marwaneltoukhy committed Nov 29, 2023
1 parent 7b43586 commit b6210ef
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 24 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/user_project_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ jobs:
- name: Harden using Openlane
run: |
curl https://raw.githubusercontent.com/efabless/central_CI/main/tools.json > tool_versions.json
python3 $GITHUB_WORKSPACE/.github/scripts/get_designs.py --design $GITHUB_WORKSPACE
for word in $(cat harden_sequence.txt); do
echo "CURRENT_DESIGN=${word}" >> $GITHUB_ENV
Expand Down Expand Up @@ -425,6 +426,7 @@ jobs:
- name: Run STA
run: |
curl https://raw.githubusercontent.com/efabless/central_CI/main/tools.json > tool_versions.json
export CUP_ROOT=$GITHUB_WORKSPACE
export PROJECT_ROOT=$GITHUB_WORKSPACE
cd $CUP_ROOT
Expand Down
64 changes: 42 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ ifeq ($(PDK),gf180mcuD)
endif

# Include Caravel Makefile Targets
# .PHONY: % : check-caravel
# %:
# export CARAVEL_ROOT=$(CARAVEL_ROOT) && export MPW_TAG=$(MPW_TAG) && $(MAKE) -f $(CARAVEL_ROOT)/Makefile $@
.PHONY: % : check-caravel
%:
@export CARAVEL_ROOT=$(CARAVEL_ROOT) && $(MAKE) -f $(CARAVEL_ROOT)/Makefile $@

# Install DV setup
.PHONY: simenv
Expand Down Expand Up @@ -223,24 +223,52 @@ update_caravel: check-caravel
uninstall:
rm -rf $(CARAVEL_ROOT)

# Install Caravel
.PHONY: install
install: clean_log check-python check_dependencies install-volare
@./venv/bin/$(PYTHON_BIN) -m pip install --upgrade --no-cache-dir requests >> setup.log
@./venv/bin/$(PYTHON_BIN) -u scripts/get_tools.py --openlane_root $(OPENLANE_ROOT) --precheck_root $(PRECHECK_ROOT) --pdk_root $(PDK_ROOT) --caravel_root $(CARAVEL_ROOT) --mcw_root $(MCW_ROOT) --timing_root $(TIMING_ROOT) --tool caravel

# Install mgmt_core_wrapper
.PHONY: install_mcw
install_mcw: clean_log check-python check_dependencies install-volare
@./venv/bin/$(PYTHON_BIN) -m pip install --upgrade --no-cache-dir requests >> setup.log
@./venv/bin/$(PYTHON_BIN) -u scripts/get_tools.py --openlane_root $(OPENLANE_ROOT) --precheck_root $(PRECHECK_ROOT) --pdk_root $(PDK_ROOT) --caravel_root $(CARAVEL_ROOT) --mcw_root $(MCW_ROOT) --timing_root $(TIMING_ROOT) --tool mgmt_core_wrapper

# Install mgmt_core_wrapper
.PHONY: pdk-with-volare
pdk-with-volare: clean_log check-python check_dependencies install-volare
@./venv/bin/$(PYTHON_BIN) -m pip install --upgrade --no-cache-dir requests >> setup.log
@./venv/bin/$(PYTHON_BIN) -u scripts/get_tools.py --openlane_root $(OPENLANE_ROOT) --precheck_root $(PRECHECK_ROOT) --pdk_root $(PDK_ROOT) --caravel_root $(CARAVEL_ROOT) --mcw_root $(MCW_ROOT) --timing_root $(TIMING_ROOT) --tool pdk

# Install mgmt_core_wrapper
.PHONY: openlane
openlane: clean_log check-python check_dependencies install-volare
@./venv/bin/$(PYTHON_BIN) -m pip install --upgrade --no-cache-dir requests >> setup.log
@./venv/bin/$(PYTHON_BIN) -u scripts/get_tools.py --openlane_root $(OPENLANE_ROOT) --precheck_root $(PRECHECK_ROOT) --pdk_root $(PDK_ROOT) --caravel_root $(CARAVEL_ROOT) --mcw_root $(MCW_ROOT) --timing_root $(TIMING_ROOT) --tool openlane


# Install mgmt_core_wrapper
.PHONY: setup-timing-scripts
setup-timing-scripts: clean_log check-python check_dependencies install-volare
@./venv/bin/$(PYTHON_BIN) -m pip install --upgrade --no-cache-dir requests >> setup.log
@./venv/bin/$(PYTHON_BIN) -u scripts/get_tools.py --openlane_root $(OPENLANE_ROOT) --precheck_root $(PRECHECK_ROOT) --pdk_root $(PDK_ROOT) --caravel_root $(CARAVEL_ROOT) --mcw_root $(MCW_ROOT) --timing_root $(TIMING_ROOT) --tool timing_scripts


# Install mgmt_core_wrapper
.PHONY: precheck
precheck: clean_log check-python check_dependencies install-volare
@./venv/bin/$(PYTHON_BIN) -m pip install --upgrade --no-cache-dir requests >> setup.log
@./venv/bin/$(PYTHON_BIN) -u scripts/get_tools.py --openlane_root $(OPENLANE_ROOT) --precheck_root $(PRECHECK_ROOT) --pdk_root $(PDK_ROOT) --caravel_root $(CARAVEL_ROOT) --mcw_root $(MCW_ROOT) --timing_root $(TIMING_ROOT) --tool precheck


.PHONY: check_versions
check_versions:
@if [ "$$DISABLE_VERSION_CHECK" = "1" ]; then\
echo "Skipping version check"; \
else \
./venv/bin/$(PYTHON_BIN) -u scripts/compare_versions.py; \
fi
# Install Pre-check
# Default installs to the user home directory, override by "export PRECHECK_ROOT=<precheck-installation-path>"
.PHONY: precheck
precheck:
if [ -d "$(PRECHECK_ROOT)" ]; then\
echo "Deleting exisiting $(PRECHECK_ROOT)" && \
rm -rf $(PRECHECK_ROOT) && sleep 2;\
fi
@echo "Installing Precheck.."
@git clone --depth=1 --branch $(MPW_TAG) https://github.com/efabless/mpw_precheck.git $(PRECHECK_ROOT)
@docker pull efabless/mpw_precheck:latest

.PHONY: run-precheck
run-precheck: check_versions check-pdk check-precheck
Expand Down Expand Up @@ -324,14 +352,6 @@ export TIMING_ROOT?=$(shell pwd)/dependencies/timing-scripts
export PROJECT_ROOT=$(CUP_ROOT)
timing-scripts-repo=https://github.com/efabless/timing-scripts.git

$(TIMING_ROOT):
@mkdir -p $(CUP_ROOT)/dependencies
@git clone $(timing-scripts-repo) $(TIMING_ROOT)

.PHONY: setup-timing-scripts
setup-timing-scripts: $(TIMING_ROOT)
@( cd $(TIMING_ROOT) && git pull )
@#( cd $(TIMING_ROOT) && git fetch && git checkout $(MPW_TAG); )

.PHONY: install-caravel-cocotb
install-caravel-cocotb:
Expand Down
41 changes: 41 additions & 0 deletions scripts/export_env.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# SPDX-FileCopyrightText: 2023 Efabless Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0

import argparse
import json


def print_commit(tool_name):
with open('tool_versions.json', 'r') as file:
tool_versions_json = json.load(file)

if tool_name in tool_versions_json:
commit = tool_versions_json[tool_name]['commit']
print(commit)
else:
print("Invalid tool name")


def main():
parser = argparse.ArgumentParser()
parser.add_argument('tool_name', help='Name of the tool to print the commit for')
args = parser.parse_args()

print_commit(args.tool_name)


if __name__ == '__main__':
main()
9 changes: 7 additions & 2 deletions scripts/get_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def parse_json_file(url):
return data


def download_tools(openlane_root, precheck_root, pdk_root, caravel_root, mcw_root, timing_root):
def download_tools(openlane_root, precheck_root, pdk_root, caravel_root, mcw_root, timing_root, tool):
"""Downloads the tools from the upstream GitHub repo.
"""
url = 'https://raw.githubusercontent.com/efabless/central_CI/main/tools.json'
Expand All @@ -61,6 +61,8 @@ def download_tools(openlane_root, precheck_root, pdk_root, caravel_root, mcw_roo
with Progress(TextColumn("[progress.description]{task.description}"), BarColumn(), MofNCompleteColumn(), TimeElapsedColumn()) as progress:
task = progress.add_task("[cyan]Downloading Tools...", total=6)
for key, value in data.items():
if tool and key != tool:
continue
if key == "OpenLane":
progress.update(task, description="[cyan]Downloading OpenLane...")
download_tar("OpenLane", value['commit'], value['url'], openlane_root)
Expand Down Expand Up @@ -133,14 +135,17 @@ def main():
help='Path to the Mgmt Core Wrapper root directory')
parser.add_argument('--timing_root', required=True,
help='Path to the Timing Scripts root directory')
parser.add_argument('--tool', required=False,
help='Name of the tool to download')

args = parser.parse_args()
download_tools(openlane_root=args.openlane_root,
precheck_root=args.precheck_root,
pdk_root=args.pdk_root,
caravel_root=args.caravel_root,
mcw_root=args.mcw_root,
timing_root=args.timing_root)
timing_root=args.timing_root,
tool=args.tool)


if __name__ == '__main__':
Expand Down

0 comments on commit b6210ef

Please sign in to comment.