MIPS Flashcards

(14 cards)

1
Q

What is the equivalent math operations for SLL & SLR?

A

Shifting n bits = multiplying/dividing by 2^n

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

What is AND usually used for?

A

Used for masking operation:

- Place 1s in interested positions. (Copying these bits)

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

What is XOR usually used for?

A

Toggling bits:

- Place 1s in interested positions to invert those bits.

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

What is NOR usually used for?

A

Toggling bits:

- Place 0s in interested positions to invert those bits.

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

What is ORI usually used for?

A

Loading 32-bits constants into a register:
lui the upper 16bits into register first
ori the lower 16bits into the register

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

What is the common technique for CONDITIONAL statements?

A

Invert the condition for shorter code:
E.g. if (i == j)
f = g + h;

bne i, j, exit
add f, g, h

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

What is the technique when dealing with WHILE loops?

A

while(j == k)
i = i + 1;

Rewrite as:
if (j != k) 
    goto Exit
i = i + 1;
goto Loop

bne j, k, Exit
addi i, i, 1
j Loop

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

How many instructions formats are there in MIPS?

A

3: R-format, I-format, J-format

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

How many fields are there in R-Format? What are they?

A

6 fields:

  1. opcode (6)
  2. rs (5)
  3. rt (5)
  4. rd (5)
  5. shamt (5)
  6. funct (6)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How many fields are there in I-Format? What are they?

A

4 fields:

  1. opcode (6)
  2. rs (5)
  3. rt (5)
  4. immediate (16)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the range of words that a conditional branch can reach?

A

+- 2^17

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

How many fields are there in J-Format? What are they?

A

2 fields:

  1. opcode (6)
  2. target address (26)
    - ignore the first 4 bits and last 2 bits of the address (32 - 4 - 2 = 26)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the range of words in a jump instruction?

A

256MB = 2^28

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

What is the difference between PC-relative addressing and Pseudo-direct addressing?

A

Jump uses pseudo-direct addressing where the 26bit of instruction is concatenated with the upper 4 bits of PC.

Conditional Branching uses PC-relative addressing where the resulting address is the sum of PC and constant in the instruction.

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