Microprogramming Lab

CS63: Principles of Computer Organization
Fall Semester, 1997

Ray Ontko
Department of Computer Science
Earlham College

The purpose of this lab is to give you a chance to explore microprogramming and how the microprogram interacts with the hardware to implement a conventional machine language interpreter.

We will be using a Macintosh program called µArchitecture Simulator, by Fabrizio Oddone, which provides a simulated hardware machine very similar to the Mic-1 machine described in Tanenbaum. It allows you to view and modify the conventional memory, to modify the microcode running on the simulated hardware, to "see" the signals flowing through the circuits of the hardware, and step through the microcode at the clock sub-cycle level.

Such simulators are used in the development of real microcode, and this lab is designed to give you a feel for what it is like to write (and debug) true machine language.

Using the Mic-1 control store which I have entered (but not thoroughly tested), do each of the following and demonstrate it for your neighbor:

  1. Enter an instruction at address 2000(hex) in conventional memory. Use the Mac-1 instruction set (Fig. 4-14 on page 185) and pick an instruction that interests you. Clear the registers and step through the microcode by clock sub-cycle and watch carefully to see what's happening both in the hardware animation window, and in the microcode window. Does the instruction do exactly what you expected? Is it correct?

  2. Pick 8 sequential lines from the microprogram. Examine them carefully to see if they are identical (in description) to the corresponding lines in the text (Fig. 4-16, page 190-191). Now, check to see if each of them exacly implements the correct hardware functions. Note that Oddone has eliminated the TIR register (I have used A), and I have assumed that the X12 and Low8 registers have been pre-loaded with the AMASK and SMASK constants (0FFF and 00FF, respectively).

  3. Delete a microcode instruction that you have tested, and add an empty one in its place. Now, modify the empty instruction to re-implement what you deleted. Test by re-running the test you ran before.

  4. Write a small program using a few (4-10) instructions that you know work. Step through the microcode to verify that your program works.

  5. Think of a new Mac-1 instruction that you'd like to add. For example, AND8 which does an 8-bit AND with the value in the accumulator and the 8-bit operand of the instruction. Now, replace one of the existing instructions with your new microcode. You may need to jump to 79 and add microinstructions to the end of the code if the new instruction takes more microinstructions than the original instruction. Test your new instruction.

Copyright © 1997, Ray Ontko (rayo@ontko.com).
If you're curious about why I copyright, see Peter Suber's Why Copyright Web Documents?.