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

100 lines
4.8 KiB
C++

#include "controller.hpp"
#include <iostream>
#include <string>
int main() {
device::Controller controllers[2];
int selected = 0;
std::string op;
while (std::cin >> op) {
auto& c = controllers[selected];
if (op == "U") {
std::cin >> selected;
std::cout << "U " << selected << '\n';
} else if (op == "Z") {
c.reset();
std::cout << "Z 0\n";
} else if (op == "C") {
int ch; device::Configuration cfg;
std::cin >> ch >> cfg.ready_tick >> cfg.warmup >> cfg.fault_read
>> cfg.mask >> cfg.ready_bits >> cfg.idle_bits >> cfg.value;
std::cout << "C " << c.configure(ch, cfg) << '\n';
} else if (op == "B") {
int ch; std::uint64_t budget, tag, epoch;
std::cin >> ch >> budget >> tag >> epoch;
int rc = c.begin(ch, budget, tag, epoch);
std::cout << "B " << rc << ' ' << epoch << '\n';
} else if (op == "G") {
std::uint32_t members; std::uint64_t budget, tag, seed;
std::cin >> members >> budget >> tag >> seed;
std::array<std::uint64_t, 8> epochs; epochs.fill(seed);
int rc = c.begin_group(members, budget, tag, epochs);
std::cout << "G " << rc;
for (auto value : epochs) std::cout << ' ' << value;
std::cout << '\n';
} else if (op == "A") {
std::uint64_t delta; std::cin >> delta;
std::cout << "A " << c.advance(delta) << '\n';
} else if (op == "P") {
int ch; std::cin >> ch;
std::cout << "P " << c.poll(ch) << '\n';
} else if (op == "X") {
int ch; std::cin >> ch;
std::cout << "X " << c.cancel(ch) << '\n';
} else if (op == "H") {
std::uint32_t members; std::cin >> members;
std::cout << "H " << c.cancel_group(members) << '\n';
} else if (op == "T") {
int ch, seed; std::cin >> ch >> seed;
const auto s = static_cast<std::uint64_t>(seed);
device::Completion out{seed,s,s,s,s,s};
int rc = c.take(ch,out);
std::cout << "T " << rc << ' ' << out.kind << ' ' << out.epoch
<< ' ' << out.tag << ' ' << out.value << ' ' << out.reads
<< ' ' << out.tick << '\n';
} else if (op == "S") {
int ch, seed; std::cin >> ch >> seed;
const auto s = static_cast<std::uint64_t>(seed);
device::Snapshot out{seed,s,s,s,s,bool(seed),bool(seed),bool(seed),s};
int rc = c.inspect(ch,out);
std::cout << "S " << rc << ' ' << out.phase << ' ' << out.epoch
<< ' ' << out.tag << ' ' << out.deadline << ' ' << out.polls
<< ' ' << out.alarm_due << ' ' << out.alarm_enqueued
<< ' ' << out.configured << ' ' << out.completed_tick << '\n';
} else if (op == "V") {
int ch, seed; std::cin >> ch >> seed;
const auto s = static_cast<std::uint64_t>(seed);
const auto u = static_cast<std::uint32_t>(seed);
device::RegisterView out{s,s,s,u,u,u,s,s,u,seed,s};
int rc = c.registers(ch,out);
std::cout << "V " << rc << ' ' << out.ready_tick << ' ' << out.warmup
<< ' ' << out.fault_read << ' ' << out.mask << ' ' << out.ready_bits
<< ' ' << out.idle_bits << ' ' << out.value << ' ' << out.reads
<< ' ' << out.last_bits << ' ' << out.last_error
<< ' ' << out.last_value << '\n';
} else if (op == "I") {
int ch; std::uint64_t epoch; std::cin >> ch >> epoch;
std::cout << "I " << c.inject(ch,epoch) << '\n';
} else if (op == "J" || op == "E") {
int ch; std::uint64_t epoch; std::cin >> ch >> epoch;
const int rc = op == "J" ? c.pending(ch,epoch) : c.withdraw(ch,epoch);
std::cout << op << ' ' << rc << '\n';
} else if (op == "D") {
std::uint64_t count; std::cin >> count;
std::cout << "D " << c.deliver(count) << '\n';
} else if (op == "F") {
int seed; std::cin >> seed;
device::Alarm out{seed,static_cast<std::uint64_t>(seed)};
int rc = c.front(out);
std::cout << "F " << rc << ' ' << out.channel << ' ' << out.epoch << '\n';
} else if (op == "K") {
auto out=c.statistics();
std::cout << "K " << out.tick << ' ' << out.next_epoch << ' ' << out.active
<< ' ' << out.terminal << ' ' << out.queued << ' ' << out.delivered
<< ' ' << out.ignored << '\n';
} else if (op == "N") {
std::cout << "N " << c.now() << '\n';
}
}
return 0;
}