This is a condensed version (blank spaces removed) of the midterm exam.

CISC 221* Computer Architecture
Fall 1999
Midterm Exam

Time: 50 minutes



Name:

Student Number:


Instructions:
Closed book.
No textbooks, calculators, notes, or exam aids of any kind allowed.

Answer all questions in the space provided on the test paper.

Do not open until you are told to do so.

This test has nine short answer questions worth 2 marks each, and a
programming question worth 12 marks, for a total of 30 marks. The test
counts for 20% of you final mark in the course.

Marking:

Page 2. / 6


Page 3. / 8


Page 4. / 4


Page 5. / 12


Total / 30
Part A. Short Answers.
(18 marks)

1. What distinguishes “von Neumann machines” from the computers, like
(2 marks) the ENIAC, which preceded them?

2. Which of the following is the correct von Neumann execution cycle.
(2 marks) Circle the correct answer, and briefly state why.

a) Increment PC, Fetch and Decode, Execute, Repeat

b) Fetch and Decode, Increment PC, Execute, Repeat

c) Fetch and Decode, Execute, Increment PC, Repeat

3. What is stored in the Instruction Register (IR) of the Pep/6 computer?
(2 marks) How long is IR?

4. What is the 16-bit twos-complement hexadecimal representation of
each of the following decimal numbers? Show your calculations.

(2 marks) (a) 27

(2 marks) (b) -43

5. What is the signed decimal number represented by each of the following
16 bit twos-complement hexadecimal representations? Show your
calculations.


(2 marks) (a) 005D

(2 marks) (a) FFE7

6. Here are four bytes of Pep/6 machine language, represented as
(2 marks) hexadecimal numbers:

0D 00 FF 3C


Which of the following fragments of assembly language program would
generate these four bytes of machine language? (Circle the letter of the
correct response.) There is a summary of the Pep/6 instructions
appended to this midterm paper.

a) LOADA h#FF3C,i

b) LOADX h#00FF,d
NOTX

c) LOADA h#00FF,d
NOTA

d) LOADA h#FF3C,d

e) LOADX h#00FF,i
NOTX

7. What is the difference between
(2 marks)
xx: .BYTE d#3
and
xx: .BLOCK d#3


Part B. Assembly Language Programming. (12 marks)

Translate the following C program to Pep/6 assembly language.
A summary of Pep/6 instructions is appended to this midterm paper.
If you are unsure how to translate some part of the program, translate
the rest of it and insert comments indicating where the missing part
would go. You may perform optimisations on the assembly language
program if you wish.

int main () {
int i, n, value, evens, odds;

evens = 0;
odds = 0;

scanf ("%d", &n); /* input n */

for (i = 1; i <= n; i = i + 1) {
scanf ("%d", &value); /* input value */
if ((value/2)*2 == value)
evens = evens + 1;
else
odds = odds + 1;
}

printf ("%d%s%d", evens, " ", odds);
}


CISC 221 Midterm Fall 1999 Page # of # pages