amos 2f32624d3b Batch 18 (20261026-C-hwe-codegen-18): add 100 calibrated HWE code-gen tasks; pause production for rollout
100 tasks from the HWE arm-linux code-gen pool (outside the lk/man/pth
range given to batch 22), each with at least one independent
contract-edge defect and plain public docs. Claude reviewed 100/100
USABLE against current digests; no ID or source overlap with main or
batch 22. Difficulty is unmeasured.

progress.md records the wrap-up: all Codex sessions and Qwen schedulers
stopped for the user's rollout, Qwen results so far (57 HARD of 373),
and what is left on each batch branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 17:52:13 +08:00

108 lines
4.4 KiB
C

#include "timer_ledger.h"
#include <inttypes.h>
#include <stdio.h>
#include <string.h>
static int read_fire(tl_fire *fire)
{
return scanf("%" SCNu32 " %" SCNu64 " %" SCNu64,
&fire->timer_id, &fire->generation, &fire->ticket) == 3;
}
static void print_view(int rc, const tl_timer_view *v)
{
printf("VIEW %d %" PRIu32 " %" PRIu32
" %" PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64
" %" PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64
" %" PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64
" %" PRIu64 "\n", rc, v->phase, v->cancel_state,
v->generation, v->deadline, v->period, v->tag, v->ticket,
v->cancel_generation, v->cancel_serial, v->arms, v->begins,
v->ends, v->rearms, v->cancelled_armed, v->cancelled_ready);
}
int main(void)
{
tl_bank *bank = NULL;
char op[16];
while (scanf("%15s", op) == 1) {
if (strcmp(op, "INIT") == 0) {
uint32_t slots;
if (scanf("%" SCNu32, &slots) != 1) return 2;
bank = tl_create(slots);
if (bank == NULL) return 3;
puts("INIT 0");
} else if (strcmp(op, "TIME") == 0) {
uint64_t now;
if (scanf("%" SCNu64, &now) != 1) return 2;
printf("TIME %d\n", tl_advance(bank, now));
} else if (strcmp(op, "ARM") == 0) {
uint32_t id;
uint64_t deadline, period, tag;
if (scanf("%" SCNu32 " %" SCNu64 " %" SCNu64 " %" SCNu64,
&id, &deadline, &period, &tag) != 4) return 2;
printf("ARM %d\n", tl_arm(bank, id, deadline, period, tag));
} else if (strcmp(op, "NEXT") == 0) {
tl_due v = {UINT32_MAX, UINT64_MAX, UINT64_MAX,
UINT64_MAX, UINT64_MAX};
int rc = tl_next(bank, &v);
printf("NEXT %d %" PRIu32 " %" PRIu64 " %" PRIu64
" %" PRIu64 " %" PRIu64 "\n", rc, v.timer_id,
v.generation, v.deadline, v.period, v.tag);
} else if (strcmp(op, "TAKE") == 0) {
tl_fire v = {UINT32_MAX, UINT64_MAX, UINT64_MAX};
int rc = tl_take(bank, &v);
printf("TAKE %d %" PRIu32 " %" PRIu64 " %" PRIu64 "\n",
rc, v.timer_id, v.generation, v.ticket);
} else if (strcmp(op, "BEGIN") == 0) {
tl_fire v;
if (!read_fire(&v)) return 2;
printf("BEGIN %d\n", tl_begin(bank, v));
} else if (strcmp(op, "END") == 0) {
tl_fire v;
uint32_t mode;
if (!read_fire(&v)) return 2;
if (scanf("%" SCNu32, &mode) != 1) return 2;
printf("END %d\n", tl_end(bank, v, mode));
} else if (strcmp(op, "CANCEL") == 0) {
uint32_t id;
tl_cancel v = {UINT32_MAX, UINT64_MAX, UINT64_MAX};
int rc;
if (scanf("%" SCNu32, &id) != 1) return 2;
rc = tl_cancel_sync(bank, id, &v);
printf("CANCEL %d %" PRIu32 " %" PRIu64 " %" PRIu64 "\n",
rc, v.timer_id, v.generation, v.serial);
} else if (strcmp(op, "POLL") == 0) {
tl_cancel v;
if (scanf("%" SCNu32 " %" SCNu64 " %" SCNu64,
&v.timer_id, &v.generation, &v.serial) != 3) return 2;
printf("POLL %d\n", tl_cancel_poll(bank, v));
} else if (strcmp(op, "VIEW") == 0) {
uint32_t id;
tl_timer_view v = {
UINT32_MAX, UINT32_MAX, UINT64_MAX, UINT64_MAX,
UINT64_MAX, UINT64_MAX, UINT64_MAX, UINT64_MAX,
UINT64_MAX, UINT64_MAX, UINT64_MAX, UINT64_MAX,
UINT64_MAX, UINT64_MAX, UINT64_MAX
};
int rc;
if (scanf("%" SCNu32, &id) != 1) return 2;
rc = tl_view(bank, id, &v);
print_view(rc, &v);
} else if (strcmp(op, "BANK") == 0) {
tl_bank_view v = {UINT64_MAX, UINT32_MAX, {
UINT32_MAX, UINT32_MAX, UINT32_MAX, UINT32_MAX, UINT32_MAX}};
int rc = tl_bank_snapshot(bank, &v);
printf("BANK %d %" PRIu64 " %" PRIu32 " %" PRIu32
" %" PRIu32 " %" PRIu32 " %" PRIu32 " %" PRIu32 "\n",
rc, v.now, v.slots, v.phase_count[0], v.phase_count[1],
v.phase_count[2], v.phase_count[3], v.phase_count[4]);
} else {
return 2;
}
}
tl_destroy(bank);
return 0;
}