interplane.Get Omega
Read in your language

aien-architecture-mv

Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories.

Brought by drakestapleton

branch main Branches Tags History

aien-architecture-mv / docs / plans / mixed-algebra / research / PHASE_EXPERIMENT_AND_HARDWARE.md

176 lines · 14149 bytes Raw Blame History Source

Phase-Domain Z3: First Experiment and Buy List

FieldValue
Source modelGrok 4.7, raw draft grok-phase-hw.md
Date2026-09-29
Verification statusMath VERIFIED (re-derived and checked by a C Monte Carlo). Hardware table PARTIALLY VERIFIED (8 products checked on the web, 3 not checked).
What was checkedZ3 add as phasor multiplication; the plus/minus 60 degree decision cells; the exact 3-PSK symbol error formula and its erfc approximation at 0 to 12 dB; the correlator SNR relation; jitter, cable and quantization numbers; prices and key specs of RFSoC 4x2, STEMlab 125-14, ADALM-PLUTO, USRP B210, ADALM2000, ULX3S (12F and 85F), Pmod DA4.
What was corrected(1) The raw draft had a summary paragraph spliced into the middle of Section 1, cutting off part of the signal-level text; repaired below. (2) Grok's error table is for one noisy phasor, but an add multiplies two noisy phasors; the add is about 2 dB worse (added below, with Monte Carlo numbers). (3) ADALM-PLUTO price was wrong ($399.99; real list is about $215 to $280). (4) STEMlab 125-14 price was the PRO tier; the base starter kit is cheaper. (5) Pmod DA4 has 8 DAC channels, not 2.
Monte Carlo program~/.claude/jobs/c8884ded/tmp/verify/z3mc.c (C, xoshiro-style RNG, Box-Muller noise). Not in the repo.

Prices are USD list or reseller snapshots as of 2026-09-29. Anything still uncertain is marked verify.

Pass condition: for all 9 input pairs, decoded trit equals (a+b) mod 3, 1000 trials each, zero mismatches. Speed, energy and latency come after that gate.

1. Experiment

The map

Z3 = {0, 1, 2} under addition mod 3. Encode k as the cube root of unity

w^k = exp(j 2 pi k / 3)     phases {0, 120, 240 degrees}
w^a * w^b = exp(j 2 pi (a+b) / 3) = w^((a+b) mod 3)

because w^3 = 1. Multiplying phasors adds phases, and phase addition mod 360 degrees is Z3 addition. VERIFIED (algebra, and the C program checks all 9 pairs with a 32-bit phase word: 0 mismatches).

In digital form, a 32-bit phase word does the same thing with a wrapping integer add: one third of a turn is 2^32 / 3 = 1431655765 (the remainder of 1/3 LSB is harmless because decisions are 60 degrees wide), and one LSB is 360 / 2^32 = 8.4e-8 degrees. That adder is exactly a numerically controlled oscillator (NCO) phase accumulator. In analog form, a mixer does it: the product of two tones has a component at 2 f_c whose phase is phi_a + phi_b.

Signal plan (repaired from the spliced paragraph)

Decision rule and error rate

Each symbol owns a cell of plus/minus 60 degrees around its phase. Decode k_hat = mod(round(theta / (2 pi / 3)), 3). An error is |delta theta| > 60 degrees.

One complex sample, amplitude A, noise variance sigma^2 per axis, N_0 = 2 sigma^2, symbol SNR rho = A^2 / N_0. For small noise, phase noise is

sigma_phi^2 = sigma^2 / A^2 = 1 / (2 rho)      sigma_phi = 1 / sqrt(2 rho) radians

