Computer Science 281

 

 

 

Hour Exam #3

 

 

 

 

 

 

Name ____________________________

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Friday, April 30

90 pts. (will be adjusted to 100 pts in the gradebook)

 


1.         (10 pts.)           Consider the following diagram for a one-bit ALU:

 

 

 

 

 

We want to add A=0, B = 1 with a carry in of 1.  How do we set F1 and F0?  What will be output?

 

 


 

2.         (15 pts.) Consider the following diagram (from Tanenbaum) for a 4 by 3 memory. 

 

            Suppose that we want to write the word 011 into word 2.  How do we set the flags to do this?

 

 

 

 

3.         (10 pts.) Draw a diagram of a clocked SR latch.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

4.         (10 pts.) Give the internal double precision representation of the floating point number -25.25.

 

 

 


5.         (15 pts.) Write an assembly language subroutine to be called from a main program written in C which takes two double precision floating point arguments and returns the absolute value of the difference of the two arguments (i.e., abs(x – y).

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


 6.        (10 pts.)           We use the psuedo-ops .text and .data to separate regions of memory.  What are the properties of the memory regions specified as being .text and how do they differ from .data?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

7          (5 pts.) What distinguishes .data from .bss?

 

 

 


 

8.         (15 pts.)           Assemble the following two instructions into machine code

 

                                    and       %r1, %r2, %r3

                                    and       %r1, 25, %r3

 

            and is a format 3 instruction with an op code of 10 and op3 code of 000001.  Please give your answers in binary and in  hex.