Question

explain this code, step by step

(8) Question 2a. Assume initially R4-4, R5-5, R6-6, and R7-7 Consider the following assembly code PUSH IR5,R61 Top-) 5,6 Bott

0 0
Add a comment Improve this question Transcribed image text
Answer #1

PUSH {R5, R6} is pushing value of register R5 above value of register R6 in a stack. Stack contents = {5,6} from top to bottom.

ASR R4, R4, R7            ; arithmetic shift right (ASR) the contents of register R4 are shifted right 7 bits which is equivalent to divide the contents of R4 to 2 128, and storing the resulting value in register R4. Contents of R4 becomes 0.

EOR R7, R5, R6          ; taking Ex-Or logic of the contents of register R5 and R6 (in binary format) and storing the result in register R7. XOR(1,1) = XOR(0,0) = 0 and XOR(1,0) = XOR(0,1) = 1. New contents of R7 is 3.

PUSH {R7, R4} is pushing value of register R7 above value of register R4 in a stack. Stack contents = {3,0,5,6} from top to bottom.

POP {R7, R5, R4, R6} is popping out the values one by one from top of stack and assigning to R6,R5,R4,R7 respectively

Final values are R7 = 6, R5 = 5, R4 = 0 and R6 = 3.

Add a comment
Know the answer?
Add Answer to:
explain this code, step by step (8) Question 2a. Assume initially R4-4, R5-5, R6-6, and R7-7...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Stack Operation 10. (10 pts.) Show the contents of the stack and affected registers at the two marked points in the exe...

    Stack Operation 10. (10 pts.) Show the contents of the stack and affected registers at the two marked points in the execution of the followin code. Assume RO-0, R1-1, R2-2, R3-3, R4-4, R5-5, and R6-6. The initial value for stack pointer (prior to executing this code block) is given as SP-0x20001000 PUSH R2,R3) ADD R4, R1, Re ;<---A POP R5, R6) ADD R5, R5, R4 ADD R6, R6, R5 PUSH (R4-R6); SUBS Re, RO,R1-B a) Show the contents of Stack,...

  • If stack is given as { 3 (bottom element) ,12, 2, 4, 5, 6, 1, 2(top...

    If stack is given as { 3 (bottom element) ,12, 2, 4, 5, 6, 1, 2(top element ) } .What will be the content of registers R3, R4 after the following operation: POP {R3-R4} . Select one: a. {3,12,2,4,5,6}   , R3=2, R4=1           b. None c. {1,2,6,5,4,2,} ,R3=12, R4=3             d. {3,12,2,4,5,6} , R3=1, R4=2 --------- KEIL

  • RESISTOR VALUES: R1=1k, R2=2k, R3=3k, R4=3.9k, R5=5.1k, R6=6.2k, R7=6.8K NUMBERS: 2, 4, & 5 1 Short AB, as shown in...

    RESISTOR VALUES: R1=1k, R2=2k, R3=3k, R4=3.9k, R5=5.1k, R6=6.2k, R7=6.8K NUMBERS: 2, 4, & 5 1 Short AB, as shown in Figure 3 - 2 (a). Use mesh analysis to calculate the voltage across each resistor and the current through AB, IAB 2. Leave AB open, as shown in Figure 3 - 2 (b). Use nodal analysis to calculate the voltage across each resistor as well as the voltage across AB, VAB 3. Find Thevenin's and Norton's Equivalent using the results...

  • Note: The question needs to be answered in "C Programming Languange ". And after the question fin...

    Note: The question needs to be answered in "C Programming Languange ". And after the question find 3 pages for needed informations. Spring CE4717 Language Processors Q1. Consider the following LEx program. return R1 return R2 return R3 return R4 return R5; return R6; IA-2a-z)[A-Za-z0-9]- -2 10-91+ 10-9a-EA-FI Ihi] [01] [01] 이삐 t Vtin) int main (void) int tcode; do f tcode -yylex()i printf ("token type td \"%s\"\n", tcode, yytext); ) while (tcode)i return 0; i. Explain the steps needed...

  • I'm having trouble writing this code, can some help me? Step 1: Capturing the input The...

    I'm having trouble writing this code, can some help me? Step 1: Capturing the input The first step is to write a functionGetInput()that inputs the expression from the keyboard and returns the tokens---the operands and operators---in a queue. You must write this function. To make the input easier to process, the operands and operators will be separated by one or more spaces, and the expression will be followed by #. For example, here’s a valid input to your program: 6...

  • LC-3 Programming Help!! The Stack Protocol The following outline is the protocol for passing arguments to...

    LC-3 Programming Help!! The Stack Protocol The following outline is the protocol for passing arguments to a function and returning values. Everything is stored on the runtime stack so that space is used only when the function is executing. As a result the actual address of arguments and locals may change from call to call. However, the layout of the stack frame (activation record) is constant. Thus, the offests from the frame pointer (FP) to the parameters/locals are constant. All...

  • 5. Consider the SPIM code below. globl main .text main: ori $t1, $0, 10 ori $t2,...

    5. Consider the SPIM code below. globl main .text main: ori $t1, $0, 10 ori $t2, $0, 11 add $t3, $t1,$t2 move $t4, $t3 The following image shows a screen shot of QtSPIM page when this program is loaded, and executed in step-by step fashion. Current instruction is highlighted. Data Text x Text Regs Int Regs [16] Int Regs [16] PC = 400028 EPC 0 Cause = 0 BadAddr = 0 Status = 3000ff10 HI LO = 0 = 0...

  • Question 1. 1 2 3 4 5 6 7 8 Lane Name/Code Ladder 1B | 2B...

    Question 1. 1 2 3 4 5 6 7 8 Lane Name/Code Ladder 1B | 2B 2 DNA Sample/Treatment DNA ladder Digest Digest Digest Digest Digest Digest 3B 4B 5B Negative Figure 1: 1% Super buffer agarose gel electrophoresis of restriction digest of the plasmid containing the gdhA gene insert. Based on the information above answer the following questions? 1. What ladder size used? 2. What are the two top bands and bottom bands representing? 3. Explain why the observed...

  • The both files are included. Where are these which are colorful. Point.h and point.cpp Hor this assignment you are provided the files for a class called point. Download the h and .cpp files and incl...

    The both files are included. Where are these which are colorful. Point.h and point.cpp Hor this assignment you are provided the files for a class called point. Download the h and .cpp files and include them in your project. IheじML diagram below details the class Point くくfriend>> ostream& operator.((ostream&, point&) <ごfriend::. İstream& operator:..イ1stream&-point& - : double - v doublc getX) double getYO double - sctX( double): void - set Y(double) : void - point(double-0.0, double-0.0 operator-(const point& bool perator< const...

  • In this part, you will complete the code to solve a maze.

    - Complete the code to solve a maze- Discuss related data structures topicsProgramming-----------In this part, you will complete the code to solve a maze.Begin with the "solveMaze.py" starter file.This file contains comment instructions that tell you where to add your code.Each maze resides in a text file (with a .txt extension).The following symbols are used in the mazes:BARRIER = '-' # barrierFINISH = 'F' # finish (goal)OPEN = 'O' # open stepSTART = 'S' # start stepVISITED = '#' #...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT