MIPS Items Flashcards

1
Q

CPU Instruction

A

binary pattern of 0’s and 1’s.

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

Instruction Set (ISA)

A

the vocabulary of commands understood by a given architecture

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

CPU arch

A

collection of general specifications that CPU follows

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

Specification about CPU Architecture

A

instruction set, number and size of registers, word size, address size and etc.

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

Assembly Language

A

a symbolic representation of machine instruction
Requires programmer to write one line for every instruction that the computer will follow

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

What are the main properties of assembly languages?

A
  1. closely represent CPU instructions
  2. Assembly languages are architecture specific
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

List ex of Assembly Lang

A

MIPS for some old classic CPUs
x86 for Intel-style CPUs
ARM 8 for smartphone CPUs

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

What are pseudo-instructions

A

structions do not directly correspond to a single machine instruction in the MIPS instruction set

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

How many general-purpose registers do MIPS CPU have

A

32 general purpose register
each register is 4 bytes (word)

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

Can a register store nothing at all? Can some bits in a register store nothing at all?

A

NO a register cannot hold nothing even a pattern of all zero’s is still storing something

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

Name some MIPS general purpose registers.

A

$s0 - $s7, $t0 - $t7, $zero

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

What is stored in the register $zero? Are we allowed to change it’s content?

A

Constant value - and you are NOT allowed to change it

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

Immediate value in ADDI

A

Constant

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

Where is a variable stored?

A

IN RAM

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

What is loading the register?

A

Copying word of data from RAM to CPU register

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

SW

A

Copies the data from a register to memory.

17
Q

Endianess. Big-endian and little-endian.

A

Computers either use the address of the leftmost or “big end” byte as the word address and those that use the rightmost or “little end” byte. MIPS uses big-endian.

18
Q

What should we do to use the value of a variable?

A

load it from RAM to register

19
Q

2’s complement representation of signed integers.

A

PRACTICE

20
Q

Unsigned integer representation.

A

Practice

21
Q

Know how to determine numeric limits for both 2’s complement and unsigned representations when given the number of bits.

A

General Range for n-bit Unsigned Integer:
0 - (2^n)-1
ex: 8 bits
0 - 255

2’s Complement:
Minimum value: -2^(n-1)
Maximum Value: 2^(n-1)-1
ex: 8 bits
-128 - 127

22
Q

How do we specify memory address in loading and storing instructions?

A

offset($baseRegister)

23
Q

What is the difference between lh and lhu, between lb and lbu?

A

Sign-extends

24
Q

Why we don’t need separate signed and unsigned versions for storing instructions.

A

copying the bit pattern from a register to a memory location.

25
Q

Converting 2’s Complement to Decimal

A

1.) Invert the bits
1111 1111 1111 1111 1111 1111 1111 0011
0000 0000 0000 0000 0000 0000 0000 1100
2.) ADD +1
0000 0000 0000 0000 0000 0000 0000 1100
0000 0000 0000 0000 0000 0000 0000 1101
3.) Convert to Decimal
-13

26
Q

Does label exist as a separate item in the compiled program code?

A

No

27
Q

j instruction. Label

A

label marks an instruction in the program code

28
Q

What does label turn into in the compiled program code?

A

it turns to an address of the labeled instruction in RAM

29
Q

Instructions beq and bne

A

beq register1, register2, L1 if ==
bne register1, register2, L1 if !=

30
Q

What unconditional jumps do you know

A

J label

31
Q

Instructions slt, slti, sltu, sltiu.

A

slt $t0, $s3, $s4 $t0 = 1 if $s3 < $s4

slti $t0, $s2, 10 $t0 = 1 if $s2 < 10

sltu (set on less than unsigned)

sltiu (set on less than immediate unsigned)

32
Q

Be able to give an example of two parameters in form of bit patterns that produce different results in slt and sltu.

A

$t0 = 0xFFFFFFF3 is interpreted as -13
$t1 = 0x00000005 is interpreted as 5
slt $t2, $t0, $t1 # $t2 = 1 (SIGNED comparison -13<5)
versus unisgned
sltu $t2, $t0, $t1 # $t2 = 0 (huge number !<5 )

33
Q

Be ready to implement common C++ statements like for, while, do-while, if-else, switch in MIPS. You should be able to preserve C++ behavior of those statements completely.

A

PRACTICE

34
Q
A
35
Q

Negative to binary

A

Ex: -53

52:
110100

Subtract from
1111 1111
00 11 0100

To get
1100 1011