

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Assignment No. 02 Semester: Spring 2020 CPEN- (CLO-1) Total Marks: 100 Due Date: 11/04/
Please read the following instructions carefully before submitting assignment: It should be clear that your assignment will not get any credit if: The assignment is submitted after due date. The assignment is submitted via email. The submitted assignment does not open or file is corrupt. All types of plagiarism are strictly prohibited.
Perform/write all steps Assignment
1- Convert following hexadecimal machine code into MIPS language
switch (k) { case 1: f = i+j+h; break; case 7: f = g+h+f; break; case 13: f = g–h-f; break; case 19: f = i–j+g; break; } Use this mapping: f: $s0 g: $s1 h: $s i: $s3 j: $s4 k: $s Hint: simplify by using if else and write the assembly code. 1- Consider the following fragment of C code: for (i=0; i<=100; i=i+1) { temp = b[i] + c; a[i]= temp+a[i]; } Assume that a and b are arrays of words and the base address of a is in $s0 and the base address of b is in $s1. Register $t0 is associated with variable i and register $s2 with c. Write the assembly code for MIPS. How many instructions are executed during the running of this code? How many memory data references will be made during execution? Deadline: Your assignment must be uploaded/submitted on or before 11th^ March, 2020