CS计算机代考程序代写 mips assembly Final Exam – Summer 2019

Final Exam – Summer 2019
CMPE 012: Computer Systems and Assembly Language
University of California, Santa Cruz
DO NOT BEGIN UNTIL YOU ARE TOLD TO DO SO.
This exam is closed book and closed notes. Only 4-function calculators are permitted.
Answers must be written on the attached sheets to be graded. All work must be written on
the exam.
On this page, write your last name, first name, CruzID, row and seat numbers, and the
CruzIDs of the people to your immediate left and right. Once you are permitted to begin,
write your CruzID on all subsequent pages of the exam.
You must sit in your assigned seat. Keep your student or government issued ID on your desk.
Brimmed hats must be removed or turned around backwards. Only unmarked water bottles are
permitted. Backpacks must be placed at the front of the room or along the walls. Your cell
phone must be on a setting where it will not make noise or vibrate.
For full credit, you must show your work, and your handwriting must be clearly legible.
There are 7 questions on this exam. Questions are worth 4 – 12 points each. You only need
to earn 36 points to receive 100%. Questions total 54 points, however the maximum number of
points you can earn is 45 points (125%).
This table is for CMPE 012 staff only.
QUESTION
POSSIBLE POINTS
POINTS EARNED
1
4
2
6
3
6
4
8
5
12
6
8
7
10
TOTAL
54
sum: score: (max 45)
____________________________ ____________________________ ____________________________ Row # Seat # CruzID
___________________________________________ ___________________________________________ Your Last Name Your First Name
___________________________________________ ___________________________________________ CruzID of person to left CruzID of person to right

Final Exam – Summer 2019
Page 2 of 18
Computer Systems and Assembly

CruzID: ______________________________ @ucsc.edu
Question 1: Boolean Algebra _____ / 4 pt
Shade the appropriate areas of the Venn Diagram to match the following Boolean expression.
Assume shaded areas are where the expression equals TRUE:
S’FC’ + SF + C + S’F’C’
Final Exam – Summer 2019
Page 3 of 18
Computer Systems and Assembly

Question 2: Combinational Logic _____ / 6 pt
Complete the truth table for the following PLA. Write the unsimplified sum of products and
product of sums solutions for each of the two outputs, D and E.
Output D
Write your answer here
___ / 2 pt
Truth Table ___ / 2 pt
Write your answer here
A
B
C
D
E
0
0
0
0
0
1
0
1
0
0
1
1
1
0
0
1
0
1
1
1
0
1
1
1
Sum of Products D=
Product of Sums D=
Output E
Write your answer here
___ / 2 pt
Sum of Products E=
Product of Sums E=
Final Exam – Summer 2019
Page 4 of 18
Computer Systems and Assembly

You may show your work on this page if needed
CruzID: ______________________________ @ucsc.edu
Final Exam – Summer 2019
Page 5 of 18
Computer Systems and Assembly

Question 3: Sequential Logic
Complete the truth table and timing diagram for the following circuit.
_____ / 6 pt
Truth Table
Write your answer here
___ / 2 pt
a
b
c
d
e
f
0
0
0
1
1
0
1
1
Timing Diagram
Write your answer here
___ / 4 pt
a
b
c
d
e
f
Final Exam – Summer 2019
Page 6 of 18
Computer Systems and Assembly

You may show your work on this page if needed
These are extra blank timing diagrams that you may use.
CruzID: ______________________________ @ucsc.edu
Final Exam – Summer 2019
Page 7 of 18
Computer Systems and Assembly

Question 4: Floating Point Conversion _____ / 8 pt
Convert the decimal fraction -0.9 to IEEE single precision floating point format. Follow
the steps below, writing all answers in the boxes provided.
Part A – Fractional Binary Form ___ / 2 pt
Write the number in fractional binary form. Indicate if the number is positive (+) or
negative (-) in the first blank. Indicate the location of the binary point and where the
number repeats if necessary.
Write your answer here
Show your work below
0.9 x 2 = 1.8
0.8 x 2 = 1.6
0.6 x 2 = 1.2
0.2 x 2 = 0.4
0.4 x 2 = 0.8
0.8 x 2 = 1.6
0.6 x 2 = 1.2
0.2 x 2 = 0.4
0.4 x 2 = 0.8
– 0 . 1 ​1 1 0 0​ ← repeats 1100
_____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____
(+/-)
Final Exam – Summer 2019
Page 8 of 18
Computer Systems and Assembly

