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

Consider JS ADDRESS instruction, which checks if the result of the last instruct

ID: 3688338 • Letter: C

Question

Consider JS ADDRESS instruction, which checks if the result of the last instruction (that affected the flags) is negative S=l), and jumps to the instruction at memory location ADDRESS if it is negative. Write a sequence of microinstructions to accomplish the task: Calculate the Space Complexity of the instruction. Calculate the Time Complexity of the instruction. Consider POP RA instruction, which takes the top of the stack (byte) and puts it in RA and increments SP to point to the new top of the stack. Write a sequence of microinstructions to accomplish the task:

Explanation / Answer

1)
a)
cmp %al, %cl
js ADDRESS


b) Since js instruction stores the only one destination address.. it takes only O(1) space.

c) Coming to time complexity.. here comparing instruction and jumping to destination address
if sign bit is negative ... so two steps .. so O(2) ~~~ [ignore constant values] ===> O(1) complexity


------------------------------------------------------------------------------------------------------------------------------------------------------
2)
pop RA ; removing top most element

;pointing to next instruction
MOV RA, [ESP]
ADD ESP, 1

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