What is a Register? How is it Used in Embedded Programming?
A register is an easily accessed location on a PC where data can be stored. Each PC has a series of general purpose registers called ROM and RAM that stores instructions for execution and control of software programs. Instructions are generally executed in the context of a function (for instance, a code that prints to the screen). Register names are also used to label instructions, with each register having a unique name. Some registers can be read only or write-write, and generally contain a small number of fast storage.
The PC typically maintains a mapping from the current instruction at address (PC) to the next instruction set within the program (PC). This mapping is called an instruction list, and each instruction is assigned a specific register. In the majority of cases, instructions are executed in parallel, on a timer, or at some other time between the initiation of one particular instruction and the completion of another one. Instructions are categorized as being speculative, temporary, or permanent, depending on the results they produce after execution. The PC keeps counters register that counts the number of speculative instructions per cycle, called a counter register.
Instructions can be single bits or double bits. A single bit instruction has no affect on any register, while a double bit instruction has an effect on either the PC or some other external register. In addition, instructions can be divided into register groups. The most common register groups are instruction pointer registers (IP), condition registers (CC), accumulators (ACE), and stack cells (SC).
A register can hold a single word or a pair of words. A word register contains one word, while a pair of words register contains two words. A register can hold one or more bytes. Typically, a register consists of eight words; however, some instructions use more than eight words. Some examples include shift/ decode instructions, bit shifting/addressing instructions, and pointer/sizes instructions.
An instruction word is a single character that specifies a function, and the actual register is called an execution register. Execution registers are used only for execution purposes. Instructions are not stored in these registers and are only used during execution. These registers are cleared or set once the instruction pointer reaches the end of the current instruction.
Instructions can be executed in one of two ways: by moving the instruction pointer to the end of the register or by storing the result of the instruction inside the data register. Data registers, on the other hand, can hold information that is used in the execution of the instruction. A register does not store instructions; rather it acts as a pointer to an address that refers to another memory location. If you want to execute a floating-point mathematical expression, you will need to store the result somewhere else. A register serves as a memory location that saves the results of arithmetic calculations, such as addition, subtraction, division, and multiplication.