Question: The following high-level code finds X * Y by repeatedly adding Y to itself X times: 1. prod = 0, j = 0 2. prod
The following high-level code finds X * Y by repeatedly adding Y to itself X times:
1. prod = 0, j = 0
2. prod = prod + Y
3. j = j + 1
4. IF ( j != X) go to 2
Using the Instruction Set as per Table 3.1 in computer systems organization and architecture, write an assembly code to do this task. Assume that all 1-byte instructions take 30 ns and all 3-byte instructions take 150 ns.
- What is the total size, in bytes, of your code?
- What is the total execution time of your code as a function of X
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
