Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 103 additions & 0 deletions .github/actions/openxc7-chipdb/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: openXC7 chipdb
description: >-
Restore, or build and save, the nextpnr-xilinx chipdb for one part. The cache
key is the part plus the ID of the image that builds it, so it hits on every
run that uses the same image and misses exactly when the image moves.
gHashTag/trinity-fpga#843.

# Why the key looks like this.
#
# A chipdb is a pure function of the part and of the nextpnr-xilinx and
# prjxray-db trees inside the image, so the image ID is a sufficient key.
#
# - A key carrying github.run_id never matches exactly. actions/cache sets
# cache-hit only on an exact match (a restore-keys match leaves it false), so
# `if: cache-hit != 'true'` rebuilt the chipdb on every run.
# - A fixed key on a floating tag never misses, and keeps serving a chipdb built
# by an image the job no longer runs.
#
# The cached path is the same for every workflow (~/.cache/openxc7-chipdb/<part>.bin)
# and is copied to `out` afterwards. actions/cache folds the path list into the
# entry's version, so caching `out` directly would give each of the ~50 workflows
# its own copy of an identical file.
#
# The chipdb is saved straight after it is built, not in a post-job step, so a
# later nextpnr failure does not throw the build away.
#
# Caches are scoped by ref: an entry saved on main is visible to every branch and
# PR, an entry saved in a PR only to that PR.

inputs:
part:
description: Xilinx part, e.g. xc7a200tfbg484-2
default: xc7a200tfbg484-2
out:
description: Path of the chipdb .bin to produce, relative to the workspace
required: true
image:
description: The openXC7 image the job's nextpnr step runs (tag or digest)
default: regymm/openxc7

outputs:
cache-hit:
description: "'true' when the chipdb came from the cache"
value: ${{ steps.restore.outputs.cache-hit }}
image-id:
description: ID of the image the chipdb belongs to
value: ${{ steps.ident.outputs.image-id }}
key:
description: The cache key used
value: ${{ steps.ident.outputs.key }}

runs:
using: composite
steps:
- id: ident
shell: bash
env:
IMAGE: ${{ inputs.image }}
PART: ${{ inputs.part }}
run: |
# Use the image already on the runner if a previous step pulled it, so
# the chipdb and the job's nextpnr come from the same image.
present=false
docker image inspect "$IMAGE" >/dev/null 2>&1 && present=true
if [ "$present" = false ]; then docker pull -q "$IMAGE" >/dev/null; fi
image_id=$(docker image inspect --format '{{.Id}}' "$IMAGE")
key="chipdb-$PART-${image_id#sha256:}-bbasm-le-v1"
echo "image-id=$image_id" >> "$GITHUB_OUTPUT"
echo "key=$key" >> "$GITHUB_OUTPUT"
echo "chipdb key $key ($IMAGE)"

- id: restore
uses: actions/cache/restore@v4
with:
path: ~/.cache/openxc7-chipdb/${{ inputs.part }}.bin
key: ${{ steps.ident.outputs.key }}

- if: steps.restore.outputs.cache-hit != 'true'
shell: bash
env:
IMAGE_ID: ${{ steps.ident.outputs.image-id }}
PART: ${{ inputs.part }}
run: |
mkdir -p ~/.cache/openxc7-chipdb
docker run --rm -v "$HOME/.cache/openxc7-chipdb:/chipdb" "$IMAGE_ID" bash -c "cd /nextpnr-xilinx && \
python3 xilinx/python/bbaexport.py --device $PART --bba /chipdb/$PART.bba && \
bbasm -l /chipdb/$PART.bba /chipdb/$PART.bin && rm -f /chipdb/$PART.bba"

- if: steps.restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ~/.cache/openxc7-chipdb/${{ inputs.part }}.bin
key: ${{ steps.ident.outputs.key }}

