Clock cycle, machine cycle, instruction cycle, bus cycle

  1. Clock cycle: The clock cycle is also called the oscillation cycle, which is defined as the reciprocal of the clock pulse (it can be understood that the clock cycle is the reciprocal of the external crystal oscillator of the microcontroller, such as a 12M crystal oscillator, its time period It is 1/12 us), which is the most basic and smallest unit of time in a computer. In a clock cycle, the CPU only completes one of the most basic actions. For a certain single-chip microcomputer, if a clock frequency of 1MHZ is used, the clock cycle is 1us; if a clock frequency of 4MHZ is used, the clock cycle is 250us. Because the clock pulse is the basic working pulse of the computer, it controls the working rhythm of the computer (makes every step of the computer unified to its pace). Obviously, for computers of the same model, the higher the clock frequency, the faster the computer’s working speed. 8051 single chip microcomputer defines one clock cycle as one beat (represented by P), and two beats are defined as one state cycle (represented by S).

  2. Machine cycle: In a computer, in order to facilitate management, the execution process of an instruction is often divided into several stages, and each stage completes a task. For example, fetching instructions, memory reading, memory writing, etc., each of these tasks is called a basic operation. The time required to complete a basic operation is called the machine cycle. In general, a machine cycle is composed of several S cycles (state cycles). One machine cycle of the 8051 series single-chip microcomputer is composed of 6 S cycles (state cycles). As mentioned earlier, one clock cycle is defined as one beat (represented by P), and two beats are defined as one state cycle (represented by S). The machine cycle of the 8051 single-chip microcomputer is composed of 6 state cycles, that is to say, one machine cycle = 6 state cycles = 12 clock cycles. (For example, a single-chip microcomputer with an external 24M crystal oscillator, his machine cycle = 12/24M seconds)

  3. Instruction cycle: The time required to execute an instruction is generally composed of several machine cycles. Different instructions require different machine cycles. For some simple single-byte instructions, in the instruction fetch cycle, after the instruction is fetched into the instruction register, it is immediately decoded and executed, and no other machine cycles are required. For some more complex instructions, such as branch instructions and multiplication instructions, two or more machine cycles are required. Usually an instruction containing one machine cycle is called a single-cycle instruction, and an instruction containing two machine cycles is called a dual-cycle instruction.

  4. Bus cycle: Because the memory and I/O port are connected to the bus, the CPU accesses the memory and I/O interface through the bus. Usually, the time required for the CPU to access the outside of the microprocessor (memory or I/O interface) through the bus is called a bus cycle.

  5. Summary: Clock cycle is the smallest unit. The machine cycle requires one or more clock cycles, and the instruction cycle requires one or more machine cycles; the machine cycle refers to the time to complete a basic operation, which may sometimes include Bus reads and writes, thus including bus cycles, but sometimes may have nothing to do with bus reads and writes, so there is no clear mutual inclusion relationship.

Leave a Comment

Your email address will not be published.