Table Of ContentSTACK
COMPUTERS
the new wave
PHILIP KOOPMAN, Jr.
Vice President, WISC Technologies
Pittsburgh, USA
Reprinted and Distributed by
Mountain View Press
‘Originally published by Elis Horwaod in 1989,
now available on the World Wide Web and on disk rom Mountain View Press
Reprinted and Distibuted by
Mountain View Prees
Foute 2 Box 429
La Honda, CA 94020
©1989 Philip J. Koopman, Jt.
Copyright Notice
All Rights Reserved. No part of his publication may be reproduced, stored In
22 retrieval system, oF transmitted, In any form or by any means, elactronic,
‘mechanical, photocopying, recording oF otherwise, without the permission of
Philp J. Koopman, J, Carnegie Mellon University, Pitsburgh, Pennsylvania,
USA
Table of contents
Foreword...
Preface. vee
L
2
[nfroduction and Revlew
LI Overview.
12 What isa stack?
1.2.1 Cafeteria tray example
1.2.2 Example software implementations
1.2.3 Example hardware impiememtations
1.3 Why are stack machines important?
1.4 Why are stacks used in computers?
1.4.1 Expression evaluation stack
1.4.2 The return address stack
14.3 The local variable stack
1.4.4 The parameter stack
1.4.5 Combination stacks... 2.
LS The new generation of stack computers
1.6 Highlights from the cest of the book. . «-
A Toxonomy of Hardware Stack Support 4
2.1 The three-axis stack design space . . 24
2.1.1 Single vs, multiple stacks sees oa
2.1.2 Size of stack buffers ore 6
2.1.3 O-, 1-, and 2-operand addressing... 12
2.2 Taxonomy notation and caregories roe 8
22.1 Notation 2»
List ofthe categories inthe design space 29
2.3 Interesting points in the taxonomy. 2
‘Muluple-stack, D-operand Machines. =... +. 2
3.1 Why these machines are inceresting ar
3.2 A genene stack machine 33
3.2:1 Block diagram. : tee 3
3.2.2 Data operations. 35
3.2.3 Instruction execution 4
3.2.4 State changing. . a
3.3 Overview of the Forth programming language || rf
3.3.1 Forth as a common thread
3.3.2 The Forth virtual machine...
3.3.3 Rmphasis on interactivity, flexibility
4. Architecture of 16-bit Systems...
4.1 Characteristics of 16-bit designs
4.1.1 Good fit with the traditional Forth model .
4.12 Smallest interesting width... .
4.1. Small size allows integrated embedded aysiem
4.2 Architecture of the WISC CPUS.
42.1 Introduction. .
4.2.2 Block diagram.
4.2.3 tastruction sel summary
4.2.4 Architectural features
4.2.5 Implementation and featured application areas’.
4.3 Architecture of the MISC M17
4.3.1 Introduction
4.3.2 Block diagram, :
4.3.3 Instruction set summary
4.3.4 Architectural features
4.3.5 Implementation and featured application areas
4.4 Architecture of the Novix NO4016.
44.1 Introduction
4.4.2 Block diagram -
4.43 Instruction set summary
4.4.4 Architectural features.
4.45 Implementation and featured application areas.
4.5 Architecture of the Harris RTX 2000
4.5.1 Intraduction ree
4.5.2 Block diagram,
4.5.3 Instruction set summary
43.4 Architectural features. :
4.5.5 Implementation and featured application areas’.
4.5.6 Standard cell designs . .
5. Architecture of 32-bit Systems
5.1 Why 32-bit systems? .
5.2 Architecture of the FRISC 3 (sc32)
5.2.1 Introduction
5.2.2 Block diagram,
5.2.3 Instruction set summary
5.2.4 Architectural features...
5.2.5 Immplementation and featured spplcnion areas
3.3 Architecture of the RTX32P....
5.3.1 Introduction ..
5.3.2 Block diagram.
5.33 Instruction set summary
5.3.4 Architectural features,
CONTENTS 7
5.3.5 Implementation and featured application arews. .
5.4 Architecture of the SF1.
9.4.1 Introduction «
5.42 Block diagram. .
3.4.3 Instruction set summary
S44 Architectural features: :
5.4.5 {implementation and featured application areas
Understanding Stack Machines. 6606.00 eee eee eee
6.1 Am historical perspective
6.1.4 Register vs, nontegister machines
6.1.2 High level language v3. RISC machines. :
6.2. Architectural differences from conventional machines
6.2.2 Program size. .
6.2.2 Processor and system Supe
6.2.3 Processor performance
6.2.4 Program execution consistency . .
6.3. A study of Forth instruction frequencies
63:1 Dynamic imtructon fequenis
2 Statie instruction frequencies
633 Instruction compression on the RIXSZP
64 Stack management issues.
641 Estimating stack size! an experiment
6.4.2 Overiiow handling
6.5 Interrupts and outictasking. .
6.5.1 Interrupt response latency .
6.5.2 Lightweight internupts
65.3 Content switches
Software Issues
7.1 The importance of fast subroutine call
7.1.1 The importance of smal procedures.
7.L.2 The proper size for a procedure
7.13 Why progtammers don't use small procedures
71a Architectural support for procedures
7.2 Languaye choice
7.2.1 For: strengths and weaknesses
7.2.2 C and other conventional languages.
12.3 Rolebased sss and funtion programming
7.3 Uniformity of software interfaces. .
Applications... eee eee
8.1 Realtime embedded control»
B.LE Requirements of real-time contiol
6.1.2 How stack machines meet these needs
8.2 L6-bit versus 37-bit hardware
8.2.1 l6-hithardware often best -
2 S2-bit hardware sometimes required. .
ear)
108
108
108
109
1m
na
ns
ns
16
7
8 CONTENTS
4.3 System implementation approaches
8.3.1 Hardwired syslems vs. microcoded systems
8.3.2 Integtation level and system costiperformance
8.4 Example application arcas
9. The Future of Stack Computers . .
4.1 Support for conventional languages
9.1.1 Stack frames :
9.1.2 Aliasing of registers and memory
9.1.3 A strategy for bandling stack frames
9.1.4 Conventional language execution efficiency
9.2. Virtual memory and memory protection
8.2.1 Memory protection is sometimes importaat
9.2.2 Virtual memory is not used én controllers
9.3 The use ofa third stack.
9.4 The limits of memory bandwidth
9.4.) The history of memory bandwidth problems
9.42 Current memory oundwidth conecms.
9.4.3 The stack machine solution
9.5 Two ideas for stack machine design -
9.5.1 Conditional subroutine returns
9.5.2 Use of the stack for holding code
2.6 The impact of stack machines on computing .
Appendix A. A Survey of Computers with Hardware Stack Support
Appendix B.A Glossary of Forth Primitives -
(Coabridged Instruction Frequencies
Appenndia D. Addresses for More Information .
References
Index . betes BB
Foreword
During the past 8 yeurs of chairing ite Rochester Forth Conference, have
had a chance to focus on 3 variety of computer applications and implemen
(ations, Although the 1945 Conference covered Sofware Productivity, the
arcater interest was in real-time A axl the Novix Forth chip. The following
conference was on Real Time Artifical Intelligence. whica seemed to offer
up almost intractable computing problems in everything from speech
recognition to Strategic Defense. My invited speakers covered rhis grnund
‘well, hough I noted again that an underlying theme of the Conference was
Forth Machines. In pactieular. Listened to papers by Glen Haydon and Vil
oapmanon their WISC CPL 6 {thea called the MVP CPU: processor)
‘These Forth Machines offered performance gains of an ordcr of magni-
tude or more over conventional womputers, xs well asimpartant cradeats in
reduced resource usage: resources iacluding the commonly observed, but
rarely conserved. transistor counts, But the CPUMIS processor also offeved
avother gain: an integrated learning environment from computer architec-
sure through programming langusgcs, and operating systems through reat
applications. In two orthree semesters, a student could rcusomably expect 10
build a computer, use microcode, develop a high level language, add aa
operating system, and do something with it. Immediately, 1 saw answec (0
the continuing fragmentation of computer science and electrical engineering
curticula, and a practical way of rejoining hardware and software.
The following yeat | asked Phil to be an invited speaker at my Confer-
cncs on Comparative Compuler Architectures. By thea his ideas on wris
table instruction set, stack computers were fulldledged, not justin theary,
boutin fact, During successive nights of the Conference, his 32-bit MSI-based
processor amazed 2 growing group of followers as it cranked out fractal
landscapes and performed Conway's Came of Life via an expert sytem.
After the Conference T knew Phil was beginning incensive studies al
Cacnegie Mellon University. and starting what would become this book,
‘What Fcidn’t know was that he sas also reducing bis processor to a chip sct
He began hinting at great things to come dusing the Spring of 1988, and he
presented the operational Hlatris RTX 32P that June. The speed with which
the WISC CPU/32 was teduced to the RTX 32P speaks well of Phit's
FOREWORD 11
capabilities, the soundness of bis architecture, and the support Harris
Semiconductor has put behiral this technology. Row I can’t wait to heat in
‘detail what he's bean hinting at duing with the processor, and getting Tay
sands on ong too!
[AS for this book, it presents another view of the RISC versus CISC
controversy, and if only for its cammentasy on that debate it would be
worthwhile, Yet, it does comiderably more. It provides key insights meo
hhow stuck mnacbines work. and what their strengths anu weaknesses are. [t
presents a taxonomy of existing serial processors and shows that for nvr 25
years the slack architecture has been subtly influencing both hardware and
Software, but that major eompatacional gains have begun in only the past
few years. Although stack prucessors are unlikely to dominate the much
Publiczed coginering workstation matket, they may very weil Bil enur-
mously larger niches in everything from consumer clectranics to high-
performance military avionics
‘Alter you read this book, find yourselé a stack machine and take it for &
spin.
Lawrence P, Forsley
Publisher, The Journal of Forth Application and Research
Rochester, New York
Preface
This Dok is about the new breed of stack computers sparked by the
ictroduction of the Novix NCSOI6 micropracessor. Some readers may
‘incorrectly assuciate any reference tu stack computers with the Bucroughs oF
HP stack machine famzlies, The focus of this book is quite different, These
new stack competers encompass an antirely different set of technology and
application area tradcotis, casalting in machines that ure quite ualiky the
older generations of stack computers,
Tas Book covers a wide vanety of topics so that these new stack
machines may be understood not only for theie techaicat merits, but also
within the contest of how they can be used ta soive problems, and where
they fin the overall computer architecture picure
Chapter § sa review of stacks und their usage, a3 well as an introduction
‘est of the book.
Chapter 2 presents a taxonomy of harclware support for stacks, categor
ized in terms of the number of stucks, size af stack bnlfers, and the number
‘of operands in the instruction format. This taxonomy points out the
tradeoffs that are made by different classes of machines, and shows where
the stack machines discussed in the remainder of the book atin,
Chapter 3 focuses on the part of the stack computer design space that
employs multiple stacks with O-opcrand adéressing, This set of design
tradeoffs characterizes the new generation of stack machines described ia
the following chapters. This chapter also presents detailed description of a
gencric stack machine 2s a puint of departure [or discussing the designs in
subsequent chapters,
Chapter 4 describes four 16-bit stack machines in detail. The WISC
CPUI6, MISC MIT, Novix NC4016, and Harris RTX 2000 cover a wide
Spectrum of design decisions, exploring many ofthe options possible in stack
machine design. Each of the four designs is described in terms of its
block diagram, instruction sot, architectural features, implementation cee
nology, and intended appliestion areas.
Chapter § continues the format of Chapter 4 with a discussion of three
32-bit stack machines. The machines included arc the JHU/APL FRISC 3
(also known as the Silicon Composers $C32), Harris RTX 32P, and the
‘Wright State University SFI
Chapter 6 is « detailed discussion of the issues of stack machine design
from a computer architect's point of view, Stack machines differ from other
c
PREFACE 13
machines in many imigorcant respects, including program size, processor
complexity, system complexity. and processor performance on diffcrent
kinds of programs They can require different ways of thinking aboot
[program execution characteristics and resource management, Much of the
‘conventional wisdom’ about stack machines is incorrect. This chapter
presenss detailed discussions as well as expertmental data to reveal bow
stack machines really work,
Chapter 7 discusses the software issues that arise when using stuc
computers, The concept of 4 last Subroutine eall is cumtral to using a stack
machine effectively, a8 isthe concept of unifurmity of interface between all
levels of hardware and software. This chapter algo discusses the issue of
choosing a programming language, and how stuck machines can efficiently
support many different langaages
Chapter 8 shows how stack machines can be used in a variety of
application areas, expecially real-time embedded vontrol. Important
decisions must be male when selecting a stack computer to use ina
‘commercial product. The alternatives include whether to use a I6-bit or 22-
bit processor, and seleesing an appropriate halance berween system cast and
performace,
Chapter 9 is filed with ptedictions and speculation on the future of stack,
machines ond their place in the warld of computers. Stack machine
designers are boginaing to address issues such as dedicated hardware
suppor forconventonal languages. memory management,and dealing with
the mits of memory bandwidth,
Appendix A isa survey of the stack machines included in the taxonoray ¢:
Chapter 2. With entries for 7) machines, i ig a Single reference summary ct
‘most published designs having special suppor far stacks,
‘Appendix B provides a glossary of Forth primitives,
Appendix C gives an unabridged! ‘isting of some experimental results
from Chapter 6.
‘Appendix D gives addresses for more information abuut the stack
‘machlites discussed in Chapters 4 and 5,
‘The chapters are intended to be 1d more or lev in order. but reers
with varying interests may lind that (hey waat to concentrate onfy on certain
sections of the book. In general the book progresscs from a theorstival busis
for understanding stack machines at the beginning to practical applications
at the end,
Chapters 2.3, 6. and 9 concentrate on understanding the mechanisms of
scack machine operation and the engineering tradeoffs associated with the
stack model of computation, Chapters 4 and $ describe stack machines at
two levels: one for the potential uscr of a stack machine, and one for those
‘who wish to see how design decisions aifect the computer architecture and
performance, Chapters 7 and X are geared more for potential users of stack
machines ssho need answers to practical questions of safrware selection and
application areas. Appendix A will be especially interesting for those
readers who wish to gain a perspective on the history of stack machines,