- shell: bash
env:
PART: ${{ inputs.part }}
OUT: ${{ inputs.out }}
HIT: ${{ steps.restore.outputs.cache-hit }}
run: |
mkdir -p "$(dirname "$OUT")"
cp -f "$HOME/.cache/openxc7-chipdb/$PART.bin" "$OUT"
echo "chipdb $OUT $(stat -c %s "$OUT") bytes cache-hit=${HIT:-false}"
25 changes: 4 additions & 21 deletions .github/workflows/ax7203-blinky-bitstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,28 +53,11 @@ jobs:
" 2>&1 | tee /tmp/yosys.log
grep "Estimated number of LCs" /tmp/yosys.log

- name: Cache chipdb for xc7a200tfbg484-2
id: chipdb-cache
uses: actions/cache@v4
- id: chipdb-cache
uses: ./.github/actions/openxc7-chipdb
with:
path: build/ax7203_blinky/chipdb/xc7a200tfbg484-2.bin
key: chipdb-xc7a200tfbg484-2-regymm-openxc7-${{ github.run_id }}
restore-keys: |
chipdb-xc7a200tfbg484-2-regymm-openxc7-

- name: Generate chipdb for xc7a200tfbg484-2
if: steps.chipdb-cache.outputs.cache-hit != 'true'
run: |
mkdir -p build/ax7203_blinky/chipdb
docker run --rm \
-v "$PWD:/work" -w /work \
regymm/openxc7 \
bash -c "
cd /nextpnr-xilinx && \
python3 xilinx/python/bbaexport.py --device xc7a200tfbg484-2 --bba /work/build/ax7203_blinky/chipdb/xc7a200tfbg484-2.bba && \
bbasm -l /work/build/ax7203_blinky/chipdb/xc7a200tfbg484-2.bba /work/build/ax7203_blinky/chipdb/xc7a200tfbg484-2.bin
"
ls -lh build/ax7203_blinky/chipdb/xc7a200tfbg484-2.bin
part: xc7a200tfbg484-2
out: build/ax7203_blinky/chipdb/xc7a200tfbg484-2.bin

- name: nextpnr place and route
run: |
Expand Down
13 changes: 4 additions & 9 deletions .github/workflows/ax7203-corona-decode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,11 @@ jobs:
synth_xilinx -flatten -abc9 -nocarry -arch xc7 -top ${{ steps.cell.outputs.top }};
setundef -zero -params; write_json build/corona_decode/corona_decode_ax7203.json" 2>&1 | tee /tmp/yosys.log
grep -E "Estimated|ERROR" /tmp/yosys.log
- uses: actions/cache@v4
id: chipdb
- id: chipdb
uses: ./.github/actions/openxc7-chipdb
with:
path: build/corona_decode/chipdb/xc7a200tfbg484-2.bin
key: chipdb-xc7a200tfbg484-2-regymm-${{ github.run_id }}
restore-keys: chipdb-xc7a200tfbg484-2-regymm-
- if: steps.chipdb.outputs.cache-hit != 'true'
run: |
mkdir -p build/corona_decode/chipdb
docker run --rm -v "$PWD:/work" -w /work regymm/openxc7 bash -c "cd /nextpnr-xilinx && python3 xilinx/python/bbaexport.py --device xc7a200tfbg484-2 --bba /work/build/corona_decode/chipdb/xc7a200tfbg484-2.bba && bbasm -l /work/build/corona_decode/chipdb/xc7a200tfbg484-2.bba /work/build/corona_decode/chipdb/xc7a200tfbg484-2.bin"
part: xc7a200tfbg484-2
out: build/corona_decode/chipdb/xc7a200tfbg484-2.bin
- name: nextpnr (seed search)
run: |
CLEAN=0; for s in $(seq 1 8); do
Expand Down
25 changes: 4 additions & 21 deletions .github/workflows/ax7203-dual-clk-heartbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,11 @@ jobs:
" 2>&1 | tee /tmp/yosys.log
grep -E "Estimated number of LCs|ERROR" /tmp/yosys.log

