jj

.pdf

School

Arizona State University, Tempe *

*We aren’t endorsed by this school

Course

230

Subject

Computer Science

Date

Feb 20, 2024

Type

pdf

Pages

9

Uploaded by MinisterRat3615

Report
1/26/24, 11:40 PM Section 12.12 - CSE 230: Computer Organization & Assembly Language | zyBooks https://learn.zybooks.com/zybook/2024Spring-T-CSE230-21671/chapter/12/section/12 1/9 Students: This content is controlled by your instructor, and is not zyBooks content. Direct questions or concerns about this content to your instructor. If you have any technical issues with the zyLab submission system, use the Trouble with lab button at the bottom of the lab. Students: Section 12.12 is a part of 1 assignment: Zylab 1 - ALU and Data Transfer Instructions Requirements: zyLab 12.12 Zylab 1 - ALU and Data Transfer Instructions Given an array of 2 integers, write a MIPS program to implement some ALU operations and store the results back to memory. The C code below shows how the elements are appended to the array: // Declaration of variables int* A; // Integer array A with the base address pointing to variable A int a; char b, c; short d; // Append array elements { A[2], A[4] } = A[1] * A[0]; // {} = concatenation / append. 64-bit product should be stored in Array A[5] = A[4] / 230; a = A[4] % 230; b = a >> 16; // '>>' = right shift c = (a & 0b'1000) | (b | 0b'0011); // '&' = bit-wise and d = a << 2; // '<<' = left shift
1/26/24, 11:40 PM Section 12.12 - CSE 230: Computer Organization & Assembly Language | zyBooks https://learn.zybooks.com/zybook/2024Spring-T-CSE230-21671/chapter/12/section/12 2/9 A[6] = {b, c, d}; // {} = concatenation / append. Use Memory Operations (identify the correct address to place, c and d in Array) A[3] = (A[0] + A[1] - 100) - (A[2] + A[4] - A[5]); Registers Variables $s0 A Addresses Contents $s0 A[0] $s0+4 A[1] You may use any temporary registers from $t0 to $t9 or saved registers from $s1 to $s7. Clearly specify your choice of registers and explain your code using comments (1 points). Example Test: If the value of $s0 and Memory are initialized in the simulator as below: (Use the '+' button under the Registers display to initialize register values for $s0 and the '+' button under the Memory display to initialize the ±rst two array elements. ) Registers Data $s0 8016 Addresses Contents 8016 -5 8020 8 The resultant array is:
1/26/24, 11:40 PM Section 12.12 - CSE 230: Computer Organization & Assembly Language | zyBooks https://learn.zybooks.com/zybook/2024Spring-T-CSE230-21671/chapter/12/section/12 3/9 Addresses Contents 8016 -5 8020 8 8024 7 8028 -64 8032 -40 8036 0 8040 -160 Note: Only the register $s0 and the 6' elements in memory will be checked by the automated tests. Grading: 4 automated tests worth 1 points each. Manual check for comments worth 1 point. Manual score will be added after the deadline. Submission Attempts: You will have limited number of submissions (5), i.e., only 5 attempts to compare with the automated tests, but you can run the simulator any number of times without clicking on submit for grading. 543330.2714138.qx3zqy7 LAB ACTIVITY 12.12.1: Zylab 1 - ALU and Data Transfer Instructions 0 / 5 Load default template...
1/26/24, 11:40 PM Section 12.12 - CSE 230: Computer Organization & Assembly Language | zyBooks https://learn.zybooks.com/zybook/2024Spring-T-CSE230-21671/chapter/12/section/12 4/9 3 submissions left Coding trail of your work 1/25 R -------------------------------------------------- F ------ Latest submission - 11:39 PM MST on 01/26/24 Total score: 0 / 5 ENTER SIMULATION STEP RUN More options Run speed Instant RESET TO INITIAL Assembly sll $ t8 , $ t4 , 2 # Shift left lo sh $ t8 , 30( $ s0 ) # Store the res lw $ t0 , 16( $ s0 ) # Load A[2] lw $ t1 , 20( $ s0 ) # Load A[4] lw $ t2 , 24( $ s0 ) # Load A[5] add $ t0 , $ t0 , $ t1 # A[2] + A[4] sub $ t0 , $ t0 , $ t2 # Subtract A[5 sub $ t9 , $ t9 , $ t0 # Final subtra sw $ t9 , 12( $ s0 ) # Store the re Registers $s0 8016 + Memory 8016 -5 8020 8 + Submit for grading What is this? Line 33 Line 34 Line 35 Line 36 Line 37 Line 38 Line 39 Line 40 Line 41 Line 42 Line 43 Line 44 Line 45
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help