# Midterm Practice

Tags

Midterm Practice

1. / Express 16Mbytes as a power of 2 number of bytes:
______
2. / Assume we are using 4 bit binary numbers. What is the pattern 1010 interpreted as:
An unsigned value ______A signed value using two's complement ______
3. / Give an example of 2's complement overflow that does NOT produce a carry out of the most significant bit using two 4-bit values:
4. / Translate A516 into:
Binary ______Decimal ______
5. / Write the sum of products for this truth table. (Do not simplify) : ______

6. / Write a Boolean expression representing the value of F in this circuit:

7. / Describe the purpose of this circuit - what does it do?

8. / Given an SR circuit shown to the right:
What input do we need to provide to force Q to 1?
What input do we need to provide to force Q to 0?
What job is it used for?
9. / A D circuit can be thought of as a "wrapper" around an SR circuit. How does the D input connect to the S and R in the SR circuit? (Draw a picture or describe what happens when D is 0 and when D is 1).
10. / Which of these technologies would likely not be based on a D circuit:
1. Memory on a stick of DRAM
2. Registers
3. Cache memory on the processor
4. Memory to "freeze" a value in between combinational circuits

11. / Use the diagram below. Give the operation would be performed on A and B, and what would the outputs would be:
f0 / f1 / A / B / CarryIn / What Operation? / Result / CarryOut
1 / 0 / 1 / 0 / 1
0 / 0 / 0 / 1 / 1

12. / Two parts of the performance formula are program/instructions and instructions/cycle. What is the third?
13. / Two processors have the same clock speed and the same CPI for a given program. Why might they have a different performance level?
14. / A processor does data operations in 1 cycle and memory operations in 3 cycles. If on a given program it uses 400 data instructions and 50 memory instructions, what is the CPI?
15. / A programmer is looking at optimizing the math code in a program. It takes 20 seconds of run time. The program also spends 50 seconds doing memory access. If she speeds up the math code run time by 25%, what is the overall speedup factor?
16. / Assume instruction E20A300A is an AND instruction encoded as shown below

Work space: ______
Write the assembly that corresponds to the instruction:
17. / The machine instructions of a program are put in a designated section of memory. What is this section called?
A. Data segment.
B. Stack segment.
C. Program segment.
D. Text segment.
18. / Write a line of assembly to put 48 into register r5.
19. / What is the difference between a logical right shift and an arithmetic one?
20. / We have the pattern 0x00001234 in r8. What will be in r8 after doing this:
AND r8, r8, 0xFF0
A. 0x00000000
B. 0x00001FF4
C. 0x00000FF0
D. 0x00000230
21. / What does EORing a register with 0xFFFFFFFF do?
22. / Imagine these data declarations are in an assembly file:
.data
a: .word 23
b: .byte 2
c: .byte -1
.align
d: .word 3
A) Write the code to store the current value of r9 into the area labeled d
B) Write the code to load c into register r1
23. / Assume r1 starts with a numeric value. Write code to set r2 to the absolute value of r1.
24. / Assume r1 starts with a numeric value. Write code to count down by 2's until you reach 0 or less.
(Don't have to do anything with the value, but if we watched r1 as the program ran it should count something like 10, 8, 6, 4, 2, 0)