sp98 prerequisite quiz solution

Computer Organization and Design: The Hardware/Software Interface

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: University of California, Berkeley College of Engineering Computer Science Division | EECS Spring 1998 J. Wawrzynek Prerequisite Quiz January 29, 1998 CS152 Computer Architecture and Engineering Your Name: Solution ID Number: This prerequisite quiz will be used in determining class admissions. The use of calculators or notes is not allowed during this quiz. Please put your name SID on each page. Good luck! CS152 Prerequisite Quiz ID: (solution) 2 1. The following MIPS program tries to sum together all the elements of a memory array holding a set of 32-bit two's complement integers. The register $a0 is initialized to the address of the array, the register $a1 is initialized to the number of integers in the array, and all other registers are uninitialized. doit: lw add addi addi bltz $t0, 0($a0) $v0,$v0,$t0 $a0,$a0,1 $a1,$a1,-1 $a0,doit # # # # # Read next element Add to sum Advance pointer to next source Decrement Counter Repeat until done There are multiple bugs in this MIPS program x them and write below a bug-free version. and doit: lw add addi addi bgtz $v0,$v0,$r0 $t0, 0($a0) $v0,$v0,$t0 $a0,$a0,4 $a1,$a1,-1 $a1,doit # # # # # # Clear sum Read next element Add to sum Advance pointer by 4 bytes Decrement Counter Test counter (a1), Branch on greater than 0 CS152 Prerequisite Quiz ID: (solution) 3 2. For the following two's complement 16-bit integers, convert: -710 to base 2: C15216 to base 2: 4210 to base 16: 800016 to base 10: 1111 1111 1111 10012 1100 0001 0101 00102 002A16 -3276810 CS152 Prerequisite Quiz ID: (solution) 4 3. Given the following boolean function: F = bc + bc + bc (a) Write the truth table for F: a 0 0 0 0 1 1 1 1 b 0 0 1 1 0 0 1 1 c 0 1 0 1 0 1 0 1 F 0 1 1 1 0 1 1 1 (b) Write F in sum-of-products form: F = abc + abc + abc + abc + abc + abc (c) Draw a schematic for the function G = ab + cd, using AND and OR gates: a b c d G (d) Draw a schematic for the function G above using only NAND gates: a b c d G (e) Extra Credit: Is there a simplier expression for F above? What is it? F =b+c CS152 Prerequisite Quiz ID: (solution) 5 4. For the following circuit built from positive edge triggered d- ip- ops and a single XOR gate, draw the ideal waveforms at the nodes a, b, c, and d. a CLK b c d CLK a 0 1 1 1 0 b 1 0 1 1 1 c 0 1 0 1 1 d 1 0 1 0 1 ...
View Full Document

Ask a homework question - tutors are online