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...
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
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
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 5/9 Only show failing tests 1:Compare storage 0 / 1 Initial storage sters $s0 4000 mory 4000 4 4004 5 Resulting storage Yours Registers $s0 4000 $t0 20 $t1 0 $t2 0 $t3 0 $t4 0 $t5 0 $t6 3 $t7 3 $t8 0 $t9 -11 Memory 4000 4 4004 5 4012 -11 4016 20 4020 0 4024 0 Graded Yours Expecte Registers $s0 4000 4000 Memory 4000 4 4 4004 5 5 4012 -11 -111 4016 20 20 4020 0 0 4024 0 196688 4008 0 Download this submission
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 6/9 4028 768 2:Compare storage 0 / 1 Initial storage $s0 13804 13804 -8 13808 -4 Resulting storage Yours Registers $s0 13804 $t0 20 $t1 -12 $t2 0 $t3 0 $t4 -12 $t5 65535 $t6 65535 $t7 65535 $t8 -48 $t9 -32 Memory 13804 -8 13808 -4 13816 -32 13820 32 13824 -12 13828 0 Graded Yours Ex Registers $s0 13804 1 Memory 13804 -8 13808 -4 13816 -32 13820 32 13824 -12 13828 0 19 13812
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
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 7/9 13832 -3080193 3:Compare storage 0 / 1 Initial storage ers $s0 8016 ry 8016 -5 8020 8 Resulting storage Yours Registers $s0 8016 $t0 -33 $t1 7 $t2 0 $t3 0 $t4 7 $t5 0 $t6 3 $t7 3 $t8 28 $t9 36 Memory 8016 -5 8020 8 8028 36 8032 -40 8036 7 8040 0 Graded Yours Expec Registers $s0 8016 801 Memory 8016 -5 -5 8020 8 8 8028 36 -64 8032 -40 -40 8036 7 0 8040 0 -16 8024 7
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 8/9 8044 1835776 4:Compare storage 0 / 1 Initial storage ers $s0 2304 ry 2304 5 2308 -8 Resulting storage Yours Registers $s0 2304 $t0 -36 $t1 4 $t2 0 $t3 0 $t4 4 $t5 0 $t6 3 $t7 3 $t8 16 $t9 33 Memory 2304 5 2308 -8 2316 33 2320 -40 2324 4 2328 0 Graded Yours Expec Registers $s0 2304 230 Memory 2304 5 5 2308 -8 -8 2316 33 -67 2320 -40 -40 2324 4 0 2328 0 -16 2312 4
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 9/9 Activity summary for assignment: Zylab 1 - ALU and Data Transfer Instructions 0 % 0 % submitted to canvas 2332 1049344 5:Manual score 0 / 1 Comments Your instructor hasn't graded this test yet. Previous submissions 10:43 PM on 1/26/24 0 / 4 View Trouble with lab? Completion details
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