
CS 2410 Fall 2008
Course Project Step 1 -- Stack Instruction Set Architecture
Due: October 6, 2008
The course project is to design and simulate a stack-based instruction set architecture. In this first
step, you will define the ISA. Although you have significant freedom in the ISA’s design, the goal
is to keep the ISA as simple and minimal as possible. There are some constraints:
• The ISA must be stack-based.
• PUSH and POP are the only instructions that may have a single operand (e.g., the memory
address to push from or pop to, or possibly an immediate to push onto the stack).
• Any computation must be done through the stack; i.e., the instructions should manipulate
values via the stack (e.g., an ADD pops its operands and pushes its result).
• You should support at least the data types: integer, character (byte) and address.
• The instruction set should be rich enough to run the four programs: mathfun, matmul,
funptr, and fact. These programs are on the CS 2410 web site. Other programs will be pro-
vided at the end of the semester for the “bake off”. They will rely on similar operations as
these four example programs.
• No registers are permitted in the instruction set.
The ISA should be designed according to the principles outlined in class (see lectures from 8/27,
9/3 and 9/8). Some items to keep in mind are: the calling convention, memory storage for globals
and arrays, special stack manipulations (e.g., duplicate, peek), control transfers and target address
specification, memory addressing modes, memory layout, assembly language and file format, etc.
Remember the goal: Keep it simple! My expectation is you’ll have around 16 opcodes, with a few
addressing modes. Keep in mind that the next project step will be to write a simulator for your
instruction set. If you keep the ISA simple, this next step will go much easier.
The instruction set design will be a specification. The specification includes several documents:
1. Instruction set manual. This brief manual describes the instruction set. It should include the
opcodes and their semantics. It should also give addressing modes, memory layout, stack struc-
ture, and calling convention. Finally, it should specify a binary encoding for the instructions.
2. Examples. This document shows the four programs on the CS 2410 web site implemented with
your stack instruction set. You need to translate the programs by hand. That is, give the assembly
for the four programs. You may find it helpful to have syntax for address labels and memory ini-
tialization.
3. Justification. This brief document will justify your choices. Explain why you made certain
decisions; e.g., why did you include certain opcodes? Be sure to indicate other choices that you
considered and why you discarded them.
Please print these documents and turn on the due date (include group member names!).