Page:Forth Dimension Volume 01 Number 1.pdf/4

 ==USING FORTH FOR TRADEOFFS BETWEEN HARDWARE/FIRMWARE/SOFTWARE==

By Dave Wyland

FORTH provides a unique capability for changing the tradeoffs between software, firmware, and hardware. This capability derives from the method of nested definition of operators in FORTH.

Firmware (i.e. microprogramming) can add new instructions to the instruction set of an existing machine. New hardware designs can also add instructions to an existing set, with the Z80 upgrade of the 8080 serving as a good example. These new instructions could significantly improve the throughput of a system in many cases: however these new instructions cannot be used with existing software without rewriting the software. This is because current software methods such as assembler language, BASIC interpreters, FORTRAN compilers, etc., create software programs as one list of instructions. To add improved instructions to a program generated by a FORTRAN compiler involves rewriting the compiler to efficiently use the new instructions and then recompiling the program. This is not a trivial task since decisions must typically be made as to when to use a new instruction. This is why each new machine requires a new, rewritten FORTRAN compiler, The fact that the job has been done many times before is not very comforting.

With FORTH, however, operations are built-up of nested definitions with a common functional interface between operations. If a new instruction has been added to the computer's instruction set, it can be added to the FORTH system by changing a small number of definitions, in the typical case. The method can be quite straightforward. Each new instruction does an operation which would have required several instructions in the previous case. By identifying those FORTH definitions which could benefit from the new instructions and recoding them to include it, all software which uses the modified definitions is immediately improved. Also, very few definitions will have to be modified: only those elementryelementary [sic] definitions with a high frequency of use need be modified to achieve throughput increase near the maximum possible.

Since the FORTH definitions are nested, the throughput gain of new instructions can be achieved by modifying a small amount of code, and the remaining structures remain unchanged. All existing application programs, translators, etc. are immediately improved without change!

Note that this process is reversablereversible [sic]. Programs created for an existing system which has an extensive instruction set can be run on a simpler machine by converting the appropriate code based definitions to nested (colon) definitions. The process is also incremental: new instructions can be added one-at-a-time as desired. Rh FORTH INTEREST GROUP