MADMAX-AI-Gateware is the integration and automation layer for MADMAX Kasli-SoC gateware work. It does not copy gateware code from the underlying projects. Instead, it references them as Git submodules and provides deterministic tooling around a high-level experiment YAML file.
The core design rule is simple: an AI assistant should change the experiment config first, then Python tooling validates the request and generates the matching runtime files. Generated files are build artifacts, not the source of truth.
This workspace orchestrates:
repos/madmax-artiq-env: Python/ARTIQ environment reference.repos/madmax-artiq-zynq: Kasli-SoC and ARTIQ Zynq gateware build flow.repos/madmax-entangler-core: custom Migen/Entangler logic.
Install uv, then create the local environment:
uv syncInitialize submodules:
./scripts/init_submodules.sh
# or
uv run madmax submodules initCheck the workspace:
uv run madmax setupThe example config lives at configs/experiments/2in_2out.yaml.
uv run madmax validate --config configs/experiments/2in_2out.yamlValidation checks the schema, submodule-relative paths, entangler input/output counts, duplicate pads, and DIO pad names.
Generate the settings file:
uv run madmax generate-settings --config configs/experiments/2in_2out.yamlGenerate the ARTIQ device_db.py:
uv run madmax generate-device-db --config configs/experiments/2in_2out.yamlGenerate a smoke-test experiment:
uv run madmax generate-experiment --config configs/experiments/2in_2out.yamlBy default, generated files are written under build/generated/.
The initial implementation only performs dry-run build planning:
uv run madmax build-gateware --config configs/experiments/2in_2out.yaml --dry-runThe command is controlled by build.command_template in the YAML config. The
default command calls scripts/build_from_json.sh, which builds the bitstream,
regenerates the matching CSR metadata, builds firmware from that metadata, and
packages the final SD-card boot.bin. The raw top.bit alone is not a complete
deployable artifact.
scripts/setup.sh: create/update theuvenvironment and print workspace status.scripts/init_submodules.sh: rungit submodule update --init --recursive.scripts/generate_runtime.sh: validate and generate settings,device_db.py, and a smoke experiment.scripts/build_gateware.sh: dry-run the gateware build command.scripts/smoke_test.sh: run tests and a full generation dry run.
The intended flow is:
- A user describes the desired experiment.
- The AI updates one high-level YAML config.
- Deterministic validators reject inconsistent hardware, gateware, or runtime requests.
- Generators write
settings.toml,device_db.py, build descriptors, and smoke tests. - The build wrapper invokes
madmax-artiq-zynq. - Tests run before any hardware flashing is suggested.
This keeps gateware, runtime configuration, and ARTIQ test experiments in sync without asking the AI to manually edit scattered files across multiple repositories.