Mippy
Summary
Mippy is a
Forth CPU that I built with TTL
chips.
Goals of Mippy
Mippy was my first electronics project. With this project I
wanted to learn more about processor architecture, design, and
implementation.
The design of Mippy is open to others. Ths web site will
have all the schematics of Mippy. Also, I will be sure to state
when I made bad decisions and mistakes. This is, after all, a
learning project. ;-)
Architectural Summary
Mippy is a 1MHz, 16 bit Forth
machine built from scratch using 74HCT00 series TTL chips. The
data bus and address bus are separate, each 16 bits wide.
Mippy supports:
- two stacks: data stack & return stack
- a full ALU
- branches
- instructions with embedded immediate values
- interrupts
- micro-code sequencer
There are only 3 programmer visible registers and one state
bit:
- 16 bit Program Counter (PC)
- 16 bit data Stack Pointer (SP)
- 16 bit Return stack Pointer (RP)
- Interrupts Enabled bit
Instructions are decoded into a micro-code address and fed
into the sequencer.
Brief History
Mippy was born when I had some
time after leaving a job. I had a bunch of free time on my
hands and decided, like everybody else in the computer world,
that I wanted to build a CPU to my specifications. I read the
PDP-11 specifications (only later did I learn about
the whole PDP family and
its architectural beauty).
Thinking about what to do with a CPU if I built one, I
thought about the frustrations of a development environment.
Ideally, the system would be self hosted. This requires I/O (a
terminal would suffice for my needs), some sort of storage (a
serial line to a host system would suffice.
But, the software: Assembler? That's a tough environment to
do much work in. I know, I know: lots have done it before me.
Sure, and I've written my share of assembler (6502, 68000,
PowerPC, Alpha, and MIPS64). But, that wasn't what I'd want. C
wasn't ideal for two reasons: first, it required an assembler
(because of low-level code that can't be expressed in high
level C, and really a C compiler should generate assembly for
review) and a C compiler is a bear (now there's the
Icc, but at the
time I hadn't seen it).
Basic is of course out as a systems language because it
depends on the primitives that it would need to implement.
Then I thought about Forth. Hmmm. There's a system that's
fully self-contained. The assembler, compiler, and editor are
all part of the same environment. Further, a Forth system can
usually be developed in very few K of memory.
Indeed, a Forth language on top of whatever processor
architecture I devised would be my goal. From there I could
build compilers (C and Pascal leap to mind).
That's when it occured to me, why not just build a Forth
CPU?
Mippy's Name
Last, you might be wanting to ask, "Where did the name
Mippy come from?" Early in the
development phase I used a Basic Stamp II as a front side bus.
Each CPU clock cycle was initiated by the Basic Stamp. After
strobing the clock, the stamp would read the Data Bus, Address
Bus, and control signals and send them to a Linux host system.
The software on the Linux system then decided what course of
action to take based on the bus state. It then shipped back a
response over the serial port and that was then fed into the
front side bus and another CPU clock cycle was initiated.
That's a terribly slow process. Roughly one clock cycle per
second. A friend pointed out that there are only 32 million
seconds in a year, so my computer couldn't be that fast (by
comparison modern processors are operating at 1, 2, and 3
billion clock cycles per second). That's when I decided that my
CPU was capable of Millions of Instructions Per Year: MIPY.
Spelling it Mippy just seemed better.
Demonstrations
Here is the text from the
demo software that
dad
and I showed at the
5th Annual
Vintage Computer Fair.
: dia'
rtz
dup 1 = over 2 = or
if 'C' else '!' endif
swap 1 - dia'
;
: dia-emit
rtz emit dia-emit
;
: dia
SENTINEL swap dia'
dia-emit
;
And here's the output of that algorithm (actually this isn't true):
OK 9 diamond
C
CC!
CC!!!
CC!!!!!
CC!!!!!!!
CC!!!!!!!!!
CC!!!!!!!
CC!!!!!
CC!!!
CC!
C
OK