- name: Cache chipdb for xc7a200tfbg484-2
id: chipdb-cache
uses: actions/cache@v4
- id: chipdb-cache
uses: ./.github/actions/openxc7-chipdb
with:
path: build/ax7203_dualclk/chipdb/xc7a200tfbg484-2.bin
key: chipdb-xc7a200tfbg484-2-regymm-openxc7-${{ github.run_id }}
restore-keys: |
chipdb-xc7a200tfbg484-2-regymm-openxc7-

- name: Generate chipdb for xc7a200tfbg484-2
if: steps.chipdb-cache.outputs.cache-hit != 'true'
run: |
mkdir -p build/ax7203_dualclk/chipdb
docker run --rm \
-v "$PWD:/work" -w /work \
regymm/openxc7 \
bash -c "
cd /nextpnr-xilinx && \
python3 xilinx/python/bbaexport.py --device xc7a200tfbg484-2 --bba /work/build/ax7203_dualclk/chipdb/xc7a200tfbg484-2.bba && \
bbasm -l /work/build/ax7203_dualclk/chipdb/xc7a200tfbg484-2.bba /work/build/ax7203_dualclk/chipdb/xc7a200tfbg484-2.bin
"
ls -lh build/ax7203_dualclk/chipdb/xc7a200tfbg484-2.bin
part: xc7a200tfbg484-2
out: build/ax7203_dualclk/chipdb/xc7a200tfbg484-2.bin