CruzID: ______________________________ @ucsc.edu
Part B – Scientific Notation ___ / 1 pt
Express your answer from Part A in scientific notation.
Write your answer here
Show your work below
Part C – Field Values ___ / 4 pt
Determine the values for each of the fields in the IEEE single precision floating point
format.
Write your answer here
Show your work below
Final Exam – Summer 2019
Page 9 of 18
Computer Systems and Assembly

Part D – Final Answer ___ / 1 pt
Use your answer from Part C to convert -0.9 to IEEE single precision floating point format.
Express your answer using hexadecimal digits.
Write your answer here
Show your work below
0x _____ _____ _____ _____ _____ _____ _____ _____
Final Exam – Summer 2019
Page 10 of 18
Computer Systems and Assembly

You may show your work on this page if needed
CruzID: ______________________________ @ucsc.edu
Final Exam – Summer 2019
Page 11 of 18
Computer Systems and Assembly

Question 5: Data Movement, Syscalls _____ / 12 pt
The following program is executed. Assume little endian memory storage. Assume “some_data”
is the label for address 0x10010000. At different points of the program, you will be asked
to write the values stored in registers and memory.
.data
some_data: .byte 0x66 0x6c 0x75 0x78 0x00 0x80
.text addiu $v0 la $a0 syscall
addiu $v0 syscall
add $t0
lw $a0 syscall
lb $t1 sh $t1
addiu $v0 add $a0 syscall
$zero 4 some_data
$zero 34
$zero $a0 ($a0)
3($t0) 2($t0)
$zero 4 $zero $t0
# instruction 1 # instruction 2 # instruction 3
# instruction 4 # instruction 5
# instruction 6
# instruction 7 # instruction 8
<----- show regs & mem <----- show console <----- show console <----- show regs & mem <----- show console (1 pt) (1 pt) (2 pt) (1 pt) (2 pt) (2 pt) (1 pt) (2 pt) # instruction 9 # instruction 10 <----- show regs & mem # instruction 11 # instruction 12 <----- show regs & mem # instruction 13 <----- show console Whatisthestateofmemoryandregistersafterinstruction​2?​ Ifunknown,write‘?’ MEMORY REGISTERS ADDRESS DATA 0x10010005 0x 0x10010004 0x 0x10010003 0x 0x10010002 0x 0x10010001 0x 0x10010000 0x REGISTER VALUE $a0 0x $v0 0x $t0 0x $t1 0x What is shown in the console window after instruction 3​ ?​ Write "___" to indicate a space. Final Exam - Summer 2019 Page 12 of 18 Computer Systems and Assembly What is shown in the console window after instruction 5​ ?​ Write "___" to indicate a space. Hint: Include text printed from previous syscalls. Whatisthestateofmemoryandregistersafterinstruction​7?​ Ifunknown,write‘?’ What is shown in the console window after instruction 8​ ?​ Write "___" to indicate a space. Hint: Include text printed from previous syscalls. What is the state of memory and registers after instruction ​10​? If unknown, write ‘?’ CruzID: ______________________________ @ucsc.edu MEMORY REGISTERS ADDRESS DATA 0x10010005 0x 0x10010004 0x 0x10010003 0x 0x10010002 0x 0x10010001 0x 0x10010000 0x REGISTER VALUE $a0 0x $v0 0x $t0 0x $t1 0x MEMORY REGISTERS ADDRESS DATA 0x10010005 0x 0x10010004 0x 0x10010003 0x 0x10010002 0x 0x10010001 0x 0x10010000 0x REGISTER VALUE $a0 0x $v0 0x $t0 0x $t1 0x Final Exam - Summer 2019 Page 13 of 18 Computer Systems and Assembly What is the state of memory and registers after instruction ​12​? If unknown, write ‘?’ MEMORY REGISTERS ADDRESS DATA 0x10010005 0x 0x10010004 0x 0x10010003 0x 0x10010002 0x 0x10010001 0x 0x10010000 0x REGISTER VALUE $a0 0x $v0 0x $t0 0x $t1 0x What is shown in the console window after instruction 1​ 3?​ Write "___" to indicate a space. Hint: Include text printed from previous syscalls. flux0x100100000x78756c66flx Final Exam - Summer 2019 Page 14 of 18 Computer Systems and Assembly CruzID: ______________________________ @ucsc.edu Question 6: MIPS Instruction Encoding, Data Path _____ / 8 pt Part A - Instruction Encoding ___ / 4 pt Encode the following instruction. Express your answer using hexadecimal digits. lb $8 7($3) Write your answer here Show your work below 0x _____ _____ _____ _____ _____ _____ _____ _____ Final Exam - Summer 2019 Page 15 of 18 Computer Systems and Assembly Part B - Data Path Assume the following initial conditions: ___ / 4 pt $v0 0x1001aa00 $v1 0x1001bb00 $a0 0x1001cc00 $a1 0x1001dd00 $a2 0x1001ee00 $a3 0x1001ff00 | $t0 0x10010000 | $t1 0x10011100 | $t2 0x10012200 | $t3 0x10013300 | $t4 0x10014400 | $t5 0x10015500 | $t6 0x10016600 | $t7 0x10017700 | $t8 0x10018800 | $t9 0x10019900 | $s0 0xBAADCAFE | $s1 0xC0FFEEEE | $s2 0xDEADBEEF | $s3 0xFACE0FFF | $s4 0xBAAAAAAA | $s5 0xFEEDBABE | $s6 0x5EA51DE0 | $s7 0x00000000 Use your answer from Part A to determine the values on the wires listed in the table below. Refer to the following datapath diagram. WIRE VALUE (IN HEX) 11 0x 12 0x 14 0x 15 0x 16 0x 17 0x 19 0x 20 0x Final Exam - Summer 2019 Page 16 of 18 Computer Systems and Assembly Question 7: MIPS Instruction Encoding, Data Path _____ / 10 pt Part A - Instruction Encoding ___ / 4 pt Encode the branch instruction from the following code. Express your answer using hexadecimal digits. (Hints: BTA = pc + 4 + offset, immediate field = offset >> 2)
ADDRESS INSTRUCTION
0x1000
0x1004
0x1008
0x100C
0x1010 label: nop
beq $s0 $s0 label nop
nop
nop
Write your answer here
Show your work below
RUBRIC
1 pt: opcode = ——, rs = $s0 = $- = —–, rt = $t0 = $8 = 01000
3 pt: offset calculated correctly, offset encoded correctly
offset = 0xC, immediate value = 0x3
-1 offset encoded offset without shifting 2 to right (0xC = 0b0000000000001100)
-1 offset off by 4
-1 other minor mistake (e.g. encoded as negative)
SOLUTION
opcode = 0b——
rs = 0b—–
rt = 0b01000
to calculate offset:
BTA =pc+4+offset offset = BTA – (pc + 4)
BTA = 0x1010
pc = 0x1000
offset = 0x1010 – (0x1000 + 4)
offset = 0xC => immediate field = 0x0003
CruzID: ______________________________ @ucsc.edu
0x _____ _____ _____ _____ _____ _____ _____ _____
Final Exam – Summer 2019
Page 17 of 18
Computer Systems and Assembly

Part B – Data Path ___ / 6 pt
Determine the values for the wires listed in the table below for the branch instruction
encoded in Part A.
Use your answer from Part A to determine the values on the wires listed in the table below.
Refer to the following datapath diagram.
WIRE
VALUE (IN HEX)
1
0x1000
2
0x1004
3
0x
7
0x
8
0x
9
0x
12
0x
16
0x
17
0x
18
0x
24
0x
25
0x
Final Exam – Summer 2019
Page 18 of 18
Computer Systems and Assembly