New version page

# UTD CS 6363 - Assignment

Pages: 2
Documents in this Course

## This preview shows page 1 out of 2 pages.

View Full Document

End of preview. Want to read all 2 pages?

View Full Document
Unformatted text preview:

9/26/2017 Assignment_3ﬁle:///var/folders/jb/gp_rc7054lbfqxzmc73xdt0m0000gn/T/mume117826-97524-mvjb9i.v0gj5rk9.html 1/21. Carry out exercise 2.14, 2.17 and 2.23 of the textbook.Question2.14  <§§2.2, 2.5> Provide the type and assembly language instruction for the following binary Answer:Since the Op ﬁled is . So this is the Type R format. So binary value for each ﬁled are showedbelow: Op rs rt rd shamt funct Since the funct ﬁled and the Op ﬁled is and . So after we match with the table, we got that thisis an add instruction. Thus the operation for add instruction isR[rd]=R[rs]+R[rt] The actual instruction is:add \$s0,\$s0,\$s0 Question2.17  <§2.5> Provide the type, assembly language instruction, and binary representation ofinstruction described by the following MIPS ﬁelds:op=0x23, rs=1, rt=2,const=0x4 Answer:Type: I format op= rs=1(Assembler Temporary) rt=2(means \$ register) value: 0000,0010,0001,0000,1000,0000,0010,0000two000000= 000000= 10000 = =10hex1610= 10000 = =10hex1610= 10000 = =10hex1610= 00000= 100000 =20hexex20h0= 10,001123hexv09/26/2017 Assignment_3ﬁle:///var/folders/jb/gp_rc7054lbfqxzmc73xdt0m0000gn/T/mume117826-97524-mvjb9i.v0gj5rk9.html 2/2const Assembly language instruction:lw \$v0,4(\$at) Binary representation:op rs rt const100011 00001 00010 0000,0000,0000,0100Question2.23  <§2.7> Assume holds the value 0x00101000. What is the value of \$ after the followinginstructions? slt \$t2, \$0, \$t0 bne \$t2, \$0, ELSE j DONE ELSE: addi \$t2, \$t2, 2 DONE: Answer:Since for the ﬁrst step, we know that is larger than 0. So the ﬁrst step, .Since for the bne instruction, , so turn to ELSE to execute the . So ﬁnally, .2. Write a MIPS assembly language program thata) Prompt the user for an integer in the range of 0 to 50. If the user inputs 0 the program stops.b) Otherwise, the program stores the numbers from 0 up to the input value into an array of words inmemory, i.e. initializes the array with values from 0 up to N where N is the value that user has inputted.c) The program then adds the value of all items of the array together (up to N) by loading them from themain memory then add them up, then prints out the sum with the message "The sum of integers from 0to N is:". For example, if the user gave 5 as the input the program prints out "The sum of integers from0 to 5 is 15".Submit your work as a zip ﬁle as speciﬁed in the syllabus to eLearning by the due date.= = 0000,0000,0000,01004hex\$t0t2\$t0 =001010002\$t2 = 1\$t2 ≠ 0\$t2 = \$t2 + 2\$t2

View Full Document Unlocking...