struct ProductionUnit { unsigned short yield; short id; bool active; }; ProductionUnit units[1000]; Convert to MIPS the

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

struct ProductionUnit { unsigned short yield; short id; bool active; }; ProductionUnit units[1000]; Convert to MIPS the

Post by answerhappygod »

struct ProductionUnit {unsigned short yield;short id;bool active; };
ProductionUnit units[1000];
Convert to MIPS the following piece of code:
for( int i{0}; i<1000; i++ )
if( units.active )
totalSum += units.yield;
The value of totalSum is already in $s7 and is alreadyinitialized to zero. The address of units is already loaded in $s0.All data members of ProductionUnit are stored in memory next toeach other (no padding) and in the same order in which they aredeclared.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply