{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

homework5 - Programming Using C Homework 5 1 In this...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
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
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
(set the PC to that value).
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}