Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

State whether the following translations for the givenpseudo-instructions are va

ID: 3608495 • Letter: S

Question

State whether the following translations for the givenpseudo-instructions are valid or not?

Pseudo-Instruction Translation Valid/Invalid move $rt, $rs addi $rt, $rs, $0 <$rt := $rs>


li $rs, small    addi $rs, $0,small <$rs[15..0] := small>

li $rs, big    lui$rs, upper(big) <$rs := big> ori $rs, $rs,lower(big)
Note: small represents a 16-bit number and big represents a32-bit number. The function upper(big) represents the upper 16-bits of a 32-bitvalue and lower(big) represents the lower 16-bits of a 32-bit value.

i m assuming their all valid? State whether the following translations for the givenpseudo-instructions are valid or not?

Pseudo-Instruction Translation Valid/Invalid move $rt, $rs addi $rt, $rs, $0 <$rt := $rs>


li $rs, small    addi $rs, $0,small <$rs[15..0] := small>

li $rs, big    lui$rs, upper(big) <$rs := big> ori $rs, $rs,lower(big)
Note: small represents a 16-bit number and big represents a32-bit number. The function upper(big) represents the upper 16-bits of a 32-bitvalue and lower(big) represents the lower 16-bits of a 32-bit value.

i m assuming their all valid?

Explanation / Answer

I'm not sure about the first one. The addi instruction takes two registers and animmediate (constant). It's true that $0 has a value of b0,but it's only five bits long, whereas the immediate should befifteen. The assembler could probably figure it out, but ifit was me, I'd just use: add $rt, $rs,$0 (or add $rt, $0, $rs ) The other two look good.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote