/** * Instruction Factory - Data-driven instruction set builder * * This factory breaks the circular dependency by: * 1. Using data (opcode definitions) instead of type-specific code * 2. Not importing CPU types in instruction definitions * 3. Allowing CPU to optionally use instruction builders * * Instructions are defined as data (opcode -> function mapping) rather than * hard-coded in the CPU or instruction table files. */ /** * CPU execution context interface * Generic enough to work with any CPU implementation */ export interface ICpuContext { PC: number; pop: () => number; push: (value: number) => void; registers: number[] | Uint32Array; memory: Uint8Array; } export interface InstructionDefinition { readonly opcode: number; readonly mnemonic: string; readonly handler: (context: ICpuContext) => void; } export interface InstructionSet { readonly name: string; readonly instructions: InstructionDefinition[]; } /** * Create an instruction factory for a given instruction set * This avoids circular dependencies by making instruction sets data-driven */ export declare function createInstructionFactory(instructionSet: InstructionSet): Map void>; /** * Create a sparse array (0-indexed) from instruction definitions * More cache-friendly than Map for sequential opcodes */ export declare function createInstructionArray(instructionSet: InstructionSet, arraySize?: number): Array<(context: ICpuContext) => void>; /** * RISC-V RV32I Instruction Set Definition (Subset for Blockchain VM) * * This is data-driven, so it doesn't depend on CPU type. * The CPU can use this to build its instruction handlers. */ export declare const RISCV_RV32I_INSTRUCTIONS: InstructionSet; /** * Legacy x86-compatible instruction set (for backward compatibility) * * This is a minimal x86-like instruction set encoded as data. * Not recommended for new code, but provided for compatibility. */ export declare const X86_LEGACY_INSTRUCTIONS: InstructionSet; //# sourceMappingURL=instructionFactory.d.ts.map