Answered step by step
Verified Expert Solution
Question
1 Approved Answer
What does the offset do in MIPS? I don't understand what is happening here or why it is important? Loading and Storing Bytes MIPS provides
What does the offset do in MIPS? I don't understand what is happening here or why it is important?
Loading and Storing Bytes MIPS provides special instructions to move bytes lb $t0, 1($s3) #load byte from memory sb $t0, 6 ($s3) #store byte to memory 0x28 | 19 | 8 1 6 bit offset What 8 bits get loaded and stored? load byte places the byte from memory in the rightmost 8 bits of the destination register what happens to the other bits in the register? store byte takes the byte from the rightmost 8 bits of a register and writes it to a byte in memory what happens to the other bits in the memory word? Memory Operand Example 1 C code: g = h + A[8]; . g in $81, h in $s2, base address of A in $s3 Compiled MIPS code: - Index 8 requires offset of 32 4 bytes per word lw $t0, 32($s3) # load word add $81,$s2,1 $t0 offset base register Loading and Storing Bytes MIPS provides special instructions to move bytes lb $t0, 1($s3) #load byte from memory sb $t0, 6 ($s3) #store byte to memory 0x28 | 19 | 8 1 6 bit offset What 8 bits get loaded and stored? load byte places the byte from memory in the rightmost 8 bits of the destination register what happens to the other bits in the register? store byte takes the byte from the rightmost 8 bits of a register and writes it to a byte in memory what happens to the other bits in the memory word? Memory Operand Example 1 C code: g = h + A[8]; . g in $81, h in $s2, base address of A in $s3 Compiled MIPS code: - Index 8 requires offset of 32 4 bytes per word lw $t0, 32($s3) # load word add $81,$s2,1 $t0 offset base registerStep 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