# A Forge program on fpga/arty-a7

One kernel, compiled for the Digilent Arty A7-100T (xc7a100tcsg324-1): a pipelined Verilog design
(the member a bench synthesizes and programs) and its VHDL twin (a second rendering of the same
fixed-point semantics, co-simulated against it). `program.json` names the kernel, the platform
specification, the toolchain requirements, the Python lock (`python.lock`) and the three identities, and carries
the evidence vector. What a machine HAS -- each tool's version and installation fingerprint, under the label
`FORGE_MACHINE_LABEL` gives it -- is recorded in each run's evidence, never in the program's identity.

| command          | dimension    | what a PASS establishes                                   |
|------------------|--------------|-----------------------------------------------------------|
| `make`           | build        | see `program.json` -> `establishes`                       |
| `make run`       | execution    | (simulation: Verilator for Verilog, GHDL for VHDL)        |
| `make check`     | differential | (each member against the exact-real oracle; member pairs) |
| `make synth`     | synthesis    | (yosys mapping only: not fit, route or timing)           |
| `make timing`    | timing       | (Vivado 2025.2, routed, on the bench only)                |
| `make reproduce` | --           | (rebuild from the recorded inputs; compare identities)   |

The sentence each command's PASS establishes is in `program.json`, copied from the platform
specification; nothing here restates it.

What this directory is NOT:

- **Not deployable by virtue of passing.** Building and passing `make check` says nothing about timing
  closure, a bitstream, a programmed part or physical I/O. Those are the `timing` and `hardware`
  dimensions, written only from a recorded run of a real tool on the bench.
- **Not a claim about port hold.** Setup is timed at every port against `clk` with zero external delay; hold at the
  INPUT ports is out of this out-of-context scope (`set_false_path -hold` from them; the owner's ruling of
  2026-10-24). It depends on the enclosing design's clocking and is part of the hardware dimension's in-context
  timing closure.
- **Not a change to the kernel's status.** The kernel's status in Forge's verification index is shown
  beside this program's evidence and never merged with it.
- **Not a proof.** The differential is evidence about the inputs it ran (recorded in
  `check/inputs.json`), never about all inputs.

## The bench

**Timing** (`make timing`, on a machine with Vivado 2025.2; this directory and a Forge checkout at the commit
that generated it on `PYTHONPATH`; any Python 3.11+ -- timing computes nothing in Python):

    FORGE_MACHINE_LABEL=arty-bench make timing

On Windows, where `make` is usually absent and `python3` is the Store stub, run the same command from this directory
in PowerShell: `$env:PYTHONPATH="<forge checkout>"; $env:FORGE_MACHINE_LABEL="arty-bench"; python -m tools.platforms
timing .` -- Vivado's `bin\vivado.bat` is found on PATH and recorded as `vivado`.

It runs `bench/timing.tcl`: out-of-context synthesis, place and ROUTE on xc7a100tcsg324-1 at the binding's
clock, with every input and output constrained against `clk` (zero external delay: a register-boundary
budget for setup; input-port hold is out of this scope, as above), then `check_timing`, `report_route_status` and
`report_timing_summary`. PASS needs all of: routed,
the part confirmed by Vivado's own reports, `clk` at the period, zero unconstrained endpoints, ports and
clocks, and every constraint met (WNS, WHS, WPWS >= 0). The record keeps the constraint file's, the routed
checkpoint's and every report's sha256 and the parsed numbers -- never the reports' Host line. **Bring back the record
and its run line only** (the owner's ruling of 2026-10-24): the raw reports under `runs/timing/` name the machine, its
user and local paths, so they stay with the bench owner as the originals, and anyone holding them can check them
against the record's digests. From this directory:
`python -m tools.platforms.archive pack . pid_controller-fpga-arty-a7.bench.tar --prefix pid_controller/fpga/arty-a7
--only evidence/records/timing-<id>.json evidence/runs.jsonl`.

**Hardware** (`make hardware`): the board on USB, Vivado 2025.2, `pyserial` 3.5 on the bench's Python
(`python -m pip install pyserial==3.5`), and the program's current passing execution record with its trace (made by
`make check` anywhere; the archive carries `evidence/` and `runs/`). Name the board's USB-UART and its revision:

    FORGE_MACHINE_LABEL=arty-bench FORGE_UART_PORT=/dev/ttyUSB1 FORGE_BOARD_REVISION=E make hardware

In PowerShell: `$env:PYTHONPATH="<forge checkout>"; $env:FORGE_MACHINE_LABEL="arty-bench";
$env:FORGE_UART_PORT="COM4"; $env:FORGE_BOARD_REVISION="E"; python -m tools.platforms hardware .` (the board's
USB-UART is the higher-numbered of its two COM ports; its revision is printed on the board).

It writes `runs/hardware/hw_top.v` -- the BENCH WRAPPER: the Verilog member behind the board's USB-UART, one
input vector at a time, 115200 8N1, each word its two's-complement pattern least significant byte first -- and runs
`bench/hardware.tcl`: the RTL closure, the design and the wrapper IN CONTEXT on the board's pins (the 100 MHz
oscillator on E3, the UART on A9/D10), placed, routed and reported; `write_bitstream`; `program_hw_devices` over JTAG.
Then it sends every input of `check/inputs.json`, in order, and captures every answer. Four entries, each with its own
verdict, never one label: **bitstream** (written), **programming** (program_hw_devices returned on the xc7a100t from
this run's bitstream, DONE read back high), **physical_io** (every word the part returned equals, bit for bit and in
order, the word the program's Verilog member computed in simulation on that input -- the recorded trace, its digest
checked) and **timing_closure** (the programmed design's own routed timing: the board clock covered, the UART ports
constrained and cut -- they are asynchronous and enter through a synchronizer -- nothing unconstrained, every slack
non-negative). The dimension is PASS only when all four are. The capture under `runs/hardware/` -- bitstream, reports,
the words sent and received as they crossed the wire, `configuration.json` (board, revision, clock, I/O path, the
wrapper's sha256) -- is digested into the record; bring back the record and its run line only, as for timing.
THE FIRST SESSION IS A REHEARSAL: the readers were written against Vivado's documented formats, and a real capture is
what validates them.

This file, the `Makefile` and `bench/` are SCAFFOLD: conventional glue, tested and never proved, and
never counted toward any verified figure.
