Files
prjxray/utils/update_resources.py
T
Dr Jonathan Richard Robert KimmittandClaude Opus 4.7 39f5de415d Add Virtex-7 (xc7vx485t) family support
Port prjxray to the Virtex-7 family, modelled on Kintex-7, targeting
xc7vx485tffg1761-2 (vc707). Non-breaking for the existing families.

Family registration:
- settings/virtex7.sh, settings/virtex7/devices.yaml
- Makefile: virtex7 in DATABASES/XRAY_PARTS + db-extras-virtex7 targets
- utils/update_parts.py, update_resources.py: virtex7 choice
- CI matrix (Pipeline.yml), Vivado edition (xilinx.sh), README

Architecture adaptations for the HP-bank-only VX part (verified non-breaking):
- update_resources.tcl: fall back to HP banks when no HR banks exist
- XRAY_IOSTANDARD env (default LVCMOS33; LVCMOS18 for virtex7), parameterised
  across the fuzzer generate.tcl files
- fuzzers: enable HP-bank (iob18/ioi18) + IOI/HCLK handling for virtex7;
  GTX skipped (ffg1761 bonds only ~7 of 14 GTX quads)
- 005-tilegrid: HP/HR bank tile handling; iob18_int INT offset 3->2;
  ioi18 AUTO_FRAME; cfg PDRC-2 DRC disable; add_tdb skips unsolved edge tiles;
  per-specimen retry for transient FlexLM SIGSEGV under concurrency
- per-family Vivado version gate (virtex7 -> v2020.1.1)
- XRAY_ROI and XRAY_ROI_GRID tuned to a compact CLBLL+CLBLM region

General fixes:
- tools/bitread.cc: fix use-after-free of the mmap'd bitstream (exposed by the
  larger Virtex-7 bitstream)
- utils/environment.python.sh: add repo root to PYTHONPATH (PEP 660 editable
  install doesn't expose the repo-root utils/ package)

Co-Authored-By: Claude Opus 4.7 <[email protected]>
2026-05-24 07:21:23 +01:00

89 lines
2.6 KiB
Python
Executable File

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017-2021 The Project X-Ray Authors.
#
# Use of this source code is governed by a ISC-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/ISC
#
# SPDX-License-Identifier: ISC
import argparse
import yaml
import subprocess
import os
import re
import tempfile
import json
from prjxray.util import OpenSafeFile, db_root_arg, get_parts, set_part_resources
def main():
"""Tool to update the used resources by the fuzzers for each available part.
Example:
prjxray$ ./utils/update_resources.py artix7 --db-root database/artix7/
"""
parser = argparse.ArgumentParser(
description="Saves all resource information for a family.")
parser.add_argument(
'family',
help="Name of the device family.",
choices=['artix7', 'kintex7', 'virtex7', 'zynq7', 'spartan7'])
db_root_arg(parser)
args = parser.parse_args()
env = os.environ.copy()
cwd = os.path.dirname(os.path.abspath(__file__))
resource_path = os.path.join(
os.getenv('XRAY_DIR'), 'settings', args.family)
information = {}
parts = get_parts(args.db_root)
processed_parts = dict()
for part in parts.keys():
# Skip parts which differ only in the speedgrade, as they have the same pins
fields = part.split("-")
common_part = fields[0]
if common_part in processed_parts:
information[part] = processed_parts[common_part]
continue
print("Find pins for {}".format(part))
env['XRAY_PART'] = part
_, tmp_file = tempfile.mkstemp()
# Asks with get_package_pins and different filters for pins with
# specific properties.
command = "env TMP_FILE={} {} -mode batch -source update_resources.tcl".format(
tmp_file, env['XRAY_VIVADO'])
result = subprocess.run(
command.split(' '),
check=True,
env=env,
cwd=cwd,
stdout=subprocess.PIPE)
with OpenSafeFile(tmp_file, "r") as fp:
pins_json = json.load(fp)
os.remove(tmp_file)
clk_pins = pins_json["clk_pins"].split()
data_pins = pins_json["data_pins"].split()
pins = {
0: clk_pins[0],
1: data_pins[0],
2: data_pins[int(len(data_pins) / 2)],
3: data_pins[-1]
}
information[part] = {'pins': pins}
processed_parts[common_part] = {'pins': pins}
# Overwrites the <family>/resources.yaml file completly with new data
set_part_resources(resource_path, information)
if __name__ == '__main__':
main()