Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Custom Problem #2: Integer Division: From the slide titled Enhanced Processor w/PC Tester Circuit from the lecture segment titled Programming a CPU with Machine Language

image text in transcribed

image text in transcribed

Custom Problem #2: Integer Division: From the slide titled "Enhanced Processor w/PC Tester Circuit" from the lecture segment titled Programming a CPU with Machine Language - The Execution, implement the following division algorithm: C = 0; do { A = A-B; C = C + 1; } while (A >= 0); C = C-1; NOTE: this algorithm uses a "do-while loop. It is slightly different than a normal while loop. The computer will always go through the loop once, and then check the condition before it performs it again. This differs from a while loop that will only perform the loop IF the condition is first met. a) Show a Flow Chart, like the one shown in the previous segment, Programming a CPU with Machine Language - The Setup, this will help you break the program into its various "states." b) Show a table like the one shown on the slide titled Multiply Algorithm: Control Memory Contents from the lecture segment Programming a CPU with Machine Language - The Execution, listing the values of the control signals necessary to implement the algorithm above. You may assign registers any way you like to hold your variables and necessary data, but state it up front! c) Show an Execution Trace (like the one shown in the same lecture segment) for your program in step (b). For your trace, assume A=5 and B=2. Custom Problem #3: Summing Up Numbers For this problem you will once again use the "Enhanced Processor w/PC Tester Circuit" shown in the slides. This time you will create the algorithm that you will implement. Your algorithm will take as input an unsigned number: A. It must then compute the sum of all the numbers from 1 up to and including A. As an example, if A=5, your algorithm will compute 15 by adding: 1+2+3+4+5. You may assume (as we have in all previous algorithms) that the input A is already loaded in your register file, as well as any other numbers you require. You must use a loop to implement your algorithm. a) Write out your algorithm in pseudocode as shown in custom problem #2 for your algorithm. b) Show a flowchart of your program using the Multiply Algorithm: Flow Chart/State Diagram" example from the slides in the segment on Programming a CPU with Machine Language - The Setup. c) Show a table like the one shown in the slides titled Multiply Algorithm: Control Memory Contents, listing the values of the control signals necessary to implement the algorithm above. You may assign registers any way you like to hold your variables and necessary data, but state it up front! d) Show an Execution Trace" like the one shown in the same lecture segment for your program in step (c). For your trace, assume A=3. e) Take into account the limits of our processor, determine the largest value for the unsigned integer A that your algorithm will still compute the correct

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

Step: 3

blur-text-image

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

Database Fundamentals Study Guide

Authors: Dr. Sergio Pisano

1st Edition

B09K1WW84J, 979-8985115307

More Books

Students also viewed these Databases questions

Question

Define and explain the nature of nonassociative learning.

Answered: 1 week ago

Question

2.7 Identify how privacy legislation impacts employees.

Answered: 1 week ago