eda.sh 24 lignes · 910 octets
#!/usr/bin/env bash
# Run a command inside the open-source EDA container (Yosys, Verilator, Icarus,
# OpenROAD, OpenSTA…) with the repository mounted at the same absolute path, so
# file names in reports are identical inside and outside the container.
#
#   flows/eda.sh yosys -V
#   flows/eda.sh verilator --version
#   flows/eda.sh bash -c 'cd build/spike && yosys -q -s synth.ys'
#
# Works on x86_64 and arm64 (the image is multi-arch). Set EDA_IMAGE to override.
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
IMAGE="${EDA_IMAGE:-hpretl/iic-osic-tools:latest}"
TTY=()
if [ -t 0 ] && [ -t 1 ]; then TTY=(-it); fi
exec docker run --rm "${TTY[@]}" \
  --entrypoint /bin/bash \
  --user "$(id -u):$(id -g)" \
  -e HOME=/tmp \
  -e PATH=/foss/tools/bin:/usr/local/bin:/usr/bin:/bin \
  -e PDK_ROOT=/foss/pdks \
  -v "$ROOT:$ROOT" \
  -w "${PWD}" \
  "$IMAGE" -c 'exec "$@"' -- "$@"