# Homework Solution: Show all parts…

Show all parts Q1) Write an IAS program to compute the results of the following equation:  Q2) machine code instruction to transfer absolute value of 5 1. Write an IAS program to compute the results of the following equation: Y = 1+3+5+7+9 We have loaded the numbers into memory for you, Each integer takes up an entire 40-bit word, but each instruction plus its operand take up only 20 bits, so we have a left and right instruction per 40-bit memory location. and the value of Y into location 5 Assume when you begin that your constants are stored in order in memory locations 0, 1, 2, 3, and 4. Use memory location 5 for Y, which is initialized to 0. Your job is to fill in the table with the instructions needed to complete the task. Add each integer successively to the accumulator (referred to by the register name AC"). Assume the accumulator starts with the value 0 Store your instructions beginning in memory location6 left instruction (20 bits) right instruction (20 bits) 20 28 opcode (8 bits) address (12 bits) opcode (8 bits) address (12 bits) (b) Instruction word Remember that you have TWO instructions per word when it's used to store instructions (a so-called "instruction word"), each 20 bits, comprising 8 bits of opcode and 12 bits of operand. The system divides up instruction words into Left and Right positions, so 10L represents the left 20 bits. It is read first, then 10R, then 11L and 11R and so on. To terminate the program, use a Jump command, but jump back to your own

1. We will calculate as sum of odd number upto 5 terms using Arthimetic Progression

Show every parts

Q1) Write an IAS program to abinterpretation the results of the subjoined equation:  Q2) channel method counsel to transmit irresponsible rate of 5 1. Write an IAS program to abinterpretation the results of the subjoined equation: Y = 1+3+5+7+9 We keep loaded the bulk into recollection coercion you, Each integer interpretations up an all 40-bit account, beside each counsel plus its operand interpretation up merely 20 bits, so we keep a left and equiconsideration counsel per 40-bit recollection colony. and the rate of Y into colony 5 Assume when you inaugurate that your constants are provisiond in ordain in recollection colonys 0, 1, 2, 3, and 4. Interpretation recollection colony 5 coercion Y, which is initialized to 0. Your undertaking is to provision in the consideration with the counsels needed to accomplished the labor. Add each integer successively to the accumulator (referred to by the record designate AC”). Assume the accumulator starts with the rate 0 Provision your counsels inauguratening in recollection colony6 left counsel (20 bits) equiconsideration counsel (20 bits) 20 28 opmethod (8 bits) harangue (12 bits) opmethod (8 bits) harangue (12 bits) (b) Counsel account Remember that you keep TWO counsels per account when it’s interpretationd to provision counsels (a so-called “counsel account”), each 20 bits, comprising 8 bits of opmethod and 12 bits of operand. The arrangement divides up counsel accounts into Left and Equiconsideration positions, so 10L represents the left 20 bits. It is learn chief, then 10R, then 11L and 11R and so on. To close the program, interpretation a Skip straightforward, beside skip tail to your own

1. We obtain investigate as blend of uneven enumerate upto 5 terms

using Arthimetic Progression

last_term=1+(n-1)*2

last_term=2*n-1

Sum=(n*(first_term+last_term))/2

sum=n*(1+2*n-1)/2

sum=n*n

Location Instruction/Value Comments 6 5 Storing n=5 in harangue colony 7L LOAD M(6) Loading n in AC 7R MULM(6) Multiplying with n in AC coercion n*n 8L STOR M(5) AC-> Y 8R JUMP M(8,20;39) Done ;Halt

Second Method externally using straightforward equation

Location Instruction/value Comment 7L LOAD M(0) AC=1 7R ADD M(1) AC=1+M(1)=1+3=4 8R ADD M(2) AC=AC+M(2)=4+5=9 9L ADD M(3) AC=AC+M(3)=9+7=16 9R ADD M(4) AC=AC+M(4)=16+9=25 10L STOR M(5) AC->Y 10R JUMP M(10,20:39) Done;Halt

2.Channel method counsel – LOAD DIRECT 5