This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Programming Using C Homework 5 1. In this problem you will simulate the execution of a computer’s CPU. The computer that we will simulate has 32 bytes of addressable memory (each byte is uniquely addressed). The CPU of this machine consists of the ALU (Arithmetic and Logic Unit) that performs all operations, the Inst (Instruction) Register that holds the current instruction being executed, the PC (Program Counter) that keeps track of the location of the instruction to be executed, and the Accumulator that stores the results of the arithmetic calculations. Each memory location contains a value or an instruction to execute. If a memory location contains an instruction the first three bits contain the OPCode (operation code) and the remaining 5 bits contain the argument of the instruction. Since three bits are used to describe the instruction, our machine can execute eight unique instructions: Each of these instructions has a single argument that is 5 bits in length. These instructions, in detail, are: (a) Halt. Halt the execution of the computer. Execute no more instruc- tions. This instruction ignores the argument. (b) JANZ. Jump if the Accumulator is not zero. Examine the accumula- tors value. If it is not zero, jump to the address given as the argument 1 (set the PC to that value)....
View Full Document
This note was uploaded on 01/14/2012 for the course CGS 3460 taught by Professor Staff during the Summer '08 term at University of Florida.
- Summer '08