一个机器周期 计算机
机器周期 (Machine Cycle)
The cycle during which a machine language instruction is executed by the processor of the computer system is known as the machine cycle. If a program contains 10 machine language instruction, 10 separate machine cycles should be executed for running the program. As the machine cycle contains four phases namely fetching, decoding, executing and storing.
由计算机系统的处理器执行机器语言指令的周期称为机器周期 。 如果程序包含10条机器语言指令,则应运行10个单独的机器周期来运行该程序。 由于机器周期包含四个阶段,即获取,解码,执行和存储。
The four-phase of the machine cycle is usually grouped into two categories:
机器周期的四个阶段通常分为两类:
Instruction cycle
指令周期
Execution cycle
执行周期
1)指令周期 (1) Instruction cycle)
This concept describes the execution sequence of the program. Instruction cycle includes the first two phases, fetching and decoding.
这个概念描述了程序的执行顺序。 指令周期包括前两个阶段,即获取和解码。
i)提取周期 (i) Fetch cycle)
In this cycle, the instructions related to binary sequence is transferred from the memory to CPU.
在该循环中,与二进制序列相关的指令从存储器传送到CPU。
CPU generates the memory request based on the program counter to read the instruction from the memory.
CPU根据程序计数器生成存储器请求,以从存储器中读取指令。
Program Counter holds the starting instruction address and immediately points the next instruction address.
程序计数器保存起始指令地址,并立即指向下一个指令地址。
Here, the starting address is provided by the user and the next instruction address is calculated by incrementing.
此处,起始地址由用户提供,下一条指令地址通过递增来计算。
Step size is depending on the size or length of the instruction i.e. if the instruction size is n byte then the step size is n.
步长取决于指令的大小或长度,即,如果指令大小为n字节,则步长为n。
When the processor supports with fixed length instruction then the PC is incremented to affixed constant during the fetch cycle to points the next time instruction address.
当处理器支持固定长度的指令时,则PC在读取周期内递增到固定的常数,以指向下一个时间指令地址。
So during the fetch cycle only the OPCODE related byte to transfer to the CPU. Then PC will be incremented by 1. During the decoding process, the program counter is incremented the next instruction address.
因此,在获取周期中,只有与OPCODE相关的字节才能传输到CPU。 然后PC将增加1。在解码过程中,程序计数器将增加下一个指令地址。
The process of transfer the instruction related binary sequence from the memory to CPU is called an instruction fetch.
将指令相关的二进制序列从存储器传输到CPU的过程称为指令提取。
ii)解码 (ii) Decoding)
This phase of instruction cycle is responsible for breaking down the instruction into different parts so that it can be easily understood before being processed by the CPU. The Instruction is usually decoded by the instruction decoder which is a vital component of the CPU. The decoding of an instruction is also known as interpreting. The instruction is interpreted to determine two keys attributes of an instruction the opcode and the operands. the type of operations to be performed is identified by the opcode and the data on which the operation is to be performed is identified by the operand. Data is transferred to the Data Register (DR).
指令周期的这个阶段负责将指令分解为不同的部分,以便在被CPU处理之前可以很容易地理解它。 指令通常由指令解码器解码,而指令解码器是CPU的重要组成部分。 指令的解码也称为解释。 解释该指令以确定操作码和操作数的一条指令的两个键属性。 操作码标识要执行的操作的类型,操作数标识要执行的数据。 数据被传输到数据寄存器(DR)。
2)执行周期 (2) Execution cycle)
Execution cycle includes two phase executing and storing. The execution cycle executes the instruction and stores the result back to the main memory or sends it to the output device of the computer system.
执行周期包括两个阶段的执行和存储。 执行周期执行该指令并将结果存储回主存储器或将其发送到计算机系统的输出设备。
i)执行 (i) Executing )
The objective of the execution cycle processes the currently fetched instructions.
执行周期的目标是处理当前获取的指令。
To process the instruction there is a need for identifying the type of the operations associated with the instruction.
为了处理该指令,需要识别与该指令相关联的操作的类型。
Opcode indicates the type of the operations.
操作码指示操作的类型。
The opcode is present in the instruction but that information is defined by the instruction format.
指令中存在操作码,但该信息由指令格式定义。
Instruction format gives the layout of an instruction that means is shown the internal structure of an instruction.
指令格式给出了指令的布局,即表示了指令的内部结构。
Instruction format is classified into five types based on the CPU organization.
指令格式根据CPU的组织分为五种类型。
CPU Organisation is classified into three types based on the availability of the ALU operand.
根据ALU操作数的可用性,CPU组织分为三种类型。
ii)存放 (ii) Storing)
In this phase the result computed in the execution phase is either sent to the memory or to an output device of the computer system. This PC of the CPU is also updated in this phase to point to the next instruction that is to be executed.
在此阶段,在执行阶段计算出的结果将发送到内存或计算机系统的输出设备。 在此阶段,CPU的此PC也将更新,以指向要执行的下一条指令。
翻译自: https://www.includehelp.com/cso/machine-cycle.aspx
一个机器周期 计算机