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

  1. Semantics as Verified Data (SemProgram) Most instruction semantics live as pure, static SemProgram tables of typed MicroOp instructions operating over a finite value-slot array. An interpreter (run / run_checked) executes a SemProgram against any IrEmitter, calling the exact same primitive methods a hand-written handler would—after running the canonical semantic verifier at the trust boundary.

  2. Control Flow Is Returned, Never Emitted (ControlEffect / SemanticControl) An IrEmitter has no br, jmp, or create_block methods. 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.

  3. Explicit Choice Instead of undef or Poison Architectura never lowers architectural uncertainty (undefined flags after DIV, entropy instructions, implementation-defined behavior, uninitialized state) to backend undef or LLVM poison. Instead, uncertainty is modeled as a first-class, typed, width-exact Choice carrying a ChoiceKind, a ChoiceScope correlation lifetime, an optional ChoiceKey, and a valid ChoiceDomain.

  4. 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.

  5. Fidelity Is Explicit, Never Approximated Silently Every semantic route carries a multidimensional SemanticFidelity record (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

SystemPrimary RepresentationControl FlowNondeterminism / UBTarget Independence
Architectura (archsem)SemProgram micro-ops + IrEmitter trait + archsem-ir RTLReturned as SemanticControl; CFG driver is separateTyped Choice with kind, scope, key, and domain; partial ops explicitZero target-IR deps in archsem-core; backends implement IrEmitter or consume archsem-ir
RemillC++ intrinsic templates compiled to LLVM bitcodeHandled by caller / AnvillRelies on LLVM semantics / __remill_undefined_* intrinsicsTightly coupled to LLVM IR
Ghidra P-CodeSleigh specifications compiled to p-code opsEmbedded intra-instruction branches + p-code relative jumpsUNIQUE / undefined op semantics; userops (CALLOTHER) lack typed contractsCoupled to Ghidra address spaces and p-code VM
BAP BILAlgebraic BIL statements in OCamlIntra-instruction jumps (jmp, cjmp)Unknown expressionsCoupled to BAP / OCaml ecosystem
Valgrind VEXC IRStmt / IRExpr superblocksIRJumpKind exits + dirty helpersImplicit via helper callsDesigned for dynamic instrumentation
QEMU TCGTiny Code Generator opsTCG branches / labels inside TBArchitecture helpers in CDesigned 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

NameMeaning
ArchitecturaThe overall repository and project (https://github.com/valeria-org/architectura).
archsemThe 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-orgThe 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 optional symex / ARCHSEM_SYMEX=ON feature in archsem-capi) depends on bitwright, 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.