- name: nextpnr place and route (seed search for a clean $PACKER_VCC_NET route)
run: |
Expand Down
14 changes: 4 additions & 10 deletions .github/workflows/ax7203-format-cost.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,11 @@ jobs:
setundef -zero -params" 2>&1 | tee /tmp/yosys_carry.log
grep -E "Estimated|ERROR" /tmp/yosys_carry.log
! grep -q "ERROR" /tmp/yosys_carry.log
- uses: actions/cache@v4
id: chipdb
- id: chipdb
uses: ./.github/actions/openxc7-chipdb
with:
path: build/fmtcost/chipdb/xc7a200tfbg484-2.bin
key: chipdb-xc7a200tfbg484-2-regymm-${{ github.run_id }}
restore-keys: chipdb-xc7a200tfbg484-2-regymm-
- if: steps.chipdb.outputs.cache-hit != 'true'
name: Build chipdb
run: |
mkdir -p build/fmtcost/chipdb
docker run --rm -v "$PWD:/work" -w /work regymm/openxc7 bash -c "cd /nextpnr-xilinx && python3 xilinx/python/bbaexport.py --device xc7a200tfbg484-2 --bba /work/build/fmtcost/chipdb/xc7a200tfbg484-2.bba && bbasm -l /work/build/fmtcost/chipdb/xc7a200tfbg484-2.bba /work/build/fmtcost/chipdb/xc7a200tfbg484-2.bin"
part: xc7a200tfbg484-2
out: build/fmtcost/chipdb/xc7a200tfbg484-2.bin
- name: nextpnr (seed search)
run: |
TOP=corona_compute_${{ matrix.cell }}_ax7203
Expand Down
13 changes: 4 additions & 9 deletions .github/workflows/ax7203-gf10-add.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,11 @@ jobs:
synth_xilinx -flatten -abc9 -nocarry -arch xc7 -top gf10_add_ax7203;
setundef -zero -params; write_json build/gf10_add/gf10_add_ax7203.json" 2>&1 | tee /tmp/yosys.log
grep -E "Estimated|ERROR" /tmp/yosys.log
- uses: actions/cache@v4
id: chipdb
- id: chipdb
uses: ./.github/actions/openxc7-chipdb
with:
path: build/gf10_add/chipdb/xc7a200tfbg484-2.bin
key: chipdb-xc7a200tfbg484-2-regymm-${{ github.run_id }}
restore-keys: chipdb-xc7a200tfbg484-2-regymm-
- if: steps.chipdb.outputs.cache-hit != 'true'
run: |
mkdir -p build/gf10_add/chipdb
docker run --rm -v "$PWD:/work" -w /work regymm/openxc7 bash -c "cd /nextpnr-xilinx && python3 xilinx/python/bbaexport.py --device xc7a200tfbg484-2 --bba /work/build/gf10_add/chipdb/xc7a200tfbg484-2.bba && bbasm -l /work/build/gf10_add/chipdb/xc7a200tfbg484-2.bba /work/build/gf10_add/chipdb/xc7a200tfbg484-2.bin"
part: xc7a200tfbg484-2
out: build/gf10_add/chipdb/xc7a200tfbg484-2.bin
- name: nextpnr (seed search)
run: |
CLEAN=0; for s in 1 2 3 4 5 6 7 8; do
Expand Down
13 changes: 4 additions & 9 deletions .github/workflows/ax7203-gf10-mul.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,11 @@ jobs:
synth_xilinx -flatten -abc9 -nocarry -nodsp -arch xc7 -top gf10_mul_ax7203;
setundef -zero -params; write_json build/gf10_mul/gf10_mul_ax7203.json" 2>&1 | tee /tmp/yosys.log
grep -E "Estimated|ERROR" /tmp/yosys.log
- uses: actions/cache@v4
id: chipdb
- id: chipdb
uses: ./.github/actions/openxc7-chipdb
with:
path: build/gf10_mul/chipdb/xc7a200tfbg484-2.bin
key: chipdb-xc7a200tfbg484-2-regymm-${{ github.run_id }}
restore-keys: chipdb-xc7a200tfbg484-2-regymm-
- if: steps.chipdb.outputs.cache-hit != 'true'
run: |
mkdir -p build/gf10_mul/chipdb
docker run --rm -v "$PWD:/work" -w /work regymm/openxc7 bash -c "cd /nextpnr-xilinx && python3 xilinx/python/bbaexport.py --device xc7a200tfbg484-2 --bba /work/build/gf10_mul/chipdb/xc7a200tfbg484-2.bba && bbasm -l /work/build/gf10_mul/chipdb/xc7a200tfbg484-2.bba /work/build/gf10_mul/chipdb/xc7a200tfbg484-2.bin"
part: xc7a200tfbg484-2
out: build/gf10_mul/chipdb/xc7a200tfbg484-2.bin
- name: nextpnr (seed search, heap+sa — wider for the mul core)
run: |
CLEAN=0
Expand Down
13 changes: 4 additions & 9 deletions .github/workflows/ax7203-gf10-sub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,11 @@ jobs:
synth_xilinx -flatten -abc9 -nocarry -arch xc7 -top gf10_sub_ax7203;
setundef -zero -params; write_json build/gf10_sub/gf10_sub_ax7203.json" 2>&1 | tee /tmp/yosys.log
grep -E "Estimated|ERROR" /tmp/yosys.log
- uses: actions/cache@v4
id: chipdb
- id: chipdb
uses: ./.github/actions/openxc7-chipdb
with:
path: build/gf10_sub/chipdb/xc7a200tfbg484-2.bin
key: chipdb-xc7a200tfbg484-2-regymm-${{ github.run_id }}
restore-keys: chipdb-xc7a200tfbg484-2-regymm-
- if: steps.chipdb.outputs.cache-hit != 'true'
run: |
mkdir -p build/gf10_sub/chipdb
docker run --rm -v "$PWD:/work" -w /work regymm/openxc7 bash -c "cd /nextpnr-xilinx && python3 xilinx/python/bbaexport.py --device xc7a200tfbg484-2 --bba /work/build/gf10_sub/chipdb/xc7a200tfbg484-2.bba && bbasm -l /work/build/gf10_sub/chipdb/xc7a200tfbg484-2.bba /work/build/gf10_sub/chipdb/xc7a200tfbg484-2.bin"
part: xc7a200tfbg484-2
out: build/gf10_sub/chipdb/xc7a200tfbg484-2.bin
- name: nextpnr (seed search)
run: |
CLEAN=0; for s in 1 2 3 4 5 6 7 8; do
Expand Down
13 changes: 4 additions & 9 deletions .github/workflows/ax7203-gf12-clean.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,11 @@ jobs:
synth_xilinx -flatten -abc9 -nocarry -arch xc7 -top gf12_clean_ax7203;
setundef -zero -params; write_json build/gf12_clean/gf12_clean_ax7203.json" 2>&1 | tee /tmp/yosys.log
grep -E "Estimated|ERROR" /tmp/yosys.log
- uses: actions/cache@v4
id: chipdb
- id: chipdb
uses: ./.github/actions/openxc7-chipdb
with:
path: build/gf12_clean/chipdb/xc7a200tfbg484-2.bin
key: chipdb-xc7a200tfbg484-2-regymm-${{ github.run_id }}
restore-keys: chipdb-xc7a200tfbg484-2-regymm-
- if: steps.chipdb.outputs.cache-hit != 'true'
run: |
mkdir -p build/gf12_clean/chipdb
docker run --rm -v "$PWD:/work" -w /work regymm/openxc7 bash -c "cd /nextpnr-xilinx && python3 xilinx/python/bbaexport.py --device xc7a200tfbg484-2 --bba /work/build/gf12_clean/chipdb/xc7a200tfbg484-2.bba && bbasm -l /work/build/gf12_clean/chipdb/xc7a200tfbg484-2.bba /work/build/gf12_clean/chipdb/xc7a200tfbg484-2.bin"
part: xc7a200tfbg484-2
out: build/gf12_clean/chipdb/xc7a200tfbg484-2.bin
- name: nextpnr (seed search)
run: |
CLEAN=0; for s in $(seq 1 8); do
Expand Down
13 changes: 4 additions & 9 deletions .github/workflows/ax7203-gf12-mul-clean.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,11 @@ jobs:
synth_xilinx -flatten -abc9 -nocarry -nodsp -arch xc7 -top gf12_mul_ax7203;
setundef -zero -params; write_json build/gf12_mul/gf12_mul_ax7203.json" 2>&1 | tee /tmp/yosys.log
grep -E "Estimated|ERROR" /tmp/yosys.log
- uses: actions/cache@v4
id: chipdb
- id: chipdb
uses: ./.github/actions/openxc7-chipdb
with:
path: build/gf12_mul/chipdb/xc7a200tfbg484-2.bin
key: chipdb-xc7a200tfbg484-2-regymm-${{ github.run_id }}
restore-keys: chipdb-xc7a200tfbg484-2-regymm-
- if: steps.chipdb.outputs.cache-hit != 'true'
run: |
mkdir -p build/gf12_mul/chipdb
docker run --rm -v "$PWD:/work" -w /work regymm/openxc7 bash -c "cd /nextpnr-xilinx && python3 xilinx/python/bbaexport.py --device xc7a200tfbg484-2 --bba /work/build/gf12_mul/chipdb/xc7a200tfbg484-2.bba && bbasm -l /work/build/gf12_mul/chipdb/xc7a200tfbg484-2.bba /work/build/gf12_mul/chipdb/xc7a200tfbg484-2.bin"
part: xc7a200tfbg484-2
out: build/gf12_mul/chipdb/xc7a200tfbg484-2.bin
- name: nextpnr (seed search — placer heap + per-seed timeout, lessons from gf20)
run: |
CLEAN=0; for s in 1 2 3 4 5 6 7 8; do
Expand Down
13 changes: 4 additions & 9 deletions .github/workflows/ax7203-gf12-sub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,11 @@ jobs:
synth_xilinx -flatten -abc9 -nocarry -arch xc7 -top gf12_sub_ax7203;
setundef -zero -params; write_json build/gf12_sub/gf12_sub_ax7203.json" 2>&1 | tee /tmp/yosys.log
grep -E "Estimated|ERROR" /tmp/yosys.log
- uses: actions/cache@v4
id: chipdb
- id: chipdb
uses: ./.github/actions/openxc7-chipdb
with:
path: build/gf12_sub/chipdb/xc7a200tfbg484-2.bin
key: chipdb-xc7a200tfbg484-2-regymm-${{ github.run_id }}
restore-keys: chipdb-xc7a200tfbg484-2-regymm-
- if: steps.chipdb.outputs.cache-hit != 'true'
run: |
mkdir -p build/gf12_sub/chipdb
docker run --rm -v "$PWD:/work" -w /work regymm/openxc7 bash -c "cd /nextpnr-xilinx && python3 xilinx/python/bbaexport.py --device xc7a200tfbg484-2 --bba /work/build/gf12_sub/chipdb/xc7a200tfbg484-2.bba && bbasm -l /work/build/gf12_sub/chipdb/xc7a200tfbg484-2.bba /work/build/gf12_sub/chipdb/xc7a200tfbg484-2.bin"
part: xc7a200tfbg484-2
out: build/gf12_sub/chipdb/xc7a200tfbg484-2.bin
- name: nextpnr (seed search)
run: |
CLEAN=0; for s in 1 2 3 4 5 6 7 8; do
Expand Down
13 changes: 4 additions & 9 deletions .github/workflows/ax7203-gf14-add.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,11 @@ jobs:
synth_xilinx -flatten -abc9 -nocarry -arch xc7 -top gf14_add_ax7203;
setundef -zero -params; write_json build/gf14_add/gf14_add_ax7203.json" 2>&1 | tee /tmp/yosys.log
grep -E "Estimated|ERROR" /tmp/yosys.log
- uses: actions/cache@v4
id: chipdb
- id: chipdb
uses: ./.github/actions/openxc7-chipdb
with:
path: build/gf14_add/chipdb/xc7a200tfbg484-2.bin
key: chipdb-xc7a200tfbg484-2-regymm-${{ github.run_id }}
restore-keys: chipdb-xc7a200tfbg484-2-regymm-
- if: steps.chipdb.outputs.cache-hit != 'true'
run: |
mkdir -p build/gf14_add/chipdb
docker run --rm -v "$PWD:/work" -w /work regymm/openxc7 bash -c "cd /nextpnr-xilinx && python3 xilinx/python/bbaexport.py --device xc7a200tfbg484-2 --bba /work/build/gf14_add/chipdb/xc7a200tfbg484-2.bba && bbasm -l /work/build/gf14_add/chipdb/xc7a200tfbg484-2.bba /work/build/gf14_add/chipdb/xc7a200tfbg484-2.bin"
part: xc7a200tfbg484-2
out: build/gf14_add/chipdb/xc7a200tfbg484-2.bin
- name: nextpnr (seed search)
run: |
CLEAN=0; for s in 1 2 3 4 5 6 7 8; do
Expand Down
13 changes: 4 additions & 9 deletions .github/workflows/ax7203-gf14-mul.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,11 @@ jobs:
synth_xilinx -flatten -abc9 -nocarry -nodsp -arch xc7 -top gf14_mul_ax7203;
setundef -zero -params; write_json build/gf14_mul/gf14_mul_ax7203.json" 2>&1 | tee /tmp/yosys.log
grep -E "Estimated|ERROR" /tmp/yosys.log
- uses: actions/cache@v4
id: chipdb
- id: chipdb
uses: ./.github/actions/openxc7-chipdb
with:
path: build/gf14_mul/chipdb/xc7a200tfbg484-2.bin
key: chipdb-xc7a200tfbg484-2-regymm-${{ github.run_id }}
restore-keys: chipdb-xc7a200tfbg484-2-regymm-
- if: steps.chipdb.outputs.cache-hit != 'true'
run: |
mkdir -p build/gf14_mul/chipdb
docker run --rm -v "$PWD:/work" -w /work regymm/openxc7 bash -c "cd /nextpnr-xilinx && python3 xilinx/python/bbaexport.py --device xc7a200tfbg484-2 --bba /work/build/gf14_mul/chipdb/xc7a200tfbg484-2.bba && bbasm -l /work/build/gf14_mul/chipdb/xc7a200tfbg484-2.bba /work/build/gf14_mul/chipdb/xc7a200tfbg484-2.bin"
part: xc7a200tfbg484-2
out: build/gf14_mul/chipdb/xc7a200tfbg484-2.bin
- name: nextpnr (seed search, heap+sa — wider for the mul core)
run: |
CLEAN=0
Expand Down
Loading
Loading