Computer Science 237
Computer Organization

Williams College
Fall 2006

WC34000 Implementation Project
Phase 1 Due: Monday, November 20, 2006 at 9:00 AM
Phase 2 Due: Friday, December 1, 2006 at 3:50 PM
Phase 3 Due: Friday, December 8, 2006 at 2:30 PM

No late submissions will be accepted for this assignment. If you are not finished, please turn in what you have at the deadline for partial credit.

As the final assignment for this course, you (as an individual or a group of two) are to write a microcoded interpreter for a conventional machine language. In particular, you will design a microprogram to run on the Mice architecture, an extension to Tanenbaum's Mic-1. Your microprogram is to interpret programs written in the machine language of the WC34000, a hypothetical machine whose design is based on the MC68000. The details of the micro-architecture (mice), the assembler for the micro-programming language (male), the 34000 architecture, and the assembler for 34000 programs (wc34asm) are discussed in separate handouts. ([The WC34000 Computer][The 34000 Assembler][The Mice Micro-architecture and the Male Assembler]) This document only outlines a plan for completing the project.

As you have heard since the start of the semester, you will need to start your project as early as possible to avoid problems as the semester wraps up. You should expect to spend a significant amount of time in my office discussing your design choices and your implementation.

You must work individually on Phase 1. You may work individually or in pairs for Phase 2 and Phase 3.

Phase 1: Getting Comfortable
Due: Monday, November 20, 2006 at 9:00 AM

The purpose of Phase 1 is to have you complete the process of becoming familiar with the tools you will need to use to construct a microinterpreter. You will write and test a small microprogram.

Ultimately, your interpreter will consist of a small section of initialization code followed by a large loop that repeatedly fetches and executes instructions. The main function of the initialization code will be to construct certain constants that will be needed in the main loop. For example, you will need the constant 1, frequently. You will probably also want the values 7 and 63 in registers since their binary value ( `111' and `111111') are useful as masks when dealing with effective address specifications. (These three values have been selected because they are historically the three most common constants used in final microprojects.) The initialization code is also responsible for the setting of the program counter (PC) and stack pointer (SP) registers. The 34000 assembler leaves the initial setting for the PC in word 0 of memory. The SP should be initialized to point to the last word of memory, found at address 65535=FFFF16 (the last word will not be used by the stack) (why?).

For Phase 1, your tasks are to

  1. Write code (phase1.mal) to initialize registers with the values 1, 7, 63, 65535 (the register should be called SP).
  2. Write code to load memory location 0 into a register called PC.
  3. Write a small loop that repeatedly loads the first word of an instruction from the address referred to by the program counter. It should also increment the program counter.
  4. Write code that halts on an instruction whose first word is all zeros (HALT).

The program should be short. You are free to use any scratchpad registers you wish to hold these values. To avoid future problems, you should use symbolic names for the registers.

When you are done, turn in the source for your code as phase1.mal.

Phase 1 will not be graded, but you will get feedback.

You should then scrap phase 1, and immediately begin phase 2:

Phase 2: Basic Instructions and Addressing Modes
Due: Friday, December 1, 2006 at 3:50 PM

For Phase 2 you should complete the basic framework for the interpreter (phase2.mal). At a minimum you should implement the MOVE, ADD, SUB, CLR, OUTNUM, GETNUM, OUTCH, GETCH, LEA, PEA and JMP instructions and all of the addressing modes except the auto-increment/decrement modes. This will allow you to run simple programs (of your own design) containing no procedures or conditional transfers of control. Some simple tests will be provided, but accurate testing of the code is up to you. When you are satisfied with your progress, you should turn in your code (phase2.mal).

You are encouraged to plan this assignment very carefully before you begin an implementation.

Phase 3: Finishing Up: Everything Else
Due: Friday, December 8, 2006 at 2:30 PM

Complete the procedure call portion of your interpreter. Finish the other arithmetic instructions, CMP, conditional branches, the procedure call instructions, the auto-increment/decrement addressing modes and the PSHREG and POPREG instructions.

When you are finished with this phase, your code will be tested using a suite of sample programs designed to test important features of the 34000. A large part of your grade on the project will be computed based on 1) the performance of your interpreter on the test suite, 2) the speed of your interpreter (measured in number of micro instructions executed per machine instruction), and 3) the size of your interpreter (measured in number of words of control store required). The weighting of these factors places most importance on correctness, then speed, and finally (to a much smaller degree) size. You are encouraged, as a class, to build up a set of your own test programs and share them with each other. When you are finished with your code, turn it in as phase3.mal.

Remember, this project will account for 25% of your course grade.