Little Man Program Code
Due by Midnight Friday, March 25th You may submit multiple files for this assignment Total 107 Points Chapter 6 Questions 1. (4pts) Describe, step by step, what the Little Man does to execute a STORE instruction.
(4pts) Describe, step by step, what the Little Man does to execute an INPUT instruction. (2pts) If a user wants to enter two numbers, what must the Little Man program do before the user enters the second number? (2pts) Explain carefully what the Little Man will do when he executes a BR instruction.
(2pts) Why is the instruction cycle called a cycle? (2pts) Even if he runs out of instructions to execute, the Little Man only stops trying to execute instructions under one condition. What is that condition? What happens if the Little Man runs out of instructions and that condition is not met? (2pts) The instruction cycle is divided into two phases. Name each phase.
The first phase is the same for every instruction. What is the purpose of the first phase that makes this true?
Explain what the Little Man does during the first phase. (4pts) The steps that the Little Man performs are closely related to the way in which the CPU actually executes instructions.
The Little Minion Computer is a conceptual model of a simple CPU, introduced by Dr. Stuart Madnick of M.I.T. In 1965, under the guise of the Little Man Computer. Op code 5 is load: the little minion goes to the mailbox indicated by the address, copies what is on the slip of paper in the mailbox, then goes to the calculator.
Draw a flow chart that carefully describes the steps that the Little Man follows to execute a branch instruction. 9.(4pts) As in Question 8, Draw a flow chart that carefully describes the steps that the Little Man follows to execute a subtract instruction. 10.(6pts) What are the criteria that define a von Neumann architecture? How does the example in this chapter in which we enter and add two numbers illustrate each of the criteria? (4pts) Consider the example in this chapter in which we enter and add two numbers.
Suppose we had stored the first input entry in mailbox location 00. • Would the program have produced the same result?
• What would have happened if the program were executed a second time? • What characteristic of the computer makes this true?
(6pts) The following Little Man program is supposed to add two input numbers, subtract a third input number from the sum, and output the result, i.e., OUT = IN1 + IN2 − IN3 mailbox mnemonic code numeric code 00 IN 901 01 STO 99 399 02 IN 901 03 ADD 99 199 04 STO 99 399 05 IN 901 06 SUB 99 299 07 OUT 902 08 COB 000 What is wrong with this program? Modify the program so that it produces the correct result. (6pts) Show carefully how you would implement an IF-ELSE statement using Little Man instructions. (6pts) Show how you would implement a DO-WHILE statement using Little Man instructions. (4pts) Suppose the Little Man Computer had been implemented as a 16-bit binary machine.
Assume that the binary LMC provides the same instruction set, with the same opcodes (in binary, of course), and the same instruction format (op code followed by address). Bicycle Manual Transmission. • How many bits would be required for the op code portion of the instruction? • How many mailboxes could the binary machine accommodate? • What is the range of 2’s complement data that this machine could handle?
(2pts) 6.19 The original version of the Little Man Computer used op code 7 (i.e., instruction 700) for a COFFEE BREAK instruction instead of op code 0. What is the advantage of using 000 for the COB instruction instead of 700? (Hint: Consider what happens if the programmer forgets to put a COB instruction at the end of a program.) For questions 18 - 22, write the Little Man Computer Programs in either a table, or in a spreadsheet program, 1 solution per tab if you use a spreadsheet. Your program will be run on a simulated LMC program to ensure its correctness.
You may use the LMC Excel program located on Blackboard to test your programs or that is fully online. There is a slight difference in the mnemonics used from those in class( IN is INP and BR is BRA). The remainder are the same. A Professional Engineer Will Immediately Have Their License Suspended For there. Refer to the help pages if you require more assistance. (8pts) Write a Little Man program that accepts two numbers as input and outputs the numbers in reverse order. (3pts) Write a Little Man program that accepts two numbers as input, subtracts the first from the second and outputs the result. (12pts) Write a Little Man program that accepts three values as input and produces the largest of the three as output.
(12pts) Write a Little Man program to accept an indefinite number of input values.The output value will be the largest of the input values. You should use the value 0 as a flag to indicate the end of input. (12pts) Write a Little Man program that prints out the odd numbers from 1 to 99. No input is required. • Some questions or exercises may require additional research (perhaps on the Web) • Not all questions or exercises will necessarily be worth the same number of points Requirements The standard apply to this assignment. Be sure to follow them!