Little Man ComputersThe Little Man Computer (LMC) was created by Dr.
Stuart Madnick in 1965. Originally it was a useful tool for introducing students to computer architecture. And even though it is a simplified model, LMC – a simple von Neumann architecture computer, that can be porgrammed in machine (albeit usually in decimal) or assembly code – remains quite effective and wide-spread nowadays, over 35 years after the model was created. Its popularity can be, on the one hand, explained by its simplicity, and, on the other hand, by the fact, that it contains all the components of modern computers: memory, a central processing unit, and input/output capability. It should be noted, though LMC is a powerful teaching tool, without constant practice and active learning, it is still limited. The tool is used to introduce the “Fetch Execute Cycle” process to the students through the visualization of elements of the computer architecture that would normally remain hidden, to show them how “all the important work inside the processor is done” (Susan A. Riedel, 1994, intro).
The LMC model encourages active learning for students by enabling them to write and execute simple LMC programs; thus they can gain valuable experience with important notions including the stored program concept and important computer architecture concepts. However, students should be aware, that there is no perfect analogy between LMC and real computers (Crews & Yurcik, 2002).LMC has quite a unique architecture; it is based on the concept of a little man locked in a small room. The control screen is the first screen you will see when the Little Man Computer starts up, it allows you to affect how the little man acts by controlling the program, the dialog provided and the speed it runs at. User can exit the control screen (and, therefore, the Little Man Computer) by simply closing the window that it is in. There’s also a Program Window – a place, where the user can view or change his/her programs.
The user can enter his commands by highlighting the instructions he/she wishes to change and typing over it. Another part of Little Man’s house is the Dialog Window – the window, used to control the amount of dialog that the Little Man produces. The window is split into 4 sections, and the user can turn on and off each one of them by switching the red or green switches. We should also mention other elements of the interior in the Little Man’s house: Escape Button (which takes the user out of this section of the application and return to the start screen), Phase Display (showing which phase of the fetch/execute cycle is presently on), Program Display (the program that is currently being carried out) and the Instruction Details Display, which sprovides the name of the current instruction, along with it’s op code and operand. (The Little Man Computer, 2002).
At one end of the room, where Little Man lives, there are 100 mailboxes (which are memory boxes). They are numbered 0 to 99, and each of them can contain a 3 digit instruction. Memory is accessed during the execute phase when the user needs to store or access data.
It is possible to overwrite user’s programs when putting data into memory though, so students should be careful as to where they put it. There are two other mailboxes, labelled Inbox and Outbox, which are used for receiving and outputting data (via these two mailboxes students are encourage to communicate with the little man by providing him with data and then receiving the data he provides them with). Since the notion of a man is exploited, he has his own house, his own room, the centre of which is called Work area, it contains a simple 2 function calculator, known as the Accumulator that is able to add and subtract only. It would be the Arithmetic Logic Unit (ALU) on a real computer, but since the Little Man doesn’t need anything so grand, he deals with the 3-digit Accumulator.
There is also a resetable counter known as the Program Counter. In this line of comparison the Counter stands for a doorperson, who keeps track of how many people have entered a facility. The Counter can count up 1, or it can be reset to 0. The specific character of von Neumann architecture is displayed in memory, containing both instructions and data. That is how it works: the user (usually, a student) loads data into the mailboxes and then signals the little man to begin execution (Susan A. Riedel, 1994, chap 2).There are several steps, the little man performs to execute a programme, given by the user. First, he checks the Program Counter, goes to the mailbox with that number and receives the instruction.
Little Man should add one to the current value, so that it referred to the next mailbox that is planned to be accessed in the next cycle, – he increments the Program Counter. After that, he decodes the instruction which determines the action that is to be performed and the mailbox, on which it should be performed, executes the action and then repeats the cycle again and again (The Little Man Computer, 2002).Of course, the main point of the whole Little Man model is commands that the user can give and the Little Man can perform. While the LMC does reflect the actual workings of binary processors, the simplification of decimal numbers was made to minimize the complexity for students who may not be comfortable working in binary/hexadecimal.
This is often considered to be one of the flows of the Little Man Computer, as it breaks the analogy between the LMC and the real computer. Each LMC instruction is a 3-digit decimal number. The first digit represents the command to be performed and the final two digits represent the address of the mailbox affected by the command. Let us cite some instructions as examples. For example, instruction xx – ADD means, that the Little Man will take the value stored in mailbox xx and add it to whatever value is currently on the accumulator. Another example: 902 – OUTPUT – command means that Little Man will fetch the value from the accumulator (non-destructive) and put it in the OUTBOX for the user to read. The 000-HALT command means “Stop working”. All in all, there are 9 commands, presently supported by Little Man Computer: Load (1), Store (2), Add (3), Subtract (4), Input (5), Output (6), Halt (7), Skip If Negative (800), Skip If Zero (801), Skip If Positive (802).
Although the Little Man can remember numeric instructions and numeric mailbox location perfectly well, LMC users often have trouble with all these numbers. To make programming easier, the LMC also supports a mnemonic form for programs, called Little Man Assembly Language (LMAL). LMAL supports the use of names, not numbers, for mailboxes and instructions. This is accomplished in two ways: the programmer can identify one or more mailbox names using a special LMAL DC instruction (Define Constant), on the one hand, and on the other hand, the programmer can associate a label with any given LMAL instruction, thus identifying the mailbox holding that instruction for future reference. A label is simply a word provided as a name to the left of a particular line in the program text, which the assembler will convert to the appropriate address at the time of assembly.
When seen to the right of the instruction, labels then take on the value of the address calculated. Labels are commonly used to identify a particular instruction as a target for a BRANCH instruction, to identify space as a named variable or to load data into the program at assembly time for use by the program.LMAL is perfect for the user, but it won’t be understood by the Little Man, as he only understands numbers. Therefore, there exists a translator, turning the LMAL program into the numeric form that the Little Man understands. This translator is called Little Man Assembler. The assembly process includes translating the mnemonic instructions into numbers, identifying a mailbox number for every instruction, finding a mailbox for all the data defined by DC directive, and resolving all references to named mailboxes by replacing the names with the assigned mailbox numbers (LMC Instruction Set, 2001). The result of assembling the LMAL program is the Little Man machine language program file, including such commands as: 0-901-***-READ, 6-902-***-PRINT and some others (Crews & Yurcik, 2002).Over the last 35 years LMC has been a powerful tool, used for introduction into simple programming and allowing students to form a better understanding of the five basic components of a processor and the ways in which they interact, as each instruction or command is carried out.
Sources1. Crew, Thad & Yurcik, William (2002). LMMS: An 8-Bit Microcode Simulation of the Little Man Computer. http://www.sosresearch.org/caale/ISECON02lmms.PDF2.
(n/a) The Little Man Computer (2002). http://www.herts.ac.
uk/ltdu/projects/mm5/3. (n/a) LMC Simulator (n/d). Retrieved http://www.atkinson.yorku.ca/~sychen/research/LMC/LMCHome.html4. Susan A.
Riedel (1994). The Little Man Computer. Documentation and User’s Guide. http://povinelli.eece.mu.edu/teaching/coen030/lmc.html#Introduction