Introduction
Architectura (archsem) is a standalone, IR-agnostic instruction-semantics framework. It captures what machine instructions and bytecode operations do—as typed, verified data where possible, and as generic Rust where necessary—decoupled from any single target intermediate representation, decompiler, emulator, or binary-analysis framework.
Instead of hardcoding instruction semantics into LLVM IR, a custom SSA graph, or an emulator loop, Architectura defines a single neutral trait—IrEmitter—and expresses instruction behavior in terms of pure data micro-op programs (SemProgram) authored in the Asem domain-specific language (semantics/).
┌─▶ archsem-ir (RtlEmitter / Function CFG / SSA) ─▶ archsem-simplify / archsem-symex
│
Machine / Bytecode ─────┼─▶ archsem-llvm (LlvmEmitter) ──────────────────▶ LLVM IR
(Decoder + SemProgram) │
├─▶ archsem-ref (ReferenceEmitter) ──────────────▶ Bounded Concrete Oracle
│
└─▶ archsem-record (ActionRecorder) ─────────────▶ Serializable Action Stream
Design Philosophy
-
Semantics as Verified Data (
SemProgram) Most instruction semantics live as pure, staticSemProgramtables of typedMicroOpinstructions operating over a finite value-slot array. An interpreter (run/run_checked) executes aSemProgramagainst anyIrEmitter, calling the exact same primitive methods a hand-written handler would—after running the canonical semantic verifier at the trust boundary. -
Control Flow Is Returned, Never Emitted (
ControlEffect/SemanticControl) AnIrEmitterhas nobr,jmp, orcreate_blockmethods. Basic-block boundaries, CFG recovery policies, and loop structures differ across emulators, static analyzers, and recompilers. Every semantic execution returns its terminal outcome (SemanticControl<E::Value>) so the consumer's own driver builds whatever CFG or dispatch loop it needs. -
Explicit
ChoiceInstead ofundefor Poison Architectura never lowers architectural uncertainty (undefined flags afterDIV, entropy instructions, implementation-defined behavior, uninitialized state) to backendundefor LLVM poison. Instead, uncertainty is modeled as a first-class, typed, width-exactChoicecarrying aChoiceKind, aChoiceScopecorrelation lifetime, an optionalChoiceKey, and a validChoiceDomain. -
Strict Separation of Providers and Consumers Architectura is a semantics provider, not a closed binary-analysis framework. It provides exact register/flag dependencies, explicit predicates, indirect-target expressions, ordered instruction-local memory/fault events, caller-rooted backward slicing, and solver-neutral proof obligations. Taint policies, alias heuristics, ABI/OS/syscall emulation, dispatcher recovery, and SMT solver invocation remain outside
archsem. -
Fidelity Is Explicit, Never Approximated Silently Every semantic route carries a multidimensional
SemanticFidelityrecord (coverage, determinism, observable facets, validation evidence, and reason codes). Instructions without admitted semantics fail closed with a typed unsupported boundary rather than silently becoming no-ops or unconstrained outputs.
Comparison with Other Semantic Frameworks
| System | Primary Representation | Control Flow | Nondeterminism / UB | Target Independence |
|---|---|---|---|---|
Architectura (archsem) | SemProgram micro-ops + IrEmitter trait + archsem-ir RTL | Returned as SemanticControl; CFG driver is separate | Typed Choice with kind, scope, key, and domain; partial ops explicit | Zero target-IR deps in archsem-core; backends implement IrEmitter or consume archsem-ir |
| Remill | C++ intrinsic templates compiled to LLVM bitcode | Handled by caller / Anvill | Relies on LLVM semantics / __remill_undefined_* intrinsics | Tightly coupled to LLVM IR |
| Ghidra P-Code | Sleigh specifications compiled to p-code ops | Embedded intra-instruction branches + p-code relative jumps | UNIQUE / undefined op semantics; userops (CALLOTHER) lack typed contracts | Coupled to Ghidra address spaces and p-code VM |
| BAP BIL | Algebraic BIL statements in OCaml | Intra-instruction jumps (jmp, cjmp) | Unknown expressions | Coupled to BAP / OCaml ecosystem |
| Valgrind VEX | C IRStmt / IRExpr superblocks | IRJumpKind exits + dirty helpers | Implicit via helper calls | Designed for dynamic instrumentation |
| QEMU TCG | Tiny Code Generator ops | TCG branches / labels inside TB | Architecture helpers in C | Designed for JIT emulation |
Architectura adopts the Remill/Anvill split between instruction semantics and program restructuring, Ghidra P-Code's explicit address spaces and provenance, Sail/ASL's strong bitvector width discipline and explicit nondeterminism, and WebAssembly's mandatory structural validator before execution.
Naming Guide
| Name | Meaning |
|---|---|
| Architectura | The overall repository and project (https://github.com/valeria-org/architectura). |
archsem | The framework name, crate prefix (archsem-core, archsem-ir, ...), and C/C++ library target (libarchsem / archsem::archsem). |
| Asem | "Architectura Semantics" — the .asem source language used to author instruction semantics and machine-code form catalogs, compiled by archsemc. |
valeria-org | The public GitHub organization hosting Architectura and its companion decoder/solver crates (fARM64, fWASM, fLUA, fNET, cildec, bitwright). |
License
Architectura is open-source software licensed under the MIT License (Copyright (c) 2026 valeria-org).
[!NOTE] The bounded symbolic execution crate
archsem-symex(and the optionalsymex/ARCHSEM_SYMEX=ONfeature inarchsem-capi) depends onbitwright, which is licensed under PolyForm-Noncommercial-1.0.0 (free for noncommercial use; commercial use requires a license from its licensor). Every other crate in the workspace is pure MIT.