Question
1. Write the following instruction in Hex: ADDU $t0, $s4, $t3 2. Decode the following instruction: 0x36890010 3. Write the following instruction in Hex: ADDU
1. Write the following instruction in Hex: ADDU $t0, $s4, $t3
2. Decode the following instruction: 0x36890010
3. Write the following instruction in Hex: ADDU $s2, $s3, $t4
4. Decode the following instruction: 0x25b40005
ADD -- Add
Description: | Adds two registers and stores the result in a register |
Operation: | $d = $s + $t; advance_pc (4); |
Syntax: | add $d, $s, $t |
Encoding: | 0000 00ss ssstttttdddd d000 0010 0000 |
ADDI -- Add immediate (with overflow)
Description: | Adds a register and a sign-extended immediate value and stores the result in a register |
Operation: | $t = $s + imm; advance_pc (4); |
Syntax: | addi $t, $s, imm |
Encoding: | 0010 00ss ssstttttiiiiiiiiiiiiiiii |
ADDIU -- Add immediate unsigned (no overflow)
Description: | Adds a register and a sign-extended immediate value and stores the result in a register |
Operation: | $t = $s + imm; advance_pc (4); |
Syntax: | addiu $t, $s, imm |
Encoding: | 0010 01ss ssstttttiiiiiiiiiiiiiiii |
ADDU -- Add unsigned (no overflow)
Description: | Adds two registers and stores the result in a register |
Operation: | $d = $s + $t; advance_pc (4); |
Syntax: | addu $d, $s, $t |
Encoding: | 0000 00ss ssstttttdddd d000 0010 0001 |
AND -- Bitwise and
Description: | Bitwise ands two registers and stores the result in a register |
Operation: | $d = $s & $t; advance_pc (4); |
Syntax: | and $d, $s, $t |
Encoding: | 0000 00ss ssstttttdddd d000 0010 0100 |
ANDI -- Bitwise and immediate
Description: | Bitwise ands a register and an immediate value and stores the result in a register |
Operation: | $t = $s &imm; advance_pc (4); |
Syntax: | andi $t, $s, imm |
Encoding: | 0011 00ss ssstttttiiiiiiiiiiiiiiii |
OR -- Bitwise or
Description: | Bitwise logical ors two registers and stores the result in a register |
Operation: | $d = $s | $t; advance_pc (4); |
Syntax: | or $d, $s, $t |
Encoding: | 0000 00ss ssstttttdddd d000 0010 0101 |
ORI -- Bitwise or immediate
Description: | Bitwise ors a register and an immediate value and stores the result in a register |
Operation: | $t = $s | imm; advance_pc (4); |
Syntax: | ori $t, $s, imm |
Encoding: | 0011 01ss ssstttttiiiiiiiiiiiiiiii |
SB -- Store byte
Description: | The least significant byte of $t is stored at the specified address. |
Operation: | MEM[$s + offset] = (0xff & $t); advance_pc (4); |
Syntax: | sb $t, offset($s) |
Encoding: | 1010 00ss ssstttttiiiiiiiiiiiiiiii |
SLL -- Shift left logical
Description: | Shifts a register value left by the shift amount listed in the instruction and places the result in a third register. Zeroes are shifted in. |
Operation: | $d = $t << h; advance_pc (4); |
Syntax: | sll $d, $t, h |
Encoding: | 0000 00ss ssstttttdddddhhh hh00 0000 |
SLT -- Set on less than (signed)
Description: | If $s is less than $t, $d is set to one. It gets zero otherwise. |
Operation: | if $s < $t $d = 1; advance_pc (4); else $d = 0; advance_pc (4); |
Syntax: | slt $d, $s, $t |
Encoding: | 0000 00ss ssstttttdddd d000 0010 1010 |
SLTI -- Set on less than immediate (signed)
Description: | If $s is less than immediate, $t is set to one. It gets zero otherwise. |
Operation: | if $s |
Syntax: | slti $t, $s, imm |
Encoding: | 0010 10ss ssstttttiiiiiiiiiiiiiiii |
SLTU -- Set on less than unsigned
Description: | If $s is less than $t, $d is set to one. It gets zero otherwise. |
Operation: | if $s < $t $d = 1; advance_pc (4); else $d = 0; advance_pc (4); |
Syntax: | sltu $d, $s, $t |
Encoding: | 0000 00ss ssstttttdddd d000 0010 1011 |
SRL -- Shift right logical
Description: | Shifts a register value right by the shift amount (shamt) and places the value in the destination register. Zeroes are shifted in. |
Operation: | $d = $t >> h; advance_pc (4); |
Syntax: | srl $d, $t, h |
Encoding: | 0000 00-- ---t ttttdddddhhh hh00 0010 |
SUB -- Subtract
Description: | Subtracts two registers and stores the result in a register |
Operation: | $d = $s - $t; advance_pc (4); |
Syntax: | sub $d, $s, $t |
Encoding: | 0000 00ss ssstttttdddd d000 0010 0010 |
SW -- Store word
Description: | The contents of $t is stored at the specified address. |
Operation: | MEM[$s + offset] = $t; advance_pc (4); |
Syntax: | sw $t, offset($s) |
Encoding: | 1010 11ss ssstttttiiiiiiiiiiiiiiii |
Name | Register Number | Usage | Preserved by callee? |
$zero | 0 | hardwired 0 | N/A |
$v0-$v1 | 2-3 | return value and expression evaluation | no |
$a0-$a3 | 4-7 | arguments | no |
$t0-$t7 | 8-15 | temporary values | no |
$s0-$s7 | 16-23 | saved values | YES |
$t8-$t9 | 24-25 | more temporary values | no |
$gp | 28 | global pointer | YES |
$sp | 29 | stack pointer | YES |
$fp | 30 | frame pointer | YES |
$ra | 31 | return address | YES |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started