MIPs Architecture Flashcards

1
Q

What is the purpose of data transfer instructions in MIPS?

A

To transfer data between memory and registers

Includes load and store instructions

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

What does the load instruction do?

A

Copies data from memory

In MIPS, represented as ‘lw’

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

What does the store instruction do?

A

Copies data to memory

In MIPS, represented as ‘sw’

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

What is the MIPS format for loading a word?

A

lw = load word

Used to read a 32-bit word from memory

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

What is the MIPS format for storing a word?

A

sw = store word

Used to write a 32-bit word to memory

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

Where do arithmetic operands occur in MIPS?

A

Only on registers

Memory operands are accessed differently

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

How is the memory address computed for reading and writing?

A

Base address + offset

Base from a register, offset as an integer

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

What is the MIPS instruction:
lw $t1, 8($t2)
mean?

A

Loads a word into $t1 from [$t2 + 8] in memory

Means $t1 := Memory[$t2 + 8]

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

What is the MIPS instruction:
sw $t1, 4($t2)
mean?

A

Stores a word into $t1 from [$t2 + 4] in memory

Means Memory[$t2 + 4] := $t1

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

How does byte addressing affect array indexing in memory?

A

Offset must be multiplied by the size of the data type

For example, to access A[8], offset is 4 x 8 = 32

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

What is the MIPS code for the C statement A[12] = h + A[8];?

A

lw $t0, 32($s3)
add $t0, $s2, $t0
sw $t0, 48($s3)

32 = 8x4 & 48=12x4

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

What is the order of operands in load word and store word instructions?

A

Load word has destination first, store word has destination last

Example: lw $t1, 8($t2) vs sw $t1, 4($t2)

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

Can arithmetic operations be performed directly on memory in MIPS?

A

No, arithmetic operands must be in registers

Example of invalid operation: add 48($s3), $s2, 32($s3)

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

What does the instruction:
add $s1, $s2, $s3
do?

A

$s1 = $s2 + $s3

Performs addition of values in registers

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

What does the instruction:
sub $s1, $s2, $s3
do?

A

$s1 = $s2 - $s3

Performs subtraction of values in registers

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

What does the instruction:
lw $s1, 100($s2)
do?

A

$s1 = Memory[$s2 + 100]

Loads a word from memory into $s1

17
Q

What does the instruction:
sw $s1, 100($s2)
do?

A

Memory[$s2 + 100] = $s1

Stores the value from $s1 into memory

18
Q

What are the five stages of instruction execution?

A

Stage 1: Instruction Fetch
Stage 2: Instruction Decode
Stage 3: ALU (Arithmetic-Logic Unit)
Stage 4: Memory Access
Stage 5: Register Write

19
Q

At what stage do we increment the PC?

A

Stage 1: Instruction Fetch

20
Q

What does the PC do?

A

It will point to the next instruction
PC = PC + 4

4 Bytes = 32 bits (1 instruction)

21
Q

What is a word in MIPs?

A

32 bits or 4 bytes

22
Q

What do we call the first 6 bits?

A

The opcode

23
Q

What does the opcode determine?

A

The instruction type and field lengths

24
Q

What inputs and outputs does ALU have?

A

2x32 bit inputs
1x32 bit output

25
What is the signal size in ALU if the result is 0?
1 bit signal
26
How many bits are used to determine the operation?
4 bits
27
Describe the stages when carrying out: add $r3, $r1, $r2
Stage 1: fetch this instruction, increment PC Stage 2: decode to determine it is an add, then read registers $r1 and $r2 Stage 3: add the two values retrieved in Stage 2 Stage 4: idle (nothing to write to memory) Stage 5: write result of Stage 3 into register $r3 ## Footnote r3 = r1+r2
28
What happens during the 4th stage if there is nothing to write into memory? ## Footnote 4th stage = Memory acces
The stage is idle
29
What is the use of the control unit?
Controls the components of the datapath to implement the fetch, decode and execute cycle
30
Where does the control unit send signals?
Multiplexors – buses to select Register – load new value ALU – operation to perform ALL – provides Clock Signal