轮廓模式和同步周期模式_地址模式和说明周期

轮廓模式和同步周期模式

地址模式和说明周期 (Adressing Modes and Instruction Cycle)

The operation field of an instruction specifies the operation to be performed. This operation will be executed on some data which is stored in computer registers or the main memory. The way any operand is selected during the program execution is dependent on the addressing mode of the instruction. The purpose of using addressing modes is as follows:

指令的操作字段指定要执行的操作。 将对存储在计算机寄存器或主存储器中的某些数据执行此操作。 在程序执行期间选择任何操作数的方式取决于指令的寻址模式。 使用寻址模式的目的如下:

  1. To give the programming versatility to the user.

    为用户提供编程的多功能性。
  2. To reduce the number of bits in addressing field of instruction.

    减少指令寻址字段中的位数。

寻址模式的类型 (Types of Addressing Modes)

Below we have discussed different types of addressing modes one by one:

下面我们逐一讨论了不同类型的寻址模式:



即时模式 (Immediate Mode)

In this mode, the operand is specified in the instruction itself. An immediate mode instruction has an operand field rather than the address field.

在这种模式下,操作数在指令本身中指定。 立即模式指令具有操作数字段而不是地址字段。

For example: ADD 7, which says Add 7 to contents of accumulator. 7 is the operand here.

例如: ADD 7 ,表示将7加到累加器的内容中。 此处的操作数为7。

注册模式 (Register Mode)

In this mode the operand is stored in the register and this register is present in CPU. The instruction has the address of the Register where the operand is stored.

在这种模式下,操作数存储在寄存器中,而该寄存器存在于CPU中。 该指令具有存储操作数的寄存器地址。

轮廓模式和同步周期模式_地址模式和说明周期



优点 (Advantages)

  • Shorter instructions and faster instruction fetch.

    较短的指令和较快的指令提取。
  • Faster memory access to the operand(s)

    更快地访问操作数

缺点 (Disadvantages)

  • Very limited address space

    地址空间非常有限
  • Using multiple registers helps performance but it complicates the instructions.

    使用多个寄存器有助于提高性能,但会使指令复杂化。

注册间接模式 (Register Indirect Mode)

In this mode, the instruction specifies the register whose contents give us the address of operand which is in memory. Thus, the register contains the address of operand rather than the operand itself.

在这种模式下,指令指定了一个寄存器,其内容为我们提供了内存中操作数的地址。 因此,寄存器包含操作数的地址,而不是操作数本身。

轮廓模式和同步周期模式_地址模式和说明周期

自动递增/递减模式 (Auto Increment/Decrement Mode)

In this the register is incremented or decremented after or before its value is used.

在这种情况下,寄存器的值在使用其值之前或之后递增或递减。

直接寻址模式 (Direct Addressing Mode)

In this mode, effective address of operand is present in instruction itself.

在这种模式下,操作数的有效地址存在于指令本身中。

  • Single memory reference to access data.

    用于访问数据的单个内存引用。
  • No additional calculations to find the effective address of the operand.

    无需其他计算即可找到操作数的有效地址。

轮廓模式和同步周期模式_地址模式和说明周期

For Example: ADD R1, 4000 - In this the 4000 is effective address of operand.

例如: ADD R1, 4000在此4000是操作数的有效地址。

NOTE: Effective Address is the location where operand is present.

注意:有效地址是存在操作数的位置。

间接寻址模式 (Indirect Addressing Mode)

In this, the address field of instruction gives the address where the effective address is stored in memory. This slows down the execution, as this includes multiple memory lookups to find the operand.

这样,指令的地址字段给出有效地址存储在内存中的地址。 这会减慢执行速度,因为其中包括多次查找操作数的内存。

轮廓模式和同步周期模式_地址模式和说明周期

位移寻址模式 (Displacement Addressing Mode)

In this the contents of the indexed register is added to the Address part of the instruction, to obtain the effective address of operand.

在这种情况下,将索引寄存器的内容添加到指令的“地址”部分,以获得操作数的有效地址。

EA = A + (R), In this the address field holds two values, A(which is the base value) and R(that holds the displacement), or vice versa.

EA = A + (R) ,在此地址字段包含两个值,A(是基值)和R(包含位移),反之亦然。

轮廓模式和同步周期模式_地址模式和说明周期

相对寻址模式 (Relative Addressing Mode)

It is a version of Displacement addressing mode.

它是置换寻址模式的一种版本。

In this the contents of PC(Program Counter) is added to address part of instruction to obtain the effective address.

在此,将PC(程序计数器)的内容添加到指令的地址部分以获得有效地址。

EA = A + (PC), where EA is effective address and PC is program counter.

EA = A + (PC) ,其中EA是有效地址,PC是程序计数器。

The operand is A cells away from the current cell(the one pointed to by PC)

操作数是远离当前单元格的一个单元格(PC指向的那个)

基址寄存器寻址模式 (Base Register Addressing Mode)

It is again a version of Displacement addressing mode. This can be defined as EA = A + (R), where A is displacement and R holds pointer to base address.

它还是置换寻址模式的一种版本。 可以定义为EA = A + (R) ,其中A是位移,R持有指向基地址的指针。

堆栈寻址模式 (Stack Addressing Mode)

In this mode, operand is at the top of the stack. For example: ADD, this instruction will POP top two items from the stack, add them, and will then PUSH the result to the top of the stack.

在这种模式下,操作数位于堆栈的顶部。 例如: ADD ,此指令将从堆栈中弹出顶部的两个项目,添加它们,然后将结果入堆栈的顶部。

指令周期 (Instruction Cycle)

An instruction cycle, also known as fetch-decode-execute cycle is the basic operational process of a computer. This process is repeated continuously by CPU from boot up to shut down of computer.

指令周期,也称为获取-解码-执行周期,是计算机的基本操作过程。 从启动到关闭计算机,CPU都会连续重复此过程。

Following are the steps that occur during an instruction cycle:

以下是在指令周期内发生的步骤:



1.取指令 (1. Fetch the Instruction)

The instruction is fetched from memory address that is stored in PC(Program Counter) and stored in the instruction register IR. At the end of the fetch operation, PC is incremented by 1 and it then points to the next instruction to be executed.

从存储在PC(程序计数器)中并存储在指令寄存器IR中的存储器地址中提取指令。 在提取操作结束时,PC递增1,然后指向要执行的下一条指令。



2.解码指令 (2. Decode the Instruction)

The instruction in the IR is executed by the decoder.

IR中的指令由解码器执行。



3.阅读有效地址 (3. Read the Effective Address)

If the instruction has an indirect address, the effective address is read from the memory. Otherwise operands are directly read in case of immediate operand instruction.

如果指令具有间接地址,则从存储器中读取有效地址。 否则,在立即操作数指令的情况下,将直接读取操作数。



4.执行指令 (4. Execute the Instruction)

The Control Unit passes the information in the form of control signals to the functional unit of CPU. The result generated is stored in main memory or sent to an output device.

控制单元将信息以控制信号的形式传递给CPU的功能单元。 生成的结果存储在主存储器中或发送到输出设备。

The cycle is then repeated by fetching the next instruction. Thus in this way the instruction cycle is repeated continuously.

然后通过获取下一条指令来重复该循环。 因此,以这种方式连续地重复指令周期。

轮廓模式和同步周期模式_地址模式和说明周期

翻译自: https://www.studytonight.com/computer-architecture/addressingmodes-instructioncycle

轮廓模式和同步周期模式