lc3_zkvm/
lib.rs

1//! LC3 Virtual Machine
2//!
3//! This crate provides an implementation of the LC3 virtual machine, including modules for handling instructions, memory, opcodes, registers, and utility functions.
4//!
5//! # Modules
6//!
7//! - [`instruction`]: Contains functions to execute various LC3 instructions.
8//! - [`memory`]: Manages the memory of the LC3 virtual machine.
9//! - [`opcode`]: Defines the opcodes used by the LC3 virtual machine.
10//! - [`register`]: Manages the registers of the LC3 virtual machine.
11//! - [`utils`]: Provides utility functions used throughout the LC3 virtual machine.
12//!
13//! # Example
14//!
15//! ```rust
16//! use lc3_zkvm::memory::Memory;
17//! use lc3_zkvm::register::RegisterFile;
18//! use lc3_zkvm::instruction::execute;
19//!
20//! let raw_instruction: u16 = 0x1234;
21//! let mut registers = RegisterFile::new();
22//! let mut memory = Memory::new();
23//!
24//! match execute(raw_instruction, &mut registers, &mut memory) {
25//!     Ok(_) => println!("Instruction executed successfully"),
26//!     Err(e) => println!("Instruction execution failed: {}", e),
27//! }
28//! ```
29
30pub mod instruction;
31pub mod memory;
32pub mod opcode;
33pub mod register;
34pub mod utils;
35
36#[cfg(test)]
37mod instruction_test;