

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


In this second project, you will implement a functional simulator for the w75 architecture. In the w75-package tarball, there is a sample functional simulator binary; basically you need to write your own version of this.
At a very high level, this simulator has some similarities with your disassembler. Instead of printing out text for the instructions, now you will execute them. This means you need to add state to your program consisting of the register file (integer and FP), a program counter, memory, and the flags for conditional branches.
When your simulator reads in the binary file, the .DATA and .TEXT sections should be loaded into memory starting at the addresses specified in the binary. The PC should be initialized to begin at the start of the .TEXT section. The initial state of registers and flags is undefined (no need to initialize).
After this simulator initialization, the main loop of the program begins. The steps in this loop are:
Note that “execution” of an instruction may be as simple as reading two register values, adding them, and then updating the register file. On the other hand, it may be as complicated as reading a variable number of bytes from memory to print to the screen (e.g. for the puts system call).
The simulator should take the following flags:
For reference, you can try these flags on the distributed functional simulator to see what kind of output I generated for my own debugging purposes. You can use whatever (reasonable) formatting for your verbose-mode output that suits you.
A couple of extra pointers:
enum major opcode t {MAJOP INVALID=-1, MAJOP ARITH=0, MAJOP CTRL, MAJOP FP};
Project 2 is due 11:59:59pm on the 19th of March. Note that the 19th is in fact the first saturday of spring break. The reason I made the deadline then is that I wanted you to have a full two weeks in case you need it. I suspect most of you will have plans for spring break and will turn the project in before then anyway, but you have the option. You will email me ([email protected]) a tarball containing: