Anatomy of a Robot McGraw-Hill

Page 114

COMPUTER HARDWARE 99

many different computers, some of which have few GP registers. If we have specific software routines (like loops in the robot’s control system software) that we want to speed up, we can pay specific attention to that small area of code. Often, with C language statements, such as the register construct, we can force the compiler to generate code that will use the faster GP registers during computation. We still have to examine the intermediate assembly code to make sure we are getting the results we desire. Certainly, if the robot’s code is written in assembly code, we can force the issue much more easily. The point is, consider the internal register structure of the computer when picking the computer or designing the software. Second, be advised that some computers have more computational hardware than others. All computers have fixed-point computational capabilities, and some have floating-point capabilities as well. Others, as we have discussed, have very special-purpose compute units with DSP or communication hardware built in. Again, take a close look at the computer requirements.

INSTRUCTION SET An instruction set is the base language of the computer. These are generally wordlength, assembly language words that the computer can look at to understand what it must do during the execution of a program. It does not matter whether the program is written in C, Forth, C , Fortran, or assembly language. The compilers and assemblers always must reduce the program to a series of instruction-set commands that the computer can execute. In assembly language, they look something like this: ADD SUB

r0, r1 r2, r3

(Add GP register 0 to GP register 1) (Subtract GP register 2 from GP register 3)

When translated to binary, they would reside in instruction words like this (to use an imaginary 8-bit computer instruction set): Bit OpCode Source register Destination register where the OpCodes are 0000 for add 0001 for subtract and so on ADD r0, r1 codes as SUB r2, r3 codes as

7 x

0 0

6 x

0 0

5 x

0 0

4 x

0 1

3

2

x

x

0 1

0 0

1

0

x

x

0 1

1 1


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.