amos 9d633e9e67 Batch 15 (20261023-C-hwe-scale-15): 320 HWE-derived repair tasks
One user-space repair task per eligible HWE debug-diag / compile-deploy base
ID: 320 admitted (C 218, C++ 97, build scripts 5), 1 skipped by the content
filter. Each ships a public spec with a check-to-basis table, at least two
defects with single-fix fixtures, a symptom-masking fixture and an alternative
correct implementation. Claude re-checked all 320: structure, the HWE quality
items and trace6 Docker calibration receipts against current digests
(320/320 USABLE). Difficulty is unmeasured. Known follow-up: 212 tasks use 120
ad-hoc family names; the next batch maps them to the canonical list.
The batch's 1,256-line progress log stays in its factory report and the
36-local branch batch15-hwe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 01:55:56 +08:00

86 lines
2.1 KiB
C

#ifndef WIDTH_H
#define WIDTH_H
#include <stddef.h>
#include <stdint.h>
#include "port.h"
#define PW_LANES 8
#define PW_AUDIT_CAPACITY 16
#define PW_AUDIT_SEED UINT32_C(2166136261)
#define PW_AUDIT_PRIME UINT32_C(16777619)
#define PW_LANE_SALT UINT32_C(0x9e3779b9)
typedef enum {
PW_BIT = 1,
PW_RANGE = 2,
PW_WRITE = 3,
PW_BEGIN = 4,
PW_COMMIT = 5,
PW_ABORT = 6,
PW_COPY = 7,
PW_SWAP = 8,
PW_RESTORE = 9
} PWOperation;
typedef enum {
PW_OK = 0,
PW_INVALID = 1,
PW_STATE = 2
} PWResult;
typedef struct {
int32_t op;
int32_t lane;
int32_t a;
int32_t b;
int32_t c;
} PWRequest;
typedef struct {
uint32_t live;
uint32_t pending;
uint32_t active;
uint32_t dirty;
uint32_t generation;
uint32_t accepted;
uint32_t rejected;
} PWLane;
typedef struct {
uint32_t sequence;
PWRequest request;
int32_t result;
uint32_t before;
uint32_t after;
} PWEvent;
typedef struct {
PWEvent entries[PW_AUDIT_CAPACITY];
size_t head;
size_t count;
uint32_t digest;
} PWAudit;
typedef struct {
PWLane lanes[PW_LANES];
uint32_t initial[PW_LANES];
uint32_t sequence;
uint32_t ok;
uint32_t bad;
PWAudit audit;
PWPort port;
} PWContext;
typedef struct {
PWLane lanes[PW_LANES];
uint32_t sequence;
uint32_t ok;
uint32_t bad;
uint32_t audit;
uint32_t invalid_requests;
} PWSnapshot;
void pw_init(PWContext *context, int32_t seed);
int pw_apply(PWContext *context, const PWRequest *request);
uint32_t pw_effective(const PWContext *context, int lane);
void pw_snapshot(const PWContext *context, PWSnapshot *snapshot);
void pw_audit_init(PWAudit *audit);
void pw_audit_push(PWAudit *audit, const PWEvent *event);
size_t pw_audit_count(const PWAudit *audit);
uint32_t pw_audit_digest(const PWAudit *audit);
int pw_audit_at(const PWAudit *audit, size_t index, PWEvent *event);
int pw_decimal(const char *data, size_t length, int32_t *value);
int pw_parse_request(const char *data, size_t length, PWRequest *request);
int pw_parse_seed(const char *data, size_t length, int32_t *seed);
#endif