Microprocessor 4. Philippe Darche

Microprocessor 4 - Philippe Darche


Скачать книгу
In addition, from the perspective of programming, the change of value means a modification in the program since the value field cannot be a destination. The extent of the values (in the sense of Chapter 2 of Darche (2000)) is limited by the number of bits remaining after subtraction of those bits reserved for coding the operation itself (a similar limitation for the address for direct and relative addressing). In its extended or long version, the format is double that of a short format. The possibility of choosing makes it possible to decrease the number of clock cycles to fetch the operand. An alternative to this mode is register addressing, which contains a constant value, which is materially fixed. This is the current practice with RISC microprocessors (this will be covered in a future book by the author on microprocessors) such as Arm®, whose register r0 contains the null value (cf. § V3-3.1), which can serve for initialization and avoids time-consuming external access to the main memory.

      1.2.2. Register addressing

      The use of registers makes it possible not to slow the microprocessor down since the registers are integrated. An instruction that uses them in addressing mode will only require external access to fetch the instruction code. It is possible to address a register in two ways, explicitly and implicitly.

      1.2.2.1. Explicit addressing

      The operand field operand(s) R specifies the registers used for execution. It is sometimes called register (direct) addressing, the term “direct” indicating that the referencing in the register is found in the instruction coding, as for the direct memory address (Figure 1.9). These registers are accessible to the programmer. There is no effective address since the memory is not addressed, hence a fast execution of the instruction using it and a small instruction format. It is for this reason that RISC microprocessors prefer to use this mode. For other architectures, the number of registers accessible to the programmer is limited (order of size: about 20).

Schematic illustration of the execution of an instruction using register addressing from one register.

      Figure 1.9. Execution of an instruction using register addressing from one register

      The example below shows an addition in an Arm® microprocessor, which uses three registers: r0, r1 and r2:

      ADD r0,r1,r2; r0 ← r1 + r2

      Note, a distinction can be made between Data Register Direct Addressing and Address Register Direct Addressing as for MC68000 (cf. § V3-3.1.1).

      1.2.2.2. Implicit register addressing

      LDB #$FA; B ← FA16

      If the name of the registers does not appear in the mnemonic, then only a detailed reading of the technical documentation can specify the name of these registers. In the example below (MC6809), the instruction for multiplication mul (without operands) implicitly uses both implicit accumulator registers A and B and stores the concatenated result in these same registers, and the MSB (Most Significant Byte) is found in accumulator A, which in pseudo-code gives: A:B ← A × B.

      Another example is the instruction from 8086 mul bl, which uses the implicit register A as source and destination operands in the case of multiplication in 8-bit format (ax ← bl × al for this example).

      To generalize, an instruction lacking one or more operands found in a register (an accumulator for example) or in memory uses implicit addressing. We find this mode in machines with a single address called an accumulator or in the extreme case of zero-operand computers also called stack or pushdown-store machine (cf. § V1-2.7.1). By broadening the definition to registers that are not accessible to the programmer, any instruction for its execution uses the PC (Program Counter), which is therefore implicit.

      1.2.3. Memory addressing modes

      It is possible to address the memory in a direct, relative, indirect, indexed or based manner. Combinations of these modes are possible. Other specific modes are then presented.

      1.2.3.1. Direct addressing

      [1.1]

Schematic illustration of an instruction with direct addressing.

      Figure 1.10. Instruction with direct addressing

      It can be used by jump instruction to branch to a set location in the program. This mode is in fact an indirect mode with auto-incrementation using the PC (Program Counter) as an indirection register (cf. § 1.2.3.3 for indirection).

Schematic illustration of an instruction with an address at page 0.

      Figure 1.11. Instruction with an address at page 0

      The concept of page zero addressing has been improved with direct page addressing. The direct page is now movable in a larger memory page. The start of the page is addressed by a specialized register (cf. § V3-3.1.1). We cite MC6809 (a page of 256 bytes in a space of 64 KiB, addressing capacity of the MPU itself, direct page (DP) register), the 65CE02 from Commodore Semiconductor Group or CSG (the same as before except that its addressing capacity is higher, base page register B) and the 65816 from the firm Western Digital Corporation (WDC) with an address over 16 bits in the direct page register D.

Скачать книгу