Homework Solution: Show all parts…

    Show all parts Q1) Write an IAS program to compute the results of the following equation: 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 its 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 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

    Expert Answer

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

    Show integral parts

    Q1) Write an IAS program to prize the results of the aftercited equation:

    1. Write an IAS program to prize the results of the aftercited equation: Y = 1+3+5+7+9 We keep loaded the bulk into retention control you, Each integer conducts up an whole 40-bit expression, beside each counsel plus its operand conduct up solely 20 bits, so we keep a left and equiconsultation counsel per 40-bit retention subsidence. and the prize of Y into subsidence 5 Assume when you start that your constants are fundd in ordain in retention subsidences 0, 1, 2, 3, and 4. Explanation retention subsidence 5 control Y, which is initialized to 0. Your lesson is to appoint in the consultation with the counsels needed to thorough the undertaking. Add each integer successively to the accumulator (referred to by the record designate AC). Assume the accumulator starts with the prize 0 Fund your counsels startning in retention subsidence6 left counsel (20 bits) equiconsultation counsel (20 bits) 20 28 opadjudication (8 bits) harangue (12 bits) opadjudication (8 bits) harangue (12 bits) (b) Counsel expression Remember that you keep TWO counsels per expression when its explanationd to fund counsels (a so-called counsel expression), each 20 bits, comprising 8 bits of opadjudication and 12 bits of operand. The classify divides up counsel expressions into Left and Equiconsultation positions, so 10L represents the left 20 bits. It is discover primary, then 10R, then 11L and 11R and so on. To limit the program, explanation a Bound trodden, beside bound end to your own

    Q2) agent adjudication counsel to transmit irresponsible prize of 5

    1. Write an IAS program to prize the results of the aftercited equation: Y = 1+3+5+7+9 We keep loaded the bulk into retention control you, Each integer conducts up an whole 40-bit expression, beside each counsel plus its operand conduct up solely 20 bits, so we keep a left and equiconsultation counsel per 40-bit retention subsidence. and the prize of Y into subsidence 5 Assume when you start that your constants are fundd in ordain in retention subsidences 0, 1, 2, 3, and 4. Explanation retention subsidence 5 control Y, which is initialized to 0. Your lesson is to appoint in the consultation with the counsels needed to thorough the undertaking. Add each integer successively to the accumulator (referred to by the record designate AC”). Assume the accumulator starts with the prize 0 Fund your counsels startning in retention subsidence6 left counsel (20 bits) equiconsultation counsel (20 bits) 20 28 opadjudication (8 bits) harangue (12 bits) opadjudication (8 bits) harangue (12 bits) (b) Counsel expression Remember that you keep TWO counsels per expression when it’s explanationd to fund counsels (a so-called “counsel expression”), each 20 bits, comprising 8 bits of opadjudication and 12 bits of operand. The classify divides up counsel expressions into Left and Equiconsultation positions, so 10L represents the left 20 bits. It is discover primary, then 10R, then 11L and 11R and so on. To limit the program, explanation a Bound trodden, beside bound end to your own

    Expert Counter-argument

     

    1. We get weigh as combine of nondescript number 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 subsidence 7L LOAD M(6) Loading n in AC 7R MULM(6) Multiplying with n in AC control n*n 8L STOR M(5) AC-> Y 8R JUMP M(8,20;39) Done ;Halt

    Second Method outside using trodden 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.Agent adjudication counsel – LOAD DIRECT 5