Exact coherent 3-PSK symbol error (Craig's form, with sin^2(pi/3) = 3/4):

P_err = (1/pi) * integral from 0 to 2pi/3 of exp(-rho * (3/4) / sin^2(theta)) d theta
P_err ~ erfc( sqrt(rho) * sqrt(3) / 2 )      (two-neighbor bound; a bit high at low SNR)

Both formulas VERIFIED (standard M-PSK result with M = 3; the approximation equals 2 Q(sqrt(2 rho) sin(pi/3))). Monte Carlo check, one noisy phasor, decoded against its own symbol:

rho (dB)sigma_phiMonte Carloexact (Craig)erfc approxGrok's table (exact)
040.5 deg1.835e-11.834e-12.207e-11.83e-1
620.3 deg1.363e-21.371e-21.454e-21.37e-2
816.1 deg2.029e-32.037e-32.095e-32.04e-3
1012.8 deg1.055e-4 (5e7 trials)1.065e-41.075e-41.07e-4
1210.2 deg1.17e-6 (4e8 trials, about 470 errors)1.082e-61.084e-61.08e-6

Grok's rows at 14 and 16 dB (8.34e-10, 1.10e-14) were not simulated (too rare to count); they follow the same formula. Grok's thresholds (1e-3 at 8.57 dB, 1e-6 at 12.03 dB, 1e-9 at 13.96 dB, 1e-12 at 15.30 dB) are consistent with the verified formula.

[added] Correction: the add uses two noisy phasors. The table above is for reading one phasor. A Z3 add multiplies two phasors, and each carries its own noise, so phase noise variance doubles at high SNR. Monte Carlo of the actual add, both inputs at the same rho, decoded against (a+b) mod 3:

rho per input (dB)Monte Carlo, addsingle-phasor exact
03.52e-11.83e-1
65.76e-21.37e-2
81.52e-22.04e-3
101.96e-31.07e-4
128.46e-51.08e-6

Rule of thumb: the add needs roughly 2 to 3 dB more SNR per input than one symbol read. This does not change any conclusion below, because the operating point is 80 to 100 dB past these contours.

Correlator gain

With N real samples and per-sample SNR_1 = (A^2/2) / sigma^2, correlating against the known tone gives radius A N / 2 and noise variance N sigma^2 / 2 per axis, so sigma_phi^2 = 1 / (N SNR_1). Matching 1 / (2 rho):

rho = N * SNR_1 / 2

VERIFIED. Ideal 14-bit, -6 dBFS, N = 4096: rho = 4096 x 1.0e8 / 2 = 2.06e11 (113.1 dB), sigma_phi = 8.9e-5 degrees. That is about 98 dB beyond the point where a single read errs once in 10^12, and about 95 dB beyond it for the two-phasor add. Random noise errors in 9000 trials are not observable. Any mismatch means a wrap bug, a slipped sample index, a bad cable, or a fixed phase bias close to 60 degrees. A fixed bias beta shrinks the cell edge to 60 - |beta| degrees.

Phase jitter

Timing jitter converts to phase as sigma_phi = 2 pi f_c sigma_t. At 1.953125 MHz, 1 degree rms corresponds to sigma_t = 1 / (360 f_c) = 1.422 ns; a 1 ps aperture jitter is 0.0007 degrees. VERIFIED.

[added] Error rate of the add under pure Gaussian phase jitter sigma_j on each input (independent): P_err = 2 Q(60 / (sqrt(2) sigma_j)), degrees. Monte Carlo check (2e7 trials each):

sigma_j per inputMonte Carloformula
10 deg2.22e-52.21e-5
15 deg4.69e-34.68e-3
20 deg3.39e-23.39e-2
25 deg8.97e-28.97e-2

For a chain of L adds with independent errors, phase error grows as sigma_1 sqrt(L).

Timing and calibration

Share one sample index for both channels so designed digital slip is zero. Residual analog delay tau appears as phase 360 f_c tau. Staying under 5 degrees needs tau < 7.11 ns. One metre of cable at velocity factor 0.70 is 4.77 ns, which is 3.35 degrees at this carrier (VERIFIED). Absorb it in a per-channel offset delta_i. Cable tempco of 100 ppm/degC gives about 3.4e-4 degrees per degC per metre here (planning figure; measure filter drift on the board).

One oscillator and one PLL feed both NCOs and the ADC clock. Clear both NCOs on the same cycle.

Before each 9 x 1000 block:

  1. Emit k = 0 on each channel, store delta_i = theta_i.
  2. Emit k = 1. Require theta - delta_i within 120 +/- 5 degrees, else stop (scale, wiring, stuck NCO).
  3. Rotate later phasors by exp(-j delta_i) before multiplying.
  4. If board temperature moves more than 2 degC during the block, discard and repeat. Log delta_i and temperature.

Correlator at the known frequency bin, N = 4096:

I = sum x[n] cos(2 pi n / 64)
Q = sum x[n] (-sin(2 pi n / 64))

Multiply (Ia + j Qa)(Ib + j Qb), one atan2. Flags fail the trial (no majority voting):

Pass: 9 x 1000, zero mismatches. Print the wrap pairs (1,2) -> 0, (2,1) -> 0, (2,2) -> 1 on their own lines.

After the gate

2. Purchasable hardware

Toolchain notes (Grok's claims, not independently checked): AMD Vivado/Vitis hosts are x86-64 only, so the ARM64 Spark cannot build bitstreams for AMD/Xilinx parts; yosys, nextpnr and openFPGALoader can target Lattice ECP5. libiio is LGPL-2.1, UHD is GPL-3.0, ECP5 open tools are ISC/MIT. verify before relying on them.

ProductWhat you getRate, bits, bandwidthHost, toolchainCost, availabilityCheck status
RFSoC 4x2 (ZU48DR)4 ADC + 2 DAC, direct RFADC 5 GSPS 14-bit, 6 GHz input BW; DAC 9.85 GSPS 14-bitEthernet, USB3, JTAG. PYNQ (Python) is the shipped path; Vivado for fabricAcademic $2,499 (Real Digital). Commercial: quote. End Use Form required; academic buyers need AMD University Program approval. Older announcements said $2,149VERIFIED
ZCU111 (ZU28DR)8 ADC + 8 DACADC 4.096 GSPS 12-bit; DAC 6.554 GSPS 14-bitVivado$14,995 list, export formverify (not checked)
ZCU216 (ZU49DR)16 ADC + 16 DACADC 2.5 GSPS 14-bit; DAC up to 10 GSPS 14-bitVivado$16,995 listverify (not checked)
STEMlab 125-142 in + 2 out, baseband loopback125 MS/s, 14-bit both ways. Gen 2 BW DC-60 MHz (verify)Ethernet + USB. Stock SCPI / C API; Vivado only to rebuild fabric. Board runs Linux[fixed] Base starter kit $490 (redpitaya.com listing via search; product page blocked the fetch, verify). UK reseller: Gen 1 starter kit GBP 375, in stock. PRO Gen 2 starter kit $766; PRO Z7020 Gen 2 $1,061. Grok's "$720" is near the PRO tier, not the base kitWRONG DETAILS, fixed
ADALM-PLUTO1 TX + 1 RX, AD9363, Zynq Z-701061.44 MS/s, 12-bit; RF 325 MHz to 3.8 GHz; 20 MHz instantaneous BWUSB 2.0, libiio (C). Linux on device[fixed] About $215 to $280: ADI direct $233.25, Mouser $229.85, DigiKey $253.32, Newark $278.28, Arrow $215.63. Grok's "$399.99" is wrongWRONG DETAILS, fixed
USRP B2102x2 coherent, AD9361, 70 MHz to 6 GHz61.44 MS/s, 12-bit; 56 MHz BW (1x1)USB 3.0, UHD (C++, GPL-3). No Linux on deviceEttus board-only $2,387. DigiKey $2,501.90; with enclosure about $2,578 to $2,729VERIFIED (price); BW figures not rechecked
ADALM20002-ch AWG + 2-ch scopeADC 100 MS/s 12-bit; DAC 150 MS/s 12-bitUSB 2.0, libm2k (C++). Linux firmware on deviceAbout $262 to $303: Richardson $262.47, DigiKey $274.94, Newark $302.69VERIFIED (price and converter rates)
ULX3S ECP5Open-source ECP5 board with onboard ADCOnboard MAX11125: 8 channels, 12-bit, 1 MS/s (shared by multiplexer, so per-channel rate is lower, verify)USB-JTAG + UART. yosys + nextpnr-ecp5, no vendor seat. aarch64 build of the tools: verify85F: $275, in stock (Crowd Supply, 2026-09-29), shipping $8 US. 12F: $155, pre-order, ships Dec 15 2026VERIFIED
Pmod DA4SPI DAC module, AD5628[fixed] 8 channels, 12-bit (Grok said 2 channels). Internal 1.25 V reference, gain 2SPI from the FPGA$24.99 (TestEquity) to $27.00 (Digilent)WRONG DETAILS, fixed (channel count only; price verified)
Mythic M1076Analog matrix-vector engine for NN weights. No phase adderNot a sampled phase pathClosed SDKNo public price. Not a cart itemverify (not checked)

3. What to buy (Grok's recommendation, prices corrected)

First step costs nothing: run the 32-bit phase-word twin in C on the Spark. It is the reference decoder every rig must match. (The group-law part of it already passes in the verification program above.)

Hold any purchase while:

When the twin is green, the bench is empty, and the claim is "real converters preserve the sum", Grok recommends:

Total about $320 to $325 with shipping. Open toolchain (yosys, nextpnr), host program in C, no Linux on the board. Same 9 x 1000 gate at f_c = f_s / 64, N = 1024. At 12-bit and -6 dBFS, SNR_1 is about 68 dB, so rho = 1024 x SNR_1 / 2 is about 3.2e9 (95 dB), still about 80 dB beyond the 1e-12 contour (about 77 dB for the two-phasor add). VERIFIED arithmetic.

Alternatives: