CHAPTER 12.
GAPP ASSEMBLER
1.
INTRODUCTION
GAPP OPCODES AND MNEMONICS
GAPP is a SIMD (Single Instruction Multiple Datapath)
parallel processing device. Many
GAPP devices can be connected to form a two-dimenional array with east-west and
north-south nearest neighbor connections.
All GAPP devices in an array executes the same instruction in one
machine cycle. A GAPP instruction
consists of 13 bits of opcode and 7 bits of RAM address, which can be
represented in the following format:
12 11 10 9
8 7 6
5 4 3
2 1 0
----------------------------------------
GAPP
Opcode | RAM | C-REG | EW | NS | CM |
----------------------------------------
6 5
4 3 2
1 0
----------------------
RAM Address | address |
----------------------
The assembler will thus generate two 16 bit words for
each macro instruction. They are
stored in memory as one 32 bit word.
The most significant 16 bits contain the RAM address, and the least
significant 16 bits contain the GAPP opcode.
THE F83 ENVIRONMENT
F83 is a language and operating system based on the
computer language FORTH according to the most recent FORTH-83 Standard. It is extremely powerful as a
meta-language because it contains all the necessary tools to build new
languages according to specified syntax and grammar. However, if the syntax requirements are
specified in terms of the reversed Polish or post-fixed style common to most
FORTH system, the new language can be defined very conveniently while retaining
all the utilities resident in the host FORTH operating system. This GAPP assembler is defined in this
fashion to take advantage of the conciseness and interactiveness of FORTH.
The GAPP assembler is a collection of FORTH words or
instructions which are then be used to describe or define GAPP macro
instructions in mnemonic form.
These descriptions are the cource code of GAPP macro instructions stored
in files. When the descriptions are
processed by the FORTH interpreter, the mnemonics are translated into macro
code which are stored temporarily at the end of the source file. A large number of data blocks at the end
of the source file are dedicated to the microcode. These microcode blocks should not be
sent to a printer.
A number of FORTH utilities words are also provided
to let the user to examine and modify the macro instructions either in the
file. User can interact closely
with both the assembler and the microcode, making the programming activity high
productive and shorten considerably the time to program and debug the GAPP
code.
USING THE GAPP ASSEMBLER
The GAPP assembler and a collection of macro routines
are defined in a file named GAPPASSM.BLK.
To execute the assembler and down load all these macro routines to the
macro generators, the user should type the following commands:
F83
GAPPASSM.BLK
(load F83 and open file) OK
(load
assembler and
assemble macro routines) BYE
(exit assembler)
After typing 'OK', the computer will load the GAPP
assembler and assemble all the macro routines defined in this file. While the assembler is translating the
source code, a list of macro names and their assembler code will be displayed
on the console screen. With
appropriate printer commands or output redirection, this listing can be printed
on a line printer or saved in a separate file for later reference.
2.
THE GAPP ASSEMBLER
THE ASSEMBLER COMMANDS
The assembler commands are a collection of FORTH
words which cause GAPP instructions to be translated and stored at the end of
the file. They are used to control
the process of assembly and manage other activities such as outputing assembled
code to a line printer or to the console.
These words are listed and their functions explained as follows:
INIT
Clear the temprary file
space. Initiate the assembling
process.
_$_
Terminate the GAPP instruction
assembling process and store the GAPP
instruction. Begin assembling the next GAPP
instruction.
G: <name> Mark
the address of the current GAPP instruction, and assign it a label
<name>. This
label will be used to call the macro routine by the flow program compiler.
DOWNLOAD Download
all the GAPP instructions so far
assembled to the GAPP array.
GDUMP
Dump a range of
GAPP instructions on the console
for inspection.
DUMP-DMC Dump
a range of the Program Memory in the GAPP array to inspect the microcode.
GAPP MNEMONICS AND OPCODES
GAPP mnemonics are of the general format:
dest1[:dest2[:dest3[:dest4]]]=src
where dest represent register or memory as
destination of data and src is a register or memory providing data in a GAPP
machine cycle.
dest
CM, NS, EW, C, P (for RAM memory).
src
CM, NS, EW, C, P, N, S, E, W, 0
and 1
Only those combinations which are valid in a GAPP
processor array are defined.
Invalid combinations will generate an error message and cause the
assembling process to abort.
Besided these explicit GAPP opcode mnemonics, there
are a set of implicit mnemonics which express the functions more clearly:
CARRY Copy carry output to C register.
BORROW Copy borrow output to C register.
PLUS
Copy the sum output to a RAM
memory plane.
SOUTH Copy CM or south neighbor to CM register.
-dest=0 Copy 0 to all registers except dest.
Examples: -CM=0, -NS=0, -EW=0, -C=0
-dest=P Copy RAM memory to all registers but dest.
Examples: -CM=P, -NS=P, -EW=P, -C=P
4R=0
Copy 0 to all registers.
4R=P
Copy RAM memory to all registers.
GAPP ADDRESS OPCODE
The GAPP address mnemonics will assemble code into
the 16 bit address field in a GAPP instruction, which is processed in parallel
with the GAPP opcode. Within one
GAPP instruction or between two consecutive _$_ commands, the order of address
opcode and GAPP mnemonics is not important. GADR is the general address opcode
command which can be used to put any 16 bit pattern into the address field:
GADR Assemble
the 16 bit number before GADR into the 16 bit GAPP address field in the current
GAPP instruction. Only the lower 7
bits are taken by the GAPP array as
RAM address.
Other bits are ignored.
However, unused bits can be used to
carry
information to control the GAPP array.
3.
MACRO ROUTINE LIBRARY
An extensive collection of macro routines are coded
and available in the macro routine library, as the result of our
experimentation with the GAPP array.
The source of this library is also contained in the file
GAPPMAC.BLK. It is assembled when
GAPPMAC.BLK is loaded with F83 and interpreted. User defined macro routines can be
entered into this file and assembled with the library. In eventual applications, those macro
routines not used by the program can be commented out so that they will not be
assembled into the application program.
The source code of this assembler and some examples
of the macro routine library are shown in Listing 13.
Source code of the assembler and the macro routines
are stored in block files, which are divided into blocks of 1024 bytes. Each block of text can be entered,
edited, and interpreted under the FORTH operating system. F83 provides a very simple and easy to
use screen editor for these purposes.
Blocking the source code into 1024 byte segments imposed on the
programmer a discipline of modularization, which makes the macro routines easy
to enter and to be debugged.
Excellent references are available on how the F83
functions and how to use the screen editor in it for programming.
Listing 13. GAPP assembler on PC
Figure 22.
NCR GAPP brochure
[1]