How pxlman/vole-machine-simulator works
Project type and purpose
• This is a desktop application written in C++/Qt6 – a graphical, interactive “vole machine” (educational CPU) simulator.
• The README confirms it’s a monolithic Qt GUI program that models CPU internals (ALU, CU, registers, memory) and exposes them in a MainWindow.
File structure
• Top‐level Qt project file (vole.pro), qmake build system, main.cpp, and a “machine” folder of core classes.
• “machine/” contains ALU.h, CPU.h, CU.h, Machine.h, Memory.h, Register.h.
• UI files: mainwindow.ui, mainwindow.h/.cpp, resources.qrc, stylesheet.qss.
• Utility headers: MainMachine.h (likely a facade), UiFunctions.h.
• Images folder and run script (for launching).
README for additional insights
• Core features: load instructions, step/auto-run, view PC/IR, registers, memory, ASCII output, tooltips, speed control.
a. Main components
• UI Layer (Qt MainWindow + .ui + stylesheet + resources)
• Controller/Facade (MainMachine, UiFunctions)
• Machine Core (Machine class orchestrating CPU, CU, ALU, Memory, Register)
• Data Stores (Memory array, Register file)
• File I/O Module (instruction loader)
b. Relationships & interactions
• User clicks or menu actions → Qt signals/slots → Controller (MainMachine)
• Controller invokes Machine::loadProgram() or Machine::step()/runAll()
• Machine coordinates:
• CU decodes IR → CU tells ALU/Memory/Registers what to do
• ALU executes arithmetic/logical operations
• Memory/Registers updated accordingly
• Machine updates PC, IR
• After each step/update → signals back to UI to refresh tables, PC/IR display, ASCII output
c. Architectural patterns & principles
• MVC-style separation: Qt UI (View) ↔ MainMachine (Controller) ↔ Machine Core (Model)
• Single-process, event-driven via Qt’s signals/slots
• Modular hardware components (each in its own class) for clarity and testability
d. Key technologies & frameworks
• C++17, Qt6 (Widgets), qmake build
• .ui XML for layout, resources.qrc for bundling images/styles
• QTableView or custom widgets for memory/register display