Write a simulator for the Y86 computer described in Chapter 4 of Computer Systems: A Programmer's Perspective (2nd Edition), Randal E. Bryant, David R. O'Hallaron, 2010.
Simulate a 32-bit byte-addressable memory. The processor has a program counter (PC), 8 32-bit registers (%eax, %ebx, %ecx, %edx, %esi, %edi, %esp, and %ebp), and a 3-bit condition code. The instruction set is defined by a 1-byte opcode. Each opcode has a specific format and definition.
Load a Y86 object file into memory to get a program to run. Assume the starting address of the object file (the initial PC value) is the first load address that you find.
Execute instructions one after another until you get either (a) a halt instruction (opcode = 0x00), or (b) an error condition (an invalid opcode, or an invalid memory address).
For each instruction, print the address of that instruction, the mnemonic opcode for that instruction, and the value of any register or memory address used by the instruction. Print the value of the register after the instruction has completed.
Due Date: 29 Mar 2013