Batch 21 (20261027-A-bos-redo-21) rebuilt 40 of the 53 rejected Bos-qiao environments: hidden assertions that ran inside the candidate's process now run in a trusted parent that reads observations from a low-UID worker; gold bytes are unchanged. 9 were excluded for scope (ROS2, oversize, security core), 3 are blocked because the source requires an exec bit the platform does not freeze, 1 lacks requests/bs4 in trace6. Batch 18 (20261026-C-hwe-codegen-18) adds its last 34 of 134 tasks; the first 100 landed in 2f32624d. Claude reviewed 74/74 USABLE against current digests, canonical families, no ID or source overlap with main, plain public docs. Only the new task directories are taken; the stale pre-batch-20 copies of concur-release-capsule and resource-temp-link on the batch 21 branch and both branches' progress notes stay as main has them. Difficulty is unmeasured. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
76 lines
1.9 KiB
C++
76 lines
1.9 KiB
C++
#ifndef FLASH_HPP
|
|
#define FLASH_HPP
|
|
#include <array>
|
|
#include <cstdint>
|
|
#include <iosfwd>
|
|
#include <string>
|
|
#include <vector>
|
|
namespace flash {
|
|
using Number = std::int64_t;
|
|
enum class Code : int {
|
|
Ok = 0,
|
|
Range = 1,
|
|
Absent = 2,
|
|
Exists = 3,
|
|
Busy = 4,
|
|
Locked = 5,
|
|
Page = 6,
|
|
Syntax = 7,
|
|
Limit = 8
|
|
};
|
|
struct Result {
|
|
Code code = Code::Ok;
|
|
std::string error;
|
|
std::vector<Number> fields;
|
|
std::vector<std::uint8_t> data;
|
|
};
|
|
struct CliResult {
|
|
Number physical = 0;
|
|
Number processed = 0;
|
|
Number syntax = 0;
|
|
bool limited = false;
|
|
};
|
|
class FlashBank {
|
|
public:
|
|
FlashBank();
|
|
Result reset();
|
|
Result attach(Number id, Number fill);
|
|
Result detach(Number id);
|
|
Result wren(Number id);
|
|
Result wrdi(Number id);
|
|
Result program(Number id, Number address, Number count, Number value);
|
|
Result erase(Number id, Number sector);
|
|
Result advance(Number id, Number ticks);
|
|
Result read(Number id, Number address, Number count) const;
|
|
Result word(Number id, Number address, Number width) const;
|
|
Result status(Number id) const;
|
|
Result inspect() const;
|
|
private:
|
|
struct Chip {
|
|
bool exists = false;
|
|
bool wel = false;
|
|
Number busy = 0;
|
|
Number kind = 0;
|
|
Number address = 0;
|
|
Number count = 0;
|
|
Number value = 0;
|
|
Number accepted = 0;
|
|
Number completed = 0;
|
|
std::array<std::uint8_t, 128> image{};
|
|
};
|
|
struct Event {
|
|
int operation;
|
|
std::vector<Number> arguments;
|
|
};
|
|
std::vector<Event> history_;
|
|
std::array<Chip, 4> replay() const;
|
|
static bool valid_id(Number id);
|
|
static Result failure(Code code);
|
|
static Result success(std::vector<Number> fields = {});
|
|
static void append_status(std::vector<Number>& fields, const Chip& chip);
|
|
static void complete(Chip& chip);
|
|
};
|
|
CliResult run_cli(std::istream& input, std::ostream& output, FlashBank& bank);
|
|
}
|
|
#endif
|