Course:CPSC312-2024-y86-Emulator

From UBC Wiki

Authors: Ali, Devon, Garima

What is the problem?

We will be creating an emulator for the y86 instruction set architecture. Our plan is to implement the instructions and general architecture (call stack, registers) defined in the spec listed in the links for y86 documentation.

What is the something extra?

Implement a cache (instruction/memory) similar to the one that a real CPU has. Use an LRU/MRU cache to determine number of hits and misses, showing the overall efficiency of caching and the program input with respect to caching.

Also, we have implemented a debugger via a unique `break` instruction to allow for easier access to program modification and error detection.

What did we learn from doing this?

Haskell was very practical for this use case. The ability to create classes and data types was useful for mapping y86 features such as the ALU, condition codes, and Instructions. Additionally, the pattern matching of Haskell allowed us to easily handle the large variety of instructions that could be given.

Additionally, the ability to derive read and show for our own classes and types allowed us to parse the input for proper instruction syntax a lot more easily, and so Haskell was a great choice due to this.

However, the lack of documentation, especially for beginners made it difficult to implement new ideas, and if we got stuck on a part, it was difficult to resolve errors in a way that was relevant to us.

Work division

Ali - Generating a parser for y86 code lines, creating self-contained y86 programs, error handling.

Devon - parsing y86 code, creating datatypes for CPU and Instructions, reading in y86 files

Garima - Type and Implementation of RegisterFile class, generating a working Memory class

Links to code etc.

Code: https://github.com/devon-mar/UBC-CPSC312-project1/

Y86 documentation: https://web.cse.ohio-state.edu/~reeves.92/CSE2421sp13/PracticeProblemsY86.pdf

http://siever.info/cs400/Y86.html

https://www.cs.ubc.ca/~tmm/courses/213-12/resources/sm-doc/overview-summary.html