omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / src / omega_numeric_provenance.h
| 1 | /* SPDX-License-Identifier: Apache-2.0 |
| 2 | * Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef OMEGA_NUMERIC_PROVENANCE_H |
| 18 | #define OMEGA_NUMERIC_PROVENANCE_H |
| 19 | |
| 20 | #include <stdbool.h> |
| 21 | #include <stddef.h> |
| 22 | #include <stdint.h> |
| 23 | |
| 24 | /* |
| 25 | * One entry per distinct instruction the GB10 numeric executor submits. |
| 26 | * fixture_w0..w2 are the exact instruction words (register fields included); |
| 27 | * the control word w3 is checked separately against the scoreboard rules. |
| 28 | * An entry records what the development oracle decoded; it is not a GB10 |
| 29 | * qualification. GB10 parity lives only in the OMEGA-NUMERIC-0 receipt. |
| 30 | */ |
| 31 | typedef struct { |
| 32 | const char *key; /* matches OmegaNumericPatchInsn.provenance_key */ |
| 33 | const char *mnemonic; /* nvdisasm text for these exact words */ |
| 34 | uint32_t opcode; /* fixture_w0 & 0xffff */ |
| 35 | const char *description; |
| 36 | const char *evidence_source; |
| 37 | uint32_t fixture_w0; |
| 38 | uint32_t fixture_w1; |
| 39 | uint32_t fixture_w2; |
| 40 | bool variable_latency; /* result arrives through a scoreboard */ |
| 41 | } OmegaOpcodeProvenance; |
| 42 | |
| 43 | size_t omega_numeric_get_opcode_count(void); |
| 44 | const OmegaOpcodeProvenance *omega_numeric_get_opcode(size_t index); |
| 45 | |
| 46 | /* |
| 47 | * Cross-checks a provenance table against the executor: |
| 48 | * - every entry is complete, its opcode equals w0 & 0xffff, keys are unique; |
| 49 | * - every instruction every encoded op submits has an entry with identical |
| 50 | * w0/w1/w2, and every entry is used by some op (no orphan claims); |
| 51 | * - STG/EXIT words equal the vecadd baseline at 0x120/0x130 (control aside); |
| 52 | * - scoreboards: the first patched instruction waits on the load barrier |
| 53 | * (SB4); a variable-latency instruction sets a write barrier and the very |
| 54 | * next instruction (STG, FADD, ...) waits on it. |
| 55 | * Returns 0 when consistent; otherwise the number of problems (each printed |
| 56 | * to stderr when verbose). |
| 57 | */ |
| 58 | int omega_numeric_verify_fixture_table(const OmegaOpcodeProvenance *table, size_t n, bool verbose); |
| 59 | |
| 60 | /* The built-in table through omega_numeric_verify_fixture_table. */ |
| 61 | int omega_numeric_verify_all_fixtures(void); |
| 62 | |
| 63 | #endif /* OMEGA_NUMERIC_PROVENANCE_H */ |