MCU instruction cycle, machine cycle, state cycle, clock cycle

Publisher:Zhenai5201314Latest update time:2024-07-30 Source: cnblogsKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The system instruction cycle of the microcontroller varies according to different core architectures.

The 8051 series microcontroller uses a synchronous sequential logic system. The operation of the entire system is completely dependent on the clock signal inside the system. Its instruction cycle, machine cycle, etc. are also determined by the clock pulse signal. The following explains the relationship between the machine cycle, instruction cycle, etc.

Clock cycle: also called clock oscillation period, refers to the pulse generated by the crystal oscillation. One pulse represents one clock cycle.

State cycle: In the 8051 microcontroller, one clock cycle is defined as one beat (indicated by P), and two beats are defined as one state cycle (indicated by S). One state cycle is equal to two clock cycles.

Machine cycle: Also commonly called CPU cycle, it indicates the shortest time to read an instruction word from memory. It is the smallest unit of instruction cycle. It is equal to the cycle length of a single instruction. One machine cycle is equal to 6 state cycles.

Instruction cycle: An instruction consists of one or more machine cycles. All C language codes will eventually be compiled into assembly code for execution, and the machine cycle required to execute an assembly instruction is called an instruction cycle.

The clock cycles of different instructions are different. For the 8051 core, the clock cycles of the same instruction are also different. As can be seen from the figure below, the MOV instruction takes one machine cycle to put the register value into the accumulator, and the MOV instruction takes two cycles to put the value in the direct address into the accumulator. For the same instruction, the instruction cycles of the 8051 and 90 series microcontrollers are also different. The 8051 series takes 12 clock cycles to execute a single instruction, and the 90 series takes 6 cycles to execute a single instruction. They all require one machine cycle, but the 90 series only needs 6 clock cycles for one machine cycle.

The NOP instruction we often use is a single instruction that requires one machine cycle. The 8051 requires the crystal oscillator to generate 12 pulses.

8051 Baidu Encyclopedia: 8051 is an 8-bit single-chip microcontroller , a type of MCS-51 single-chip, manufactured by Intel in 1981. INTEL licensed the core technology of MCS51 to many other companies, so many companies are making single-chip microcomputers with 8051 as the core, such as Atmel , Philips , Shenzhen Lianhua and other companies, and have successively developed more functional and powerful compatible products.

CORTEX-M0 M3 M4, etc. use the ARMv6-M, ARMv7-M, ARMv8-M Thumb instruction sets and a three-stage pipeline process. The M3 has a branch prediction function that can prefetch instructions for the branch target address, reducing the branch delay to one clock cycle.

The instruction cycle of the CORTEX-M series is uncertain. On the one hand, there is a delay when the MCU fetches instructions from the Flash. On the other hand, the Cortex instruction set does not have a fixed cycle. Especially after the branch prediction was added to the M3, the results of branch instructions on different Cortex-M models are different.

over.


Keywords:MCU Reference address:MCU instruction cycle, machine cycle, state cycle, clock cycle

Previous article:About the address bus and data bus of the microcontroller
Next article:W77E58 chip introduction

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号