Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Given the following assembly program in GPR architecture: loads #10, R1; loads 1

ID: 3783440 • Letter: G

Question

Given the following assembly program in GPR architecture: loads #10, R1; loads 10 in R1 moves R1, R2; moves (copies) content of R1 into R2 adds R1, R2, R3; adds R1 to R2 and puts result in R3 mul #20, R3, R4; multiplies R3 by 20 and puts result in R4 move R4, M[1000]; moves (copies) content of R1 into Memory at address 1000 a) For every instruction in the above program, draw, as a flow chart, the micro step execution cycle. b) Assuming each instruction requires four bytes to be encoded, calculate the total memory needed to store the program. c) Assuming an execution on a 2 GHz CPU. where every step requires a number of clock cycles (cc) as shown below, calculate the execution time for every instruction, then for the whole program.

Explanation / Answer

Register-Set Architecture: Modern CPUs have a number of general-purpose registers (GPR's) for internal storage: at least 8 and as many as 32. GPR machines are the most flexible of all, because they allow the user to access any of several registers. The load/store commands must typically specify a register and memory location, to indicate both source and destination of the data. Any register can be used as an accumulator, an index register, or for temporary storage, etc., so many variables and addresses can be manipulated without extra memory accesses. The major bad point of having many registers is the large amount of internal CPU state that must be saved/restore for calls, returns, and interrupts.

A register-set architecture can be designed several different ways. The ALU operations consist of the ALU operator, and two or three registers, which are assumed to contain the 2 operands, and tell where the result should go.One difference is whether arithmetic instructions have two addresses or three addresses:

+ Two-address arithmetic: Each arithmetic instruction contains

a source address and a destination address: the destination

is also the second source operand. For example, an Add R1,R2

instruction adds register R2 to register R1.

+ Three-address arithmetic: Each arithmetic instruction

contains two source addresses and one destination address.

For example, an Add R3,R1,R2 instruction will store the sum

of registers R1 and R2 into register R3.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote