1. Engineering
  2. Computer Science
  3. question 2 a stack architecture a stack architecture is used...

Question: question 2 a stack architecture a stack architecture is used...

Question details

Question 2. A stack architecture A stack architecture is used in many calculators. It uses a collection of registers called the stack, with the restriction that you access only the piece of data on the top of the stack. When you puslh a new data value onto the stack, it goes on top (TOS), and everything else gets pushed down- like the pop-up plate dispensers in a cafeteria. When you pop a data value off of the stack, it comes off the top, and everything else moves up the stack. Math operations pop the top two pieces of data off the stack, do the math, and push the answer back on the stack. Suppose that the stack architecture has a 120 ns clock cycle, and the following instructions: PUSH <mem addr Reads the memory at the given address and places the data onto the top of the stack Example: PUSH A TOS MemA] rest of stack pushed down) POP <mem addrRemoves the data that is on the top of the stack, and writes that data to memory at the given address. Example: POPA Mem A TOS rest of stack ADD Removes the top two pieces of data on the stack, adds them together, and then pushes the result of the addition onto the stack Example: ADD ;TOS ← TOS TOS-1 one fewer item on stack at MUL Ramoves the top two pieces of data on the stack, adds them together, and then pushes the result of the addition onto the stack. Example: MUL TOSTOS TOS-1 ith one item on stack at write assembly language code for the high-level code fragment A = C * (A B) + D on the stack architecture. Include RTL comments. What is the IC for your code? How long w take to run? Question 3. A two-address load-store architecture A load-store architecture uses a register file for its working registers. load-store architecture has a 140 ns clock cycle time, and the following instructions LOAD <reg addr, <mem addo Reads the memory at the given address and puts the data in the Suppose the two-address register indicated. LOAD RI.A RIl Mem [A STORE <mem addr. reg add Copies the data from the register indicated and writes it in the memory at the given address STORE A, RI : Mem [A] ← RI ADD creg addrl>. reg addr2> Adds the data in the two registers indicated together, and puts the result in the register indicated by <reg addrl> ADD R2. Ri R21 Regs [R21 + Regs [RI MUL <reg addrl, <reg addr2> Adds the data in the two registers indicated together, and puts the result in the register indicated by <reg addrl>. MUL R2 R R21 Regs RIl Write assembly language code for the high-level code fragment A -C (A + B) +D on the two-address load-store architecture. Do not use more memory locations or registers than you need. Include RTL comments. What is the IC for your code? How long will it take to run?
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution