MIPS Flashcards
How long are MIPS addresses
32 bits
how long are mips instructions?
32 bits
How is a MIPS instruction held in memory?
Held in 4 consecutive memory locations
How many registers inside a mips?
32($0-$31)
What can arithmetic operations operate on?
Data read from registers
What is RISC based architecture?
“load and store”, only load and store instructions access memory, all other instructions access registers
Describe R-type instructions
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
Name the key difference between add and addu
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 do you calculate the memory address?
sum the displacement value given and the value stored inside the register.
If the displace read 0x0008 how many words is that
2 words displacement
What are I type instructions used for?
memory access instructions
instructions that require a constant value
branch instructions
consider I type
lw $20, 0x1234($5)
in what order will the op, rs, rt, and offset be
lw, 5, 20, 0x1234
Describe how lw instruction
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.
Describe how sw instruction
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].
What is an I type (immediate value)?
instead of off set, actual value is passed into instruction to be added or whatever to other register and store in register