Imagine that you are at the beginning of the LOOP (#11). Assume that the values of nl and n2 are 6 and 2. The variables

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Imagine that you are at the beginning of the LOOP (#11). Assume that the values of nl and n2 are 6 and 2. The variables

Post by answerhappygod »

Imagine That You Are At The Beginning Of The Loop 11 Assume That The Values Of Nl And N2 Are 6 And 2 The Variables 1
Imagine That You Are At The Beginning Of The Loop 11 Assume That The Values Of Nl And N2 Are 6 And 2 The Variables 1 (89.22 KiB) Viewed 75 times
Imagine that you are at the beginning of the LOOP (#11). Assume that the values of nl and n2 are 6 and 2. The variables n1, n2, and q are stored at registers 16, 17, and 18, respectively. Code Line # A- D- M- ALU Data Instruction Program Control/Address/ (starting from register register Register memory Memory Counter Data bus (12) The A- NA M reg- ΝΑ ister The data register is set points The program counter is set to PC++ -> to 16 to The in- struction memory input is set to address of #13 the memory that stores The control bits are sent to A register to load the value 16. The address of vari- able nl is put into the address bus to access the memory location. The control bits are sent to the PC to in- crement its value by 1. mem- ory is ac- cessed to read RAM 16 that stores the value of nl ad- dress of #13 in- the vari- struction able nl, RAM[16] #21 #22 #23 Create the given Table 1 in a Word document (or a similar text editor) and then fill in the information for lines 13 - 23. Hint: It may be useful to run this code in the CPU Emulator and examine what happens at each step. #1 @RO //set RO #2 D=M #3 @nl #4 M-D// nl-RO #5 @R1 //set R1. Assume the value in R1 will always be>0 #6 D=M #7 @n2 #8 M=D// n2-R1 #9 @q # 10 M=0 //q0 //q- n1/n2 #11 (LOOP) #12 @nl #13 D=M #14 @n2 #15 D-D-M #16 #17 # 18 #19 # 20 #21 #22 #23 #24 #25 (END) #26 @END #27 0; JMP #12 #13 #15 #16 #17 # 18 #19 #20 @FINISH D; JLT @nl M D // n1 = n1-n2 @q M M +1 @LOOP 0; JMP (FINISH)
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply