Inside The Transputer
Blackwell Scientific Publications
ISBN-10: 0-632-01689-2
240 Pages
Preface
The transputer is a family of high performance microprocessors produced by INMOS Limited. One of its most significant features is the ability to perform multi-tasking in hardware, with sub-microsecond context switching. Communication between processes is also provided by hardware, both for internal data transfers, and transfers between different processors.
Unfortunately, there is a dearth of information regarding low-level aspects of the transputer. For a long time, INMOS claimed that since the transputer was specifically designed to efficiently execute the high-level language occam, it was not necessary for programmers to be aware of the machine-code instruction set. They have since had a change of heart, and have released The Compiler Writer's Guide, which describes the instruction set from the point of view of someone wishing to produce a compiler, as well as giving a brief formal definition of each instruction.
While The Compiler Writer's Guide is very good in what it sets out to achieve, it fails to show how the transputer works. For example, it is possible, using a short sequence of instructions, to make a process running on a transputer sleep while waiting for one of several events, such as input from a channel, or a particular time to come to pass. The Compiler Writer's Guide explains how to code such an instruction sequence; what it does not tell you is how this particular instruction sequence actually works. In this book, we have set out to fill this gap.
Chapter 1 gives an introduction to the transputer and occam, while chapter 2 describes the transputer's architecture.
Chapter 3 gives an overview of the instruction set. We have arranged this chapter from the point of view of a machine-code programmer, rather than a compiler writer. For example, all instructions that cause a branch or change in execution address are dealt with together, whereas in The Compiler Writer's Guide they would be dealt with under different categories, such as loops and procedure calls.
Chapter 4 contains many examples of programs written in machine-code, both to give a feel for assembly language programming, and to show some of the things that are impossible to do from occam.
Chapter 5 forms a reference section. Here, each transputer instruction is defined, one per page. We have included a formal definition for each instruction, which we have tried to make as readable as possible, whilst maintaining preciseness. There then follows an informal description of each instruction and finally, in most cases, a short example showing a typical use for that instruction.
Overall, we see this book as being complementary to, rather than in competition with, The Compiler Writer's Guide, and would recommend that the reader obtains a copy of that document too.
We have only included the 'core' transputer instructions in this book, that is to say, ones that are implemented on the T414. This has been done chiefly due to time and space considerations. Nevertheless, these instructions include amongst other things, all the process scheduling and communication instructions, which are the ones most in need of a detailed description.
The authors wish to acknowledge the assistance and encouragement of colleagues at both the Universities of Sheffield and Hull during the preparation of this book.
Finally, please note that INMOS and occam are trademarks of the INMOS group of companies.
Contents
Preface 1 The Transputer 1.1 Background 1.2 The occam Language 1.3 Processes and Concurrency 1.4 occam Instructions 2 Transputer Hardware Description 2.1 Introduction 2.2 Registers 2.3 The Workspace Pointer 2.4 The Instruction Pointer 2.5 The Operand Register 2.6 Communications Links 2.7 Communication Protocol 2.8 Errors 2.9 Time 2.10 Reset, Analyse and Booting 3 Instruction Set Overview 3.1 Addressing and Memory Access 3.1.1 Loading and Storing 3.1.2 Byte Accesses 3.1.3 Addressing Arithmetic 3.2 Arithmetic and Logical 3.2.1 Single Length Arithmetic 3.2.2 Comparing 3.2.3 Bit Operators 3.2.4 Multiple Word Arithmetic 3.2.5 Partword Arithmetic 3.2.6 Floating-Point Support 3.3 Branching and Program Control 3.3.1 Branching 3.3.2 Subroutine Calling 3.4 Process Scheduling and Control 3.4.1 Background 3.4.2 Start Process and End Process 3.4.3 Other Process Instructions 3.4.4 Process Register Manipulation 3.5 Inter-process Communication 3.5.1 Channels 3.5.2 Input and Output 3.5.3 Alternatives 3.5.4 ALT Structure 3.5.5 ALT Instructions 3.6 Miscellaneous 3.6.1 Timers 3.6.2 Flags 4 Example Programs 4.1 Introduction 4.2 Introductory Examples 4.3 Communication Examples 4.3.1 Programs to Inspect Workspace Usage 4.3.2 Pipeline Example 4.3.3 Channel Switching 4.4 Description and Examples Using the ALT Instructions 4.4.1 Implementation of the ALT Instructions 4.4.2 Example of an ALT-like Procedure 4.5 An Example of Recursion Within a GUY Construct 4.6 Idle Time Example 4.7 Simple Loader 4.8 Conclusions 5 Reference Section ADC n ADD AJW n ALT ALTEND ALTWT AND BCNT BSUB CALL n CCNT1 CFLERR CJ n CLRHALTERR CSNGL CSUB0 CWORD DIFF DISC DISS DIST DIV ENBC ENBS ENBT ENDP EQC n FMUL GAJW GCALL GT IN J n LADD LB LDC n LDIFF LDINF LDIV LDL n LDLP n LDNL n LDNLP n LDPI LDPRI LDTIMER LEND LMUL LSHL LSHR LSUB LSUM MINT MOVE MUL NFIX n NORM NOT OPR n OR OUT OUTBYTE OUTWORD PFIX n POSTNORMSN PROD REM RESETCH RET REV ROUNDSN RUNP SAVEH SAVEL SB SETERR SETHALTERR SHL SHR STARTP STHB STHF STL n STLB STLF STNL n STOPERR STOPP STTIMER SUB SUM TALT TALTWT TESTERR TESTHALTERR TESTPRANAL TIN UNPACKSN WCNT WSUB XDBLE XOR XWORD Appendices A Transputer Opcodes B Symbols C Workspace Usage D Instruction Cross-references Bibliography Index