This website uses cookies. By using this site, you consent to the use of cookies. For more information, please take a look at our Privacy Policy.
Home > Wiki encyclopedia > Register


Register: is the meaning of the buffer, its function is to be able to achieve the purpose of synchronization at high speed.



The register modifier implies that the corresponding variables of the compiler will be used frequently. If possible, they should be stored in the CPU's registers to speed up their storage. For example, the following memory block copy code,

/* Procedure for the assignment of structures, */

/* if the C compiler doesn't support this feature */


memcpy (d, s, i)

{register char *d;

register char *s;

register int i;

while (i--)

*d++ = *s++;



However, there are several restrictions on using the register modifier.

First, the register variable must be of a type that can be accepted by the CPU. This usually means that the register variable must be a single value, and the length should be less than or equal to the length of the integer. However, some machine registers can also store floating-point numbers.

Second, because the register variable may not be stored in memory, you cannot use "&" to get the address of the register variable.

Because the number of registers is limited, and some registers can only accept certain types of data (such as pointers and floating-point numbers), the number and type of register modifiers that really work depends on the machine running the program, and any redundant register Modifiers will be ignored by the compiler.

In some cases, saving variables in registers will actually slow down the program. Because the occupied register can no longer be used for other purposes; or the variable is not used many times, not enough to load and store the additional overhead caused by the variable.

Early C compilers did not save variables in registers unless you ordered it to do so, then the register modifier is a valuable addition to the C language. However, with advances in compiler programming technology, the C compilation environment can make better decisions than programmers when deciding which variables should be stored in registers. In fact, many compilers ignore the register modifier, because although it is completely legal, it is only a hint, not a command.


  • XC2C64A-7VQ44C


    CPLD CoolRunner -II Family 1.5K Gates 64 Macro Cells 159MHz 0.18um Technology 1.8V 44-Pin VQFP

  • XC3064-125PC84C


    FPGA XC3000 Family 4.5K Gates 224 Cells 125MHz 5V 84-Pin PLCC

  • XCV200-6FG256C


    FPGA Virtex Family 236.666K Gates 5292 Cells 333MHz 0.22um Technology 2.5V 256-Pin FBGA

  • XC4028XL-2HQ160I


    FPGA XC4000X Family 28K Gates 2432 Cells 0.35um Technology 3.3V 160-Pin HSPQFP EP

  • XC5VFX130T-1FFG1738I


    FPGA Virtex-5 FXT Family 65nm Technology 1V 1738-Pin FCBGA

FPGA Tutorial Lattice FPGA
Need Help?


If you have any questions about the product and related issues, Please contact us.