CS计算机代考程序代写 mips assembly Last Name: _______________________________ First Name: _______________________________ CruzID: __________________________________

Last Name: _______________________________ First Name: _______________________________ CruzID: __________________________________
Final Exam
CMPE 012: Computer Systems and Assembly Language
University of California, Santa Cruz
Summer 2018
This exam is closed book and closed notes. Calculators are not permitted. Answers must be marked on the Scantron form to be graded.
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. Your cell phone must be on a setting where it will not make noise or vibrate.
All questions are multiple choice. Assume the first answer is ‘A’, the second is ‘B’ and so on. Some questions have more than one correct answer. You must mark all correct answers to receive credit for a question. Some questions refer to figures that are displayed on the supplemental sheet.
You have 90 minutes to complete this exam.
Note
An underscore followed by a number indicates the base system. Unless otherwise noted, a number followed by no underscore is in decimal.

REG NAME REG # MNEMONIC MEANING
TYPE OPCODE FUNCT MNEMONIC MEANING
TYPE OPCODE FUNCT
$zero 0 sll $at 1 srl
$v0 2 sra
$v1 3 jr
$a0 4 mfhi
$a1 5 mflo
$a2 6 mult
$a3 7 multu
$t0 8 div
$t1 9 divu
$t2 10 add
$t3 11 addu
$t4 12 sub
$t5 13 subu
$t6 14 and
$t7 15 or
$s0 16 xor
$s1 17 nor
$s2 18 slt
$s3 19 sltu
$s4 20 j
$s5 21 jal
$s6 22 beq
$s7 23 bne
$t8 24 blez
$t9 25 addi
$k0 26 addiu
$k1 27 slti
$gp 28 sltiu $sp 29 andi
mfc0 Move from Coprocessor 0 lb Load Byte
lh Load Halfword
lw Load Word
lbu Load Byte Unsigned
lhu Load Halfword Unsigned sb Store Byte
sh Store Halfword
sw Store Word
Logical Shift Left
Logical Shift Right (0-extended) Arithmetic Shift Right (sign-extended) Jump to Address in Register
Move from HI Register
Move from LO Register
Multiply
Unsigned
Divide
Unsigned
Add
Add Unsigned
Subtract
Unsigned Subtract
Bitwise AND
Bitwise OR
Bitwise XOR
Bitwise NOR
Setto1if
Setto1if
Jump to Address
Jump and Link
Branch if Equal
Branch if Not Equal
Branch if Less Than or Equal to Zero
Add Immediate
Add Unsigned Immediate
Set to 1 if Less Than Immediate
Set to 1 if Less Than Unsigned ImmediateI
0x00 0x00 add 0x00 0x02 addi 0x00 0x03 addiu 0x00 0x08 addu 0x00 0x10 and 0x00 0x12 andi 0x00 0x18 beq 0x00 0x19 blez 0x00 0x1A bne 0x00 0x1B div 0x00 0x20 divu 0x00 0x21 j 0x00 0x22 jal 0x00 0x23 jr 0x00 0x24 lb 0x00 0x25 lbu 0x00 0x26 lh 0x00 0x27 lhu 0x00 0x2A lui 0x00 0x2B lw 0x02 NA mfc0 0x03 NA mfhi 0x04 NA mflo 0x05 NA mult 0x06 NA multu 0x08 NA nor 0x09 NA or 0x0A NA ori 0x0B NA sb 0x0C NA sh 0x0D NA sll 0x0F NA slt 0x10 NA slti 0x20 NA sltiu 0x21 NA sltu 0x23 NA sra 0x24 NA srl 0x25 NA sub 0x28 NA subu 0x29 NA sw 0x2B NA xor
Add
Add Immediate
Add Unsigned Immediate
Add Unsigned
Bitwise AND
Bitwise AND Immediate
R
I
I
R
R
I
I
I
I
R
R
J
J
R
I
I
I
I
I
I
R
R
R
R
R
R
R
I
I
I
R
R
I
0x00 0x20 0x08 NA 0x09 NA 0x00 0x21 0x00 0x24 0x0C NA 0x04 NA 0x06 NA 0x05 NA 0x00 0x1A 0x00 0x1B 0x02 NA 0x03 NA 0x00 0x08 0x20 NA 0x24 NA 0x21 NA 0x25 NA 0x0F NA 0x23 NA 0x10 NA 0x00 0x10 0x00 0x12 0x00 0x18 0x00 0x19 0x00 0x27 0x00 0x25 0x0D NA 0x28 NA 0x29 NA 0x00 0x00 0x00 0x2A 0x0A NA 0x0B NA 0x00 0x2B 0x00 0x03 0x00 0x02 0x00 0x22 0x00 0x23 0x2B NA 0x00 0x26
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
J
J
I
I
I
I
I
I
Branch
Branch
Branch
Divide
Unsigned Divide
Jump to Address
Jump and Link
Jump to Address in Register
Load Byte
Multiply
Divide
if Equal
if Less Than or Equal to Zero
if Not Equal
(Exclusive-OR)
(NOT-OR)
Less Than
Less Than Unsigned
Load Byte Unsigned
Load Halfword
Load Halfword Unsigned
Load Upper Immediate
Load Word
Move from
Move from
Move from
Multiply
Unsigned Multiply
Bitwise NOR (NOT-OR)
Bitwise OR
Bitwise OR Immediate
0
Coprocessor
HI Register
LO Register
Bitwise AND Immediate ori Bitwise OR Immediate lui Load Upper Immediate
I
I
I
R
I
I
I
I
I
I
I
I
Store Byte
Store Halfword
Logical Shift Left
Set to 1 if Less Than
Set to 1 if Less Than
Set to 1 if Less Than
Set to 1 if Less Than
Arithmetic Shift Right (sign-extended)
Logical Shift Right (0-extended)
Subtract
Unsigned Subtract
Store Word
Bitwise XOR (Exclusive-OR)
Immediate
Unsigned Immediate I
Unsigned
R R R R R I R

BIN
010 0000 010 0001 010 0010 010 0011 010 0100 010 0101 010 0110 010 0111 010 1000 010 1001 010 1010 010 1011 010 1100 010 1101 010 1110 010 1111 011 0000 011 0001 011 0010 011 0011 011 0100 011 0101 011 0110 011 0111 011 1000 011 1001 011 1010 011 1011 011 1100 011 1101 011 1110 011 1111 100 0000 100 0001 100 0010 100 0011 100 0100 100 0101 100 0110 100 0111 100 1000 100 1001 100 1010 100 1011 100 1100 100 1101
40 32 20 413321 423422 433523 443624 453725 463826 473927 504028 514129 52422A 53432B 54442C 55452D 56462E 57472F 604830 614931 625032 635133 645234 655335 665436 675537 705638 715739 72583A 73593B 74603C 75613D 76623E 77633F
space 100 1110 116 78 4E N ! 100 1111 117 79 4F O ” 101 0000 120 80 50 P # 101 0001 121 81 51 Q $ 101 0010 122 82 52 R % 101 0011 123 83 53 S & 101 0100 124 84 54 T ‘ 101 0101 125 85 55 U ( 101 0110 126 86 56 V ) 101 0111 127 87 57 W * 101 1000 130 88 58 X + 101 1001 131 89 59 Y , 101 1010 132 90 5A Z – 101 1011 133 91 5B [ . 101 1100 134 92 5C \ / 101 1101 135 93 5D ]
0 101 1110 136 94 5E ^
1 101 1111 137 95 5F _
2 110 0000 140 96 60 `
3 110 0001 141 97 61 a
4 110 0010 142 98 62 b
5 110 0011 143 99 63 c
6 110 0100 144 100 64 d
7 110 0101 145 101 65 e
8 110 0110 146 102 66 f
9 110 0111 147 103 67 g
: 110 1000 150 104 68 h ; 110 1001 151 105 69 i < 110 1010 152 106 6A j = 110 1011 153 107 6B k > 110 1100 154 108 6C l ? 110 1101 155 109 6D m @ 110 1110 156 110 6E n
A 110 1111 157 111 6F o
B 111 0000 160 112 70 p
C 111 0001 161 113 71 q
D 111 0010 162 114 72 r
E 111 0011 163 115 73 s
F 111 0100 164 116 74 t
G 111 0101 165 117 75 u
H 111 0110 166 118 76 v
I 111 0111 167 119 77 w
J 111 1000 170 120 78 x
K 111 1001 171 121 79 y
L 111 1010 172 122 7A z
ASCII CODE ASCII CODE
OCT DEC HEX CHARACTER BIN OCT DEC HEX CHARACTER
100 64 40
101 65 41
102 66 42
103 67 43
104 68 44
105 69 45
106 70 46
107 71 47
110 72 48
111 73 49
112 74 4A
113 75 4B
114 76 4C
115 77 4D M

Figure 1
1
7
11
9
10
8
2
3
4
5
6
12

MIPS Instruction Types
R­type format: instr rd rs rt (shifts) instr rd rt shamt
I­type format: inst rt rs immediate inst rt immediate(rs)
J­type format: j immediate
opcode
rs
rt
rd
shamt
function
31:26
25:21
20:16
15:11
10:6
5:0
opcode
rs
rt
immediate
31:26
25:21
20:16
15:0
opcode
immediate
31:26
25:0
Figure 2
Register File
Instructions
SRL $t2 $t1 <1>
<2> $t2 ($t0)
<3> $t2 1($t0)
ADDI $t3 $t3 0x7FFFFFFE

A
x y z
B x
y
z
C x
y
z
D x
y z
Figure 3: Timing Diagrams