CPU Register Used in the Microcontroller

The machine instructions for each CPU inside Microcontroller are different, so the corresponding assembly language is different. This article describes the most common x86 assembly language currently available, which is the one used by Intel’s CPU. CPU Register Used in the Microcontroller is one of the most important part which can decide the features of Microcontroller:

Look at the registers first. The CPU itself is only responsible for computing and is not responsible for storing data. Data is usually stored in memory, and the CPU reads and writes data when it is used. However, the CPU is much faster than the read/write speed of the memory. To avoid being slowed down, the CPU comes with a level 1 cache and a level 2 cache. Basically, the CPU cache can be thought of as a faster read and write memory.

However, the CPU cache is not fast enough. In addition, the address of the data in the cache is not fixed. The CPU will slow down the address every time it is read or written firmware code. Therefore, in addition to the cache, the CPU also comes with a register to store the most commonly used data. That is to say, the most frequently read and written data (such as loop variables) will be placed in the register, the CPU will read and write the register first, and then the register will exchange data with the memory.

memory hierachy in Mcu structure

memory hierachy in Mcu structure

Registers do not rely on addresses to distinguish data, but rely on names. Each register has its own name, and we tell the CPU which specific register to take the data, which is the fastest. Some metaphor registers are the zero-level cache of the CPU.

what is cpu register

what is cpu register

Register type
Early x86 CPUs had only eight registers, and each had a different purpose. Now there are more than 100 registers, all of which become general-purpose registers, which are not specifically specified, but the names of the earlier registers are saved.
EAX
EBX
ECX
EDX
EDI
ESI
EBP
ESP
Among the above eight registers, the first seven are common. The ESP register has a specific purpose to save the address of the current stack.