
Computer Architecture – Fall 2012 - Set of problems #2
1) Given the instructions for the simple machine, write a program in assembly language
that moves 10 elements from a fixed position in memory to a new one. You choose the
source and destination address. Hint: use C/Java or pseudo-code and then transform it into
assembler.
2) Show all the instruction types that can be coded with the format of the simple machine.
3) For program in Pr. 1, write the machine code produced by the assembler.
4) If a memory access needs 5 clock cycles and the rest of the instructions need a single
cycle to execute, show, for the program in problem1, how long it takes to run, how many
memory accesses are needed, taking into account accesses due to instructions and data.
5) For the simple machine, write a program in assembler that adds the contents of 10
consecutive memory locations and store the result in a different position.
6) For the above program, describe the flow of the evolution of the program.
7) Considering that the instruction ADD S, D is now ADD S, Acc where Acc is an internal
accumulator register of the CPU and MOV instructions are executed from memory to ACC
or backwards.
How do you modify the previous program with all this?
Do you need to modify the instruction format?
8) Using the instruction set form the simple machine, code the following:
a. A program that moves the contents of memory locations 50 to 59 to a new memory
address starting at 90.
b. A program that reads a value N from address 50 and writes from location 60,
numbers from 1 to N.
c. A program that reads a value N from address 50 and writes from location 70,
numbers from N to 1.
d. A program that reads a value A from location 100, a value B from location 101 and
stores in 102 the result of A+B.