|
|
|
| Table 1.16 Operand value format summary. | | #vald | The decimal value val | | #valh | The hex value val | | #valb | The binary value val | | #valq | The octal value val | | 'char' | The value of the character char |
|
|
|
|
|
|
and Rs2 for sources) are used to specify general cases in the text. Thus, ADD.x Rd, Rs1, Rs2 is a general addition and ADD.xR5, R11, R0 is a specific add using registers 5, 11, and 0. The usage of the .x suffix indicates that no specific addressing mode is being used but that any compatible mode would work. Table 1.16 summarizes the operand representations used in this book. |
|
|
|
|
|
|
|
|
One point to note is that many machines do not differentiate between memory, indirect, and indexed addressing modeswhen using only a 0 offset, the result is the same as if a simple indirect mode were used, and using only a 0 index is the same as a simple memory mode (within the address limitation of the offset field), i.e.: |
|
|
|
 |
|
|
|
|
0[Rx] = [Rx] |
|
|
|
 |
|
|
|
|
X=X[0]. |
|
|
|
|
|
|
|
|
Many more modes are possible, including secondary memory indirections and multiple index sources. One very common complex instruction includes automatic incrementing and decrementing of the value in a register or memory address in conjunction with a reference. These instructions are frequently used in implementing loops and stacks and are occasionally found in some computer languages.11 Although there are definite connections between architectures and computer languages, often a well-designed "general-purpose" computer outperforms a "language-based" computer in many applications. This is often due to the overhead of implementing highlevel language constructs in hardware. For the most part, in this text we limit ourselves to the basic modes specified in the table. When the use of more complex addressing modes is required, explanations are provided on an as-needed basis. |
|
|
|
|
|
|
|
|
1.5.6 Instruction Code Examples |
|
|
|
|
|
|
|
|
This section attempts to tie together the earlier sections on instruction set characteristics. We show several short fragments from an R/M machine, an L/S machine, and an R+M machine. As a first example, the following code fragment implements a vector summation (for an R/M architecture): |
|
|
|
 |
|
 |
|
|
11The C programming language includes pre-and post-increment and-decrement instructions which correspond directly to these addressing modes. |
|
|
|
|
|