Question: Task Instructions 1 . Consider the following assembly code given in Figure 1 that adds numbers 1 0 0 - 1 2 0 ( inclusive

Task Instructions
1. Consider the following assembly code given in Figure 1 that adds numbers 100-120(inclusive) and stores the final sum in register R1.
2. Consider the iterations where i is equal to 120 at the beginning of the loop.
3. Firstly, draw the symbol table for the program with the relevant memory locations allocated for the pre-defined symbols, labels and variables.
4. Next, for each instruction, fill in the given table for each explaining the values in each component. You have to do this for iteration 120.
5. Your explanation within the table will include which instruction is fetched, the values in the different registers and ALU operation, how the PC value is determined (line numbers are given next to each instruction), and also what buses are involved. (An example is given below for your reference). Complete this description for the highlighted lines of code only.
6. Upload the pdf document to OnTrack.
Assembly code
//Calculates the sum of numbers 100 to 120 and stores the result in R1
//Initializing the variables #0 @100
#1 D=A
#2 @i
#3 M=D // value 100 is stored in RAM[16] #4 @120
#5 D=A
#6 @n
#7 M=D // value 120 is stored in RAM[17] #8 @sum
#9 M=0//value 0 is stored in RAM[18]
//The loop that calculates the sum (LOOP)//beginning of the loop #10 @i
#11 D=M
#12 @n
#13 D=D-M
#14 @STOPLOOP
#15 D;JGT //if I > n goto STOPLOOP #16 @i
#17 D=M
#18 @sum
#19 M=M+D // sum = sum + i #20 @i
#21 M=M+1//i = i+1 #22 @LOOP
#230;JMP (STOPLOOP)
#24 @sum
#25 D=M
#26 @R1
#27 M=D //RAM[1]= sum (END)
#28 @END
#290;JMP
Iteration 120:
Example:
@i
PC
output ROM i/p ROM
o/p Value stored in A
register ALU Value stored in D
register RAM
i/p or
o/p PC
value
10
Bus: Address
bus 10
Bus: Address
bus @i 16 NA NA NA 11
Bus: Control
bus
D=M
PC
output ROM i/p ROM o/p Value stored in A regist er ALU Valu e stor ed in D regi
ster RAM i/p or o/p PC value
11
Bus: Address bus 11
Bus: Address bus D = M
Bus: Control bus NA Assigns the value from RAM[16]
to the D register
. Bus: Data bus 100
Bus: Data bus Output form RAM[16]
is output and send as input to the ALU.
Bus:
Data bus 12
Bus: Control bus
Follow the examples given above for the rest of the instructions:
@n
PC
output ROM
i/p ROM
o/p Value stored in A
register ALU Value stored in D
register RAM
i/p or o/p PC
value
D=D-M
PC
output ROM
i/p ROM
o/p Value stored ALU Value stored RAM
i/p or
o/p PC
value
in A
register in D
register
@STOPLOOP
PC
output ROM
i/p ROM
o/p Value stored in A
register ALU Value stored in D
register RAM
i/p or o/p PC
value
D;JGT //if I > n goto STOPLOOP
PC
output ROM
i/p ROM
o/p Value stored in A
register ALU Value stored in D
register RAM
i/p or o/p PC
value
@i
PC
output ROM
i/p ROM
o/p Value stored in A
register ALU Value stored in D
register RAM
i/p or o/p PC
value
D=M
PC
output ROM
i/p ROM
o/p Value stored in A
register ALU Value stored in D
register RAM
i/p or o/p PC
value
@sum
PC
output ROM
i/p ROM
o/p Value stored in A
register ALU Value stored in D
register RAM
i/p or o/p PC
value
M=M+D // sum = sum + i
PC
output ROM
i/p ROM
o/p Value stored in A
register ALU Value stored in D
register RAM
i/p or o/p PC
value
@i
PC
output ROM
i/p ROM
o/p Value stored in A
register ALU Value stored in D
register RAM
i/p or o/p PC
value
M=M+1//i = i+1
PC
output ROM
i/p ROM
o/p Value stored in A
register ALU Value stored in D
register RAM
i/p or o/p PC
value
@LOOP
PC
output ROM
i/p ROM
o/p Value stored in A
register ALU Value stored in D
register RAM
i/p or o/p PC
value
0;JMP
PC
output ROM
i/p ROM
o/p Value stored in A
register ALU Value stored in D
register RAM
i/p or o/p PC
value

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!