Library / Device Span / Device Span examples

Device Span examples

One worker against State Register, four workers on the braid, and a rejected worker count.

Example 1 — one worker is the register

Lattice script
span = Lattice.span(width=3, workers=1, ceiling="64 MiB")
span.run(AETHER_BRAID)
alone = Lattice.open(width=3, endian="little", ceiling="64 MiB")
alone.run(AETHER_BRAID)
assert span.amplitudes() == alone.amplitudes()

Example 2 — four workers, agreement on expectations

Lattice script
span = Lattice.span(width=16, workers=4, ceiling="8 GiB")
span.run(ROTATION_SUITE_16)
record = span.expect(["Z0", "Z3*Z4"])
assert record.workers == 4
Ledger.agree(record, ROTATION_SUITE_16_EXACT, tol=1e-12)

The volume report for a gate on bit 14 or 15 (the cut for four workers of a width-16 table) is nonzero. A gate on bit 0 reports zero exchange.

Example 3 — three workers

Lattice script
Lattice.span(width=10, workers=3, ceiling="64 MiB")
# Membership fault at open: 3 is not a power of two