5.4. Lw, Sw Load And Store Instructions

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 6

Download5.4. Lw, Sw Load And Store Instructions
Open PDF In BrowserView PDF
1/3/2019

5.4. lw, sw: Load and store instructions

5.4 lw, sw: Load and store instructions
Load instruction: lw
A load instruction copies data from memory into a register. A MIPS load instruction format is shown below. Another sectio
reason for the 0( ) around the memory-address.
lw register 0(memory-address)

MIPS register names start with a $. MIPSzy supports 8 registers. Writeable registers are $t0, $t1, ..., $t6. A special $zero reg
the value 0 and can only be read, not written.
The load instruction's memory-address is a register whose value is the memory address from which data is copied.

Load word
lw is short for "load word", in contrast to just loading a byte (a word is four bytes)

PARTICIPATION
ACTIVITY

5.4.1: Load instruction: lw.

1) If $t6's value is 2020, what is the
memory address for the following
instruction?
lw $t0, 0($t6)

Check

Show answer

https://learn.zybooks.com/zybook/FIUCDA3103CickovskiFall2018/chapter/5/section/4

1/6

1/3/2019

5.4. lw, sw: Load and store instructions

2) Given the following register le and
memory contents, what value is loaded
into register $t3 by the following
instruction?
lw $t3, 0($t6)

Check

Show answer

3) Given the following register le,
complete the load instruction to load
register $t2 with data at memory
address 5012.

https://learn.zybooks.com/zybook/FIUCDA3103CickovskiFall2018/chapter/5/section/4

2/6

1/3/2019

5.4. lw, sw: Load and store instructions

lw $t2, 0(

Check

)
Show answer

4) Assuming $t5 holds 6000, write a load
instruction that loads register $t4 with
data at memory address 6000.

Check

Show answer

Store instruction: sw
A store instruction copies data from a register to memory. A MIPS store instruction format is shown below. Another sectio
reason for the 0( ) around the memory-address.
sw register 0(memory-address)

PARTICIPATION
ACTIVITY

5.4.2: Store instruction: sw.

1) Assuming $t6 holds 600 and $t0 holds
5008, what is the memory address for
https://learn.zybooks.com/zybook/FIUCDA3103CickovskiFall2018/chapter/5/section/4

3/6

1/3/2019

5.4. lw, sw: Load and store instructions

the following instruction?
sw $t6, 0($t0)

Check

Show answer

2) Given $t2 holds 6200, $t3 holds 536,
and $t4 holds 616, what value is stored
into memory?
sw $t3, 0($t2)

Check

Show answer

3) Given the following register le,
complete the store instruction to store
register $t2's value into memory at
address 5000.

sw

, 0($t4)

Check

Show answer

https://learn.zybooks.com/zybook/FIUCDA3103CickovskiFall2018/chapter/5/section/4

4/6

1/3/2019

Check

5.4. lw, sw: Load and store instructions

Show answer

4) Assuming $t0 holds 5400 and $t1 holds
280, write a store instruction that stores
register $t1's value into memory at
address 5400.

Check

Show answer

Instruction format summary: lw, sw
The condensed instruction format below speci es all registers using $ followed by a single character. Ex: $a.

Table 5.4.1: Instruction summary: lw, sw.
Instruction

Format

Description

Example

lw

lw $a, 0($b)

Load word: Copies data from memory at
address $b to register $a.

lw $t3, 0($t6)

sw

sw $a, 0($b)

Store word: Copies data from register $a to
memory at address $b.

sw $t1, 0($t3)

CHALLENGE
ACTIVITY

5.4.1: Load and store instructions.

Start

Compute: $t6 = DM[5192]
https://learn.zybooks.com/zybook/FIUCDA3103CickovskiFall2018/chapter/5/section/4

1

2

5/6

1/3/2019

5.4. lw, sw: Load and store instructions

lw

$t5

, 0( $t5

Registers

)

5192
0

$t5
$t6

1
Check



2

Data memory
8

5192

3

3

Next

Provide feedback on this section

https://learn.zybooks.com/zybook/FIUCDA3103CickovskiFall2018/chapter/5/section/4

6/6



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.4
Linearized                      : No
Page Count                      : 6
Creator                         : Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
Producer                        : Skia/PDF m71
Create Date                     : 2019:01:03 18:17:32+00:00
Modify Date                     : 2019:01:03 18:17:32+00:00
EXIF Metadata provided by EXIF.tools

Navigation menu