Question: Problem 10 (22): Given a zero-address (stack) architecture, with operations such as push, pushl, add, div, expo, mult, sub, push adds, pushl #num, pop addr
Problem 10 (22): Given a zero-address (stack) architecture, with operations such as push, pushl, add, div, expo, mult, sub, push adds, pushl #num, pop addr etc., generate a plausible code sequence for arithmetic expression: res = x 7 * y ** ( 8 + z * 9 ). Pushl stands for pushing a literal value onto the top of stack. If all stack operations consume equally 2 cycles, how many cycles will it take to compute your code sequence (4 pts.)? Show plausible code sequence without optimization (6 pts.).
As an alternative, show an equivalent but faster instruction sequence, assuming that a two-word top-of-stack cache were available (8 pts.). Any cache hit now costs 1 cycle, accessing the stack (memory) costs 2 cycles, pushing a literal costs 1 cycle. How many cycles will be consumed for the optimized code sequence (4 pts.)?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
