COSC 201, Fall 1997  Exam 1

 

1.  Define or describe the following:

 

A.  The five classical components of a computer.

 

B.  Instruction Set Architecture

 

C.  Benchmark Suite

 

D.  Orthogonal Opcodes and Address Mode

 

E.  PLA

 

F.  Clock

 

G.  Level-triggered

 

H.  DRAM

 


2.  Suppose you have the following instruction set mix:

 

            Instr type                     CPI                  % in program

            A                                 2                      30

            B                                 3                      30

            C                                 5                      40

 

 

A.  What is the average CPI for this mix?

 

B.  If the clock rate is 70 MHz, how many instructions per second are executed?

 

C.  If a program with this instruction mix run on a certain data set executes 2 billion instructions, how long does it take to run?

 

 

 

3.  Assembly code

A.  Write MIPS assembly code which will execute the following C statement for integers a, b, c, x.  Assume that registers are used to store variables as follows (do not worry about variables in memory):  a in $s0,  b in $s1,  c in $s2,  x in $s3.

 

          x = (a + b) - c;

 

 

B.  Write MIPS assembly code for the following loop, indicating where the code for the body of the loop goes with a comment.  Assume that register $t0 is used for variable k and register $s1 is used for variable num.

 

          for(k = 0; k < num; k++){

              <body of loop>

          }

 


4.  Consider the following function prototype for C++:

 

int  DoThis(int a, int b, int c);

 

Assume that the function DoThis has several local variables.  Outline the steps needed to execute the following function call in assembly code, assuming the variables are assigned to registers, x in $t0, a in $s0, b in $s1, and c in $s2.

 

          x = DoThis(a, b, c);

 

You may answer by explaining the steps in words, or by writing assembly code with comments explaining the purpose of each statement, or a mix of the two.  If you are unsure whether something needs to be done, put it in.

 

 


5.  Draw the transistor circuit for a 3-way NAND gate.

 

 

 

6.  Draw the logic gate circuit for a multiplexor with 4 input lines, two control lines, and one output line.

 

 


7.  Explain how decoders and multiplexors are used to control reading from and writing to a register file (a set of registers).  Use a diagram to illustrate your explanation.