Page 1 of 1

DO NOT COPY AND PASTE THE ANSWER THAT STARTS AT TABLE #10! 1. Consider the following Hack computer block diagram shown

Posted: Fri May 20, 2022 11:44 am
by answerhappygod
DO NOT COPY AND PASTE THE ANSWER THAT STARTS AT
TABLE #10!
1. Consider the following Hack computer block diagram shown in
Figure 1.
3. Imagine that you are at the beginning of the LOOP (#11).
Assume that the values of n1 and n2 are 6 and 2. The variables n1,
n2, and q are stored at registers 16, 17, and 18, respectively.
2. Imagine the Hack computer shown in Figure 1 is tasked with
executing the Hack assembly code shown in Figure 2. The objective
of this program is to implement integer division and
store the result. Specifically, it carries out the
following operation: q = n1/n2. It should be assumed
that in all instances, n2 > 0.
4. Complete the Table 1 to show what occurs at each entity, at
each line of the code during this iteration
5. Create the given Table 1 in a Word document and then fill in
the information for lines 13 - 23
Do Not Copy And Paste The Answer That Starts At Table 10 1 Consider The Following Hack Computer Block Diagram Shown 1
Do Not Copy And Paste The Answer That Starts At Table 10 1 Consider The Following Hack Computer Block Diagram Shown 1 (67.53 KiB) Viewed 45 times
Do Not Copy And Paste The Answer That Starts At Table 10 1 Consider The Following Hack Computer Block Diagram Shown 2
Do Not Copy And Paste The Answer That Starts At Table 10 1 Consider The Following Hack Computer Block Diagram Shown 2 (30.67 KiB) Viewed 45 times
Code Line # A- D- M- ALU Data Instruction Program Control/Address/ register register Register memory Memory Counter Data bus (starting from 12) #12 NA NA The A- register is set to 16 M reg- ister points to the memory that stores the vari- able nl, RAM[16] The data mem- ory is ac- cessed to read RAM[16] that stores the value of nl The in- struction memory input is set to address of #13 The program counter is set to PC++ ad- dress of #13 in- struction 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. #13 #14 #15 #16 #17 #18 #19 #20 #21 #22 #23 Table 1: Line by line explanations

#1 @RO //set RO DOM #2 43 @nl MED// nl-RO #4 @R1 //set Bl. Assume the value in B1 will always be>0 DM #5 #6 #7 #8 @n2 MED// n2-R2 #9 #10 eg M=0 // 4-0 #11 #12 #13 #14 #15 #16 //q - ni/n2 (LOOP) @ni DM @n2 DED-M @FINISH DEJT #17 418 @nl M = D// nl - nl-n2 #19 120 da M - M +1 #21 #22 #23 #24 LOOP OH JMP (FINISH) #25 #26 #27 (END) @END OHJMP Figure 2: Hack assembly code for integer division