diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2b8da64..afed37b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,10 +6,11 @@ jobs: steps: - name: Checkout subservient uses: actions/checkout@v2 + - name: Build with Openlane + uses: librecores/ci-fusesoc-action@migrate-dockerized with: - path: subservient - - run: echo "EDALIZE_LAUNCHER='eda-container-wrapper --split-cwd-tail=1 --non-interactive openlane --'" >> $GITHUB_ENV - - run: pip3 install fusesoc eda-container-wrapper - - run: fusesoc library add serv https://github.com/olofk/serv - - run: fusesoc library add subservient $GITHUB_WORKSPACE/subservient - - run: fusesoc run --target=sky130 subservient + libraries: https://github.com/olofk/serv + core: subservient + target: sky130 + tool: openlane + diff --git a/openlane_runner.py b/openlane_runner.py new file mode 100755 index 0000000..45cb141 --- /dev/null +++ b/openlane_runner.py @@ -0,0 +1,38 @@ +#!/usr/bin/python3 + +#This script is a launcher script for Edalize +#Normally Edalize will launch the EDA tools directly, but if the +#EDALIZE_LAUNCHER environmnet variable is set and points to an executable file, +#this file will be called with the command-line that Edalize would otherwise +#have launched. +# +#This allows us to define a custom launcher, as in this case where we intercept +#the call to flow.tcl (the entry point to the openlane flow) and start up a +#container. If Edalize wants to execute other applications, we just start them +#the normal way + +import os +import subprocess +import sys + +def enverr(e): + print(f"Error: Openlane backend needs environment variable '{e}' to be set") + exit(1) + +if 'flow.tcl' in sys.argv[1]: + pdk_root = os.environ.get('PDK_ROOT') or enverr('PDK_ROOT') + (build_root, work) = os.path.split(os.getcwd()) + + image = "efabless/openlane:v0.12" + + prefix = ["docker", "run", + "-v", f"{pdk_root}:{pdk_root}", + "-v", f"{build_root}:/project", + "-e", f"PDK_ROOT={pdk_root}", + "-u", f"{os.getuid()}:{os.getgid()}", + "-w", f"/project/{work}", + image] + sys.exit(subprocess.call(prefix+sys.argv[1:])) +else: + sys.exit(subprocess.call(sys.argv[1:])) +