MIPS Flashcards

1
Q

How long are MIPS addresses

A

32 bits

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

how long are mips instructions?

A

32 bits

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

How is a MIPS instruction held in memory?

A

Held in 4 consecutive memory locations

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

How many registers inside a mips?

A

32($0-$31)

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

What can arithmetic operations operate on?

A

Data read from registers

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

What is RISC based architecture?

A

“load and store”, only load and store instructions access memory, all other instructions access registers

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

Describe R-type instructions

A

Register operands - all arithmetic
op = operation or type of the instruction
rs = first register argument (source)
rt = second register argument (source)
rd = result of the operation (destination)
shamt = shift amount (ignore at present)
funct = particular type of the operation

op always equal to zero, so funct describes what the instruction does

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

Name the key difference between add and addu

A

addu stands for add unsigned, add is assumed to be working with 2’s complement singed numbers

Real difference is that signed add “Throws interrupt” whenever overflow occurs for the signed operation

addu ignores the overflow

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

How do you calculate the memory address?

A

sum the displacement value given and the value stored inside the register.

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

If the displace read 0x0008 how many words is that

A

2 words displacement

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

What are I type instructions used for?

A

memory access instructions
instructions that require a constant value
branch instructions

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

consider I type
lw $20, 0x1234($5)
in what order will the op, rs, rt, and offset be

A

lw, 5, 20, 0x1234

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

Describe how lw instruction

A

lw $10, 0($x)
– copies the word from address Z into register $10.
– A high-level language view would be that array element Z[0] is
copied into register 10.

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

Describe how sw instruction

A

sw $10, 80($x)
– copies the value from register $10 into the memory location 20
word offsets from Z.
– A high-level language view would be that the contents of register
10 is copied into array element Z[20].

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

What is an I type (immediate value)?

A

instead of off set, actual value is passed into instruction to be added or whatever to other register and store in register

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

What is the offset when concerning a branch command?

A

the NUMBER of INSTRUCTIONS to branch over starting from the instruction following the branch
PC = PC+ 4 + 0xFFFFABCD * 4

17
Q

How do we store a 32 bit address in a register?

A

Use a load upper instruction and then use OR instruction with other half of immediate and store in the same register

18
Q

At what address is the executable code loaded from?

A

0x00400000, the text segment

19
Q

What is an assembly directive?

A

They tell the assembler what to do

20
Q

What are the two key directives

A

.data, .text, they are concerned with the way the assembly language program is laid out in memory

21
Q

Where is the data loaded at?

A

0x1001000, known as the dynamic data segment

22
Q

What is the .word directive do?

A

Its a data layout directive, it allows the assembly programmer to describe the data in a more natural way then binary,
in this case, the 32 bit words that follow are written into the dynamic data segment of the program
vals: .word 4, 5, 8, 0

23
Q

describe what the assembly directive .word 10,20,30 do?

A

Store 10,20,30 in successive memory locations as 32 bit words

24
Q

What is an assembly label?

A

A colon after a word indicates an address label, this is a symbolic representation of that address.
These can be used withing the assembly code and the assembler will put in the correct address values

25
Q

What does the assembly directive .globl do?

A

Tells the assembly that this is a global symbol, one which needs to accessed outside of the current assembly program, e.g. .globl main

26
Q

Describe the J-Type instruction

A

Consist of a 6 bit op and a 26 bit target, used to jump

27
Q

explain what the instruction j target does

A

jumps to target, multiplies the 26bit target by 4 and stores it in the 28 LSB in the program counter

28
Q

explain what the jal target instruction does

A

Jump and link target, stores the return address in the ra register, ie PC + 4 and then changes the program counter to the 28 bit target

29
Q

Describe a procedure being called using the jal and jr instructions

A

the jal instruction stores the return address of the line of code currently after the branch, i.e pc +4 .
The PC is then changed to the operand provided, after the procedure has run the code it needs to, the jr $ra instruction is called which stores the ra inside the PC