The Universal Machine

By: Valeska Peters and Chiara Martello

The Universal Machine (UM) is a software implementation of a simple virtual machine from CS 40, a programming course at Tufts University. The Universal Machine reads binary UM programs and simulates execution according to the machine specification, including dynamic memory segments and instruction decoding. The GitHub repository includes a full implementation in C and a suite of unit tests covering every instruction in the UM instruction set.

UM Architecture

Behind every machine, there is a design. This is the thought process that led my partner and me to engineer our UM. The architecture of our Universal Machine reflects a balance between theoretical specification and practical implementation. We designed the system around segmented memory, where each segment functions as an independent sequence of 32-bit words accessed through a centralized segment table. This approach mirrors real machine abstractions while allowing dynamic allocation and deallocation at runtime. Registers are implemented as a dedicated array to ensure constant-time access during instruction execution. To optimize memory reuse, unmapped segment IDs are stored and recycled, preventing unnecessary expansion of the segment table. By separating memory management, register handling, and instruction execution into clear components, we created an architecture that is both modular and easy to reason about.

Previous
Previous

JumboMate

Next
Next

Slingshot Squires