For this exam, you may use your textbook, the Internet, your notes and assignments, your brain, and divine guidance if available. You may not use other people. If you get stuck, talk to Jeff Ondich, but please don't talk to anyone else about the exam.
(12 points) Consider the following PDP8/E program.
*0200 CLA OSR DCA A LOOP, DCA N TAD A SNA HLT CLL RAL DCA A RAL TAD N JMP LOOP A, 0 N, 0
The following table shows the execution times for all of the PDP8/E instructions (not including op-code 6).
Execution times in micro-seconds for PDP8/E instructions -------------------------------------------------------- Addressing mode ------------------------------------------ Instruction Indirect with Type Direct Indirect auto-increment -------------------------------------------------------- AND 2.6 3.8 4.0 TAD 2.6 3.8 4.0 ISZ 2.6 3.8 4.0 DCA 2.6 3.8 4.0 JMS 2.6 3.8 4.0 JMP 1.2 2.4 2.6 Opcode 7 1.2 (addressing mode irrelevant) --------------------------------------------------------
And now, the questions. Assume throughout these questions that the switch register is set to octal 1357.
What does this program compute?
For how long does the program run?
How many instructions does the program execute?
Based on this program (and the 1357 input), what is the PDP8's native MIPS rating?
(9 points) Consider the following boolean function of three variables:
A | B | C || f(A,B,C) ======================= 0 | 0 | 0 || 0 0 | 0 | 1 || 0 0 | 1 | 0 || 0 0 | 1 | 1 || 1 1 | 0 | 0 || 1 1 | 0 | 1 || 0 1 | 1 | 0 || 1 1 | 1 | 1 || 0
Write a boolean alebraic expression for f(A,B,C). Simplify it as much as you can.
Draw a digital logic circuit that implements the function f.
(10 points) In C/C++ using g++ on our version of Linux, variables of type int are stored in 32-bit two's complement format. For this problem, I want you to write a C/C++ program that provides evidence that int variables are indeed stored in this format. Your job is to write a short C/C++ program that illustrates the following properties of the int type. Hand in a hard copy of your source code and a printout of a program run. You may find the unary operator ~ useful.
There are two integers N for which N == -N.
You can negate an integer by complementing it and adding 1.
If an addition operation overflows, the 32-bit result is the same as the rightmost 32 bits of the correct answer.
Your illustrations should be very brief. For example, to show that there are two integers for which N == -N, all you have to do is this:
int a = something; int b = somethingelse; cout << "a = " << a << endl; cout << "-a = " << -1*a << endl; cout << "b = " << b << endl; cout << "-b = " << -1*b << endl;
Your only job for this part, then, is to figure out which values of something and somethingelse are the ones that will give a == -a and b == -b.
(2 points) Who are Ted Hoff and Maurice Wilkes, and what importance did they have in the history of computer architecture?
(2 points) Direct me, if you wish, to a web site that you find amusing.
(9 points) Consider the program stackframes.cpp. Compile it and run it. Then compile it with the command "g++ -S stackframes.cpp". This will create the (Intel) assembly language program stackframes.s, which you can examine to help you answer the following questions.
Where does the return address get stored when main calls dosomething?
As precisely as you can, explain where n, k, a, and b are stored. Though you will have other things to say, make sure to include an answer to this question: if any of them are stored in memory, in which order do they appear in memory?
In the first loop in dosomething, change the loop condition from "k < 4" to "k <= 4", recompile, and rerun. How does the program's output change? Explain why.