Brief description of instruction cycle, machine cycle, clock cycle

Source: Internet
Author: User
Instruction Cycle

The instruction cycle is the sum of the time that the CPU takes out an instruction from memory and executes the instruction, typically consisting of several machine cycles, from the fetch instruction to the analysis command to the time required to complete the execution. Machine Cycle

The machine cycle is also called the CPU cycle, because the CPU spends a long time accessing the memory, so it is defined with the shortest time to read an instruction word from memory. In the computer, in order to facilitate management, the implementation of an instruction is often divided into several stages, each phase of the completion of a work. For example, take instruction, memory read, memory write, etc., each work is called a basic operation. The time required to complete a basic operation is called the machine cycle. Clock Cycle

The clock cycle, also known as the oscillation period, is defined as the reciprocal of the clock pulse (it can be understood that the clock cycle is the reciprocal of the external Crystal of the microcontroller), which is the most basic and minimum unit of time in a computer. A machine cycle consists of several clock cycles. In a clock cycle, the CPU only completes one of the most basic actions. For some kind of MCU, if the clock frequency of 1MHZ is used, the clock period is 1us, and if the clock frequency is 4MHZ, the clock period is 250us.

n Clock cycle = 1 machine cycle
N Machine cycle = 1 instruction Cycle

Different instructions, the number of machine cycles required is also different. For some simple single-byte instructions, only one machine cycle is required. For some more complex instructions, such as transfer instructions, multiplication instructions, two or more than two machine cycles are required.
From the execution speed of the instruction, single-byte and double-byte instructions are generally single-machine cycle and dual-machine cycle, the three-byte instruction is a two-machine cycle, only the multiplication, except the instruction occupies 4 machine cycles.
Therefore, when programming, in the case of the same work, the selection of the use of fewer machine cycle commands will increase the execution rate of the program, especially when writing large programs, the effect is more obvious.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.