1 unstable release
0.1.1 | Aug 27, 2024 |
---|---|
0.1.0 |
|
#84 in Emulators
25 downloads per month
340KB
595 lines
LC3 ZKVM, LC3 Zero-Knowledge Virtual Machine
Introduction
LC3 ZKVM is a virtual machine implementation based on the Little Computer 3 (LC3) architecture, enhanced with zero-knowledge proof capabilities. This project aims to provide a secure and efficient environment for executing LC3 programs with privacy-preserving features.
Build
cargo build --release
Usage
cargo run --release --bin lc3-zkvm -- <path_to_obj_file>
Example:
cargo run --release --bin lc3-zkvm -- ./assets/hello.obj
License
This project is licensed under the MIT License. See the LICENSE file for more details.
Reference
- 📚 Little Computer 3 - Wikipedia
- 📚 Write your Own Virtual Machine By Justin Meiners and Ryan Pendleton
lib.rs
:
LC3 Virtual Machine
This crate provides an implementation of the LC3 virtual machine, including modules for handling instructions, memory, opcodes, registers, and utility functions.
Modules
instruction
: Contains functions to execute various LC3 instructions.memory
: Manages the memory of the LC3 virtual machine.opcode
: Defines the opcodes used by the LC3 virtual machine.register
: Manages the registers of the LC3 virtual machine.utils
: Provides utility functions used throughout the LC3 virtual machine.
Example
use lc3_zkvm::memory::Memory;
use lc3_zkvm::register::RegisterFile;
use lc3_zkvm::instruction::execute;
let raw_instruction: u16 = 0x1234;
let mut registers = RegisterFile::new();
let mut memory = Memory::new();
match execute(raw_instruction, &mut registers, &mut memory) {
Ok(_) => println!("Instruction executed successfully"),
Err(e) => println!("Instruction execution failed: {}", e),
}