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

Given a binary pattern in some memory location, is it possible to tell whether t

ID: 1715708 • Letter: G

Question

Given a binary pattern in some memory location, is it possible to tell whether this pattern represents a machine instruction or a number Consider a computer that has a byte-addressable memory organized in 32-bit words according to the big-endian scheme. A program reads ASCII characters entered at a keyboard and stores them in successive byte locations, starting at location 1000. Show the contents of the two memory words at locations 1000 and 1004 after the word "Computer" has been entered. Repeat Problem 2.2 for the little-endian scheme. Registers R4 and R5 contain the decimal numbers 2000 and 3000 before each of the following addressing modes is used to access a memory operand. What is the effective address (EA) in each case 12(R4) (R4,R5) 28(R4,R5) (R4)+ -(R4) Write a RISC-style program that computes the expression SUM = 580 + 68400 + 80000. Write a CISC-style program for the task in Problem 2.5. Write a RISC-style program that computes the expression ANSWER = A x B + C x D. Write a CISC-style program for the task in Problem 2.7. Rewrite the addition loop in Figure 2.8 so that the numbers in the list are accessed in the reverse order; that is, the first number accessed is the last one in the list, and the last number accessed is at memory location NUM1. Try to achieve the most efficient way to determine loop termination. Would your loop execute faster than the loop in Figure 2.8 The list of student marks shown in Figure 2.10 is changed to contain j test scores for each student. Assume that there are n students. Write a RISC-style program for computing the sums of the scores on each test and store these sums in the memory word locations at addresses SUM, SUM + 4, SUM + 8, .... The number of tests, j, is larger than the number of registers in the processor, so the type of program shown in Figure 2.11 for the 3-test case cannot be used. Use two nested loops. The inner loop should accumulate the sum for a particular test, and the outer loop should run over the number of tests, j. Assume that the

Explanation / Answer

2.1:

Basically, any memory location can be used to store instruction or data. But cannot differentiate between the data and instruction by looking into the memory location itself. What determines is the at what time the CPU references it. As we know that at first the CPU gets instrucntion and then goes for the data or source operands. the steps a CPU goes through is

1.    Get next instruction

2.    Decode (i.e., interpret its meaning) the instruction

3.    Read Source Operands

4.    Perform Operation (e.g., add two numbers)

5.    Write Result

6.    Determine which is the next instruction

So, basically if we at what time the cpu is referencing the memory location, we can differentiate the memory location as intruction or source. this is because CPU does not go to data. If first has to search for an instruction and then use data in executing the instruction. So, if the memory is accessed in step 1 only then it is accessing machine instruction from the memory location. If the memory is accessed in step 3 then it is accessing data from that memory location.

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