MIPs Instruction Set Flashcards

1
Q

How can XOR be used in machine code?

A

To clear a register

XORing a number with itself results in zero.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What happens when you XOR a number with itself?

A

The result is zero

This is a property of the XOR operation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the effect of XORing a number twice?

A

You get the original number back again

This property can be useful in encryption schemes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the result of zero-extending a 16-bit immediate value?

A

The upper 16 bits contain all zeroes

This is relevant when working with immediate values in logical operations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the syntax for the AND immediate operation in MIPS?

A

andi $rt, $rs, immed

This operation performs a bitwise AND with an immediate value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the syntax for the OR immediate operation in MIPS?

A

ori $rt, $rs, immed

This operation performs a bitwise OR with an immediate value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the syntax for the XOR immediate operation in MIPS?

A

xori $rt, $rs, immed

This operation performs a bitwise XOR with an immediate value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What ae the 3 types of MIPs instructions?

A

R-Type
I-Type
J-Type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does a R-Type instruction refer to?

A

Register type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How many bits are in each & what does each mean?

A

op - 6 bits - Specifies the operation
rs - 5 bits - Address of the first operand
rt - 5 bits - Address of the second operand
rd - 5 bits - Address of the results destination
shamt - 5 bits - Shift amount
funct - 6 bits - Function code

R-Type instruction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How many operations can the opcode carry out in R-Type, I-Type, J-Type?

A

64 operations

6 bits = 2^6 = 64 operations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How many bits are in each & what does each mean?

A

op - 6 bits - opcode that specifies the operation
rs - 5 bits - register file address of the base address register
rt - 5 bits - register file address to receive result of the load
offset - 16 bits - Constant or address offset

I-Type instruction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How many bits are in eacg & what does each mean?

A

op - 6 bits - opcode that specifies the jump operation
address - 26 bits - target address

SSconcatenated with upper four bits of PC
and 00 appended to end

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does sll & srl mean?

A

Shift left & Shift right

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Why do we use sll & srl?

A

Used in multiplication & division

It’s much faster

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the output to a OR gate?

A

Must be atleast 1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is the output to a NOR gate?

A

Must be no 1s (Opposite of OR)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What type of gate is this?

A

AND Gate

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What bitwise operation is this?

______ $t0,$t1,$t2

A

OR

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What bitwise operation is this?

______ $t0,$t1,$t2

21
Q

What bitwise operation is this?

______ $t0,$t1,$t2

22
Q

What type of gate is this?

23
Q

What type of gate is this?

24
Q

What type of gate is this?

25
What is the output to a XOR gate?
## Footnote Must only be a single 1
26
What is the output to a AND gate?
## Footnote Must be all 1s
27
What bitwise operation is this? ## Footnote ______ $t0,$t1,$t2
AND
28
What does: bne $s0, $s1, Lbl mean?
Go to Lbl if $s0 != $s1 | Lbl: will be the start of the line to go to ## Footnote Branch if not equal
29
What does: beq $s0, $s1, Lbl mean?
Go to Lbl if $s0 = $s1 | Lbl: will be the start of the line to go to ## Footnote Branch if equal
30
What are Branches?
Conditional transfers of control Branch distance from the incremented PC value fits into the immediate field ## Footnote Includes loops and if statements
31
What does I-Type instruction refer to?
Immediate Type ## Footnote Includes branches
32
What does J-Type intruction refer to?
Jump Type ## Footnote Includes jumps
33
Name features of procedures?
Easier to understand and code reuse Function can be worked on without working on the main body of the code
34
What is the function of procedures?
Acquires resources, performs the tasks, covers tracks, return to the point of the origin with the desired result
35
What regisiters are allocated for procedure calling?
$a0 - $a3 $v0 - $v1 $ra
36
How are: $a0 - $a3 used in procedure calling?
Argument registers in which to pass parameters
37
How are: $v0 - $v1 used in procedure calling?
Value registers in which to return values
38
How are: $ra used in procedure calling?
Return address register to return to the point of origin
39
What is jal used in and what does it do?
Used in procedures Jumps and links instructions
40
What does: bne mean?
Branch if not equal ## Footnote Used in R-Type instruction
41
What does: beq mean?
Branch if equal ## Footnote Used in R-Type instruction
42
What does: blt mean?
Branch if less than ## Footnote Used in R-Type instruction
43
What does: ble mean?
Branch of less than or equal to ## Footnote Used in R-Type instruction
44
What does: bgt mean?
Branch if greater than ## Footnote Used in R-Type instruction
45
What does: bge mean?
Branch if greater than or equal to ## Footnote Used in R-Type instruction
46
What does: slt mean?
Set on less than ## Footnote Used in R-Type instruction
47
What does: slt $t0, $s0, $s1 mean?
if $s0 < $s1 then $t0 = 1 else $t0 = 0 ## Footnote Used in R-Type instruction
48
What is $zero
A constant
49
What does: j label do?
Jumps tot he nect instruction called label