Consider a program that declares global integer variables x, y, z[10] (z is an array with size 10). Assume that an integ

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Consider a program that declares global integer variables x, y, z[10] (z is an array with size 10). Assume that an integ

Post by answerhappygod »

Consider a program that declares global integer variables x, y,
z[10] (z is an
array with size 10). Assume that an integer occupies 4 bytes. These
variables
are allocated starting at a base address of decimal 2000. All these
variables
have been initialized to zero. The base address 2000 has been
placed in $gp.
The program executes the following assembly instructions:
lw $s1, 0($gp)
lw $s2, 4($gp)
addi $s1, $s1, 13
addi $s2, $s2, 17
sw $s1, 8($gp)
sw $s2, 12($gp)
sub $s2, $s2, $s1
sw $s2, 16($gp)
1. What are the memory addresses of variables x, y, z[0], z[1],
and
z[2]?
2. What are the values of variables x, y, z[0], z[1], and z[2]
at the end of the
program?
please help my assembly questions?
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply