// STRIX FPGA register map (FPGA version 7). Mirrors the definitions in fpga/rtl/strix_core.v, // which also documents the SPI protocol and snapshot layouts. #pragma once #include namespace strix { const uint8_t FPGA_VERSION = 7; const uint8_t READ = 0x80; // command bit 7: read enum Register : uint8_t { REG_ID0 = 0x00, // "STRX" in 0x00-0x03 REG_VERSION = 0x04, REG_FREQ_GATE = 0x05, REG_GENERATORS = 0x06, REG_RINGS = 0x07, REG_SOURCE_A = 0x08, REG_DECIM_HIGH = 0x09, REG_DECIM_LOW = 0x0A, REG_CONTROL = 0x0B, REG_STATUS = 0x0C, REG_SOURCE_B = 0x0D, REG_MODE = 0x0E, REG_DATA = 0x10, REG_RING_SELECT = 0x11, REG_FREQ_COUNT3 = 0x12, REG_GEN_ENABLE = 0x16, REG_TEMPORAL = 0x17, REG_FREQ_GEN = 0x18, REG_HEALTHY = 0x20, REG_HEALTH_CTRL = 0x21, REG_RCT_CUTOFF = 0x22, REG_APT_HIGH = 0x23, REG_APT_LOW = 0x24, REG_MAX_DEAD = 0x25, REG_TRIAL_HIGH = 0x26, REG_TRIAL_LOW = 0x27, REG_STATS_CTRL = 0x28, REG_STREAM_CTRL = 0x29, REG_LEVEL_HIGH = 0x2A, REG_LEVEL_LOW = 0x2B, REG_DROP_HIGH = 0x2C, REG_DROP_LOW = 0x2D, REG_GEN_HEALTH = 0x30, // + 4g: flags, RCT events, APT events, dead rings REG_STATS = 0x40, REG_AMP = 0x42, REG_STREAM = 0x44, REG_AMP_CTRL = 0x50, REG_AMP_SOURCES = 0x51, REG_AMP_SUB_MS = 0x52, REG_AMP_SUBS = 0x53, REG_AMP_STAGE = 0x54, // + 3s: mode, parameter high, parameter low }; // Control bits const uint8_t CONTROL_START_CAPTURE = 0x01; const uint8_t STATUS_CAPTURE_DONE = 0x02; const uint8_t STATS_VON_NEUMANN = 0x01, STATS_RESTART = 0x02; const uint8_t STREAM_VON_NEUMANN = 0x08, STREAM_FLUSH = 0x80, STREAM_COMBINED = 4; const uint8_t AMP_VON_NEUMANN = 0x01, AMP_RESTART = 0x02; const uint8_t HEALTH_CLEAR = 0x01; // Per-generator health flags (REG_GEN_HEALTH + 4g) const uint8_t FLAG_RCT_FAILED = 0x01, FLAG_APT_FAILED = 0x02, FLAG_TOO_MANY_DEAD = 0x04, FLAG_ACTIVE = 0x08, FLAG_SWEPT = 0x10, FLAG_HEALTHY = 0x20; const uint8_t GENERATORS = 4; const uint8_t STATS_CHANNELS = GENERATORS + 1; // generators, then the combined channel const uint8_t STATS_SNAPSHOT_BYTES = 72; const uint8_t AMP_SNAPSHOT_BYTES = 44; const size_t CAPTURE_BYTES = 32768; } // namespace strix