This project is a software emulator for the RISCY instruction set, designed as part of the COMP406 / COMP590 course. It simulates a minimal RISCY machine with a focus on executing a defined subset of operations, including arithmetic, memory access, control flow, and special instructions.
- A C compiler (e.g., GCC or Clang) is required to build the emulator.
- Basic knowledge of C programming and command-line tools is recommended.
-
Clone the repository:
git clone https://github.com/jchacker5/riscy_emulator.git -
Compile the emulator:
cd RISCY-Emulator gcc -o riscy_emulator main.c -
Run the emulator:
./riscy_emulatorTo enable debugging output, use the
-dflag:./riscy_emulator -d
The emulator reads RISCY binary machine code from an in-memory array and executes it. To test your own RISCY programs, modify the memory array in main.c with your machine code.
Included are example RISCY programs for Fibonacci sequence calculation, memory printing, and Conway's Game of Life simulation. These programs demonstrate the emulator's capability to handle a variety of instructions and scenarios.
The emulator supports the following instructions:
ADD,SUB: Arithmetic operationsLOAD,STORE: Memory accessSKIPZ,SKIPNZ: Conditional executionJALR: Jump and link registerSLI: Shift left and insertNAND: Bitwise NANDINC,DEC: Increment and decrementIN,OUT: Input and outputNOP: No operationHALT: Stop the emulator
Each instruction is implemented as a separate function in the emulator, ensuring modularity and clarity.
Debugging output can be enabled with the -d flag. This prints the state of the machine after each instruction execution, including the program counter, instruction opcode, register values, and more.
Contributions to the emulator are welcome. Please adhere to the project's coding standards and submit pull requests for review.
This project is licensed under the MIT License - see the LICENSE.md file for details.
- Course instructors and TAs for providing guidance and support throughout the project.
- Fellow students for collaboration and insights.