Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Making choices by comparison and jump You will recall from the discussion of algorithms in the first three chapters of the text that we can

Making choices by comparison and jump

You will recall from the discussion of algorithms in the first three chapters of the text that we can test data for certain properties and make a decision about which statements to execute as a result of what we find. Suppose we want to display the smaller of two input values. The algorithm might compare the two numbers and, if the first is smaller than the second, then display the first; otherwise, the algorithm will display the second.

To observe this algorithm as a machine language program, load the file example3.mac from the EXAMPLES folder. Run the program a couple of times with different input values to get a sense that it does what it is supposed to do.

Download the document lab_09_04.docx. Using the tables within the document complete the following.

For each of the instructions up to the halt instruction, enter the instruction and your interpretation of the instruction in the first table. Then reset and step through the execution of the program using the binary value for 5 for the first input and the binary value for 7 for the second input. Record the address of the instruction being executed and the values stored in the top four registers (pc, ir, r, and ccr) immediately after executing the instruction. What happened to the ccr register after the comparison took place? Did the machine execute one jump instruction or two? Now reset and repeat the procedure by reversing the order of the two input values.

Once you have completed the tables and answered the questions, save your file with your last name in the file name (Example: lab_09_04_Jones.doc). To upload and submit your assignment, click the Choose File button below to find and select your saved document. image text in transcribedimage text in transcribed

Stepping with first input value 5 and second input value 7 : What happened to the value in cor? How many jumps were executed? Stepping with first input value 5 and second input value 7 : What happened to the value in cor? How many jumps were executed? Stepping with first input value 7 and second input value 5 : What happened to the value in cor? How many jumps were executed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Databases With Application To GIS

Authors: Philippe Rigaux, Michel Scholl, Agnès Voisard

1st Edition

1558605886, 978-1558605886

More Books

Students also viewed these Databases questions

Question

2. How can competencies be used in employee development?

Answered: 1 week ago