Home Up
Home Teaching Glossary ARM Processors Supplements Prof issues About

Literal

A literal is an actual numeric value in contrast with the contents of a register or memory location. It is also called an immediate value because the literal is part of an instruction and it does not require a second memory access to fetch it.

Literals cannot be changed during the execution of a program (unless you use self-modifying code and actually change the code itself at runtime). Literals are used to define limits, loop count values, constants, ranges, and so on.

ARM assembly language indicates a literal by the hash symbol; for example

ADD r2,r3,#4

means add 4 to the contents of register r3 and put the sum in register r3.

If not stated otherwise, literals are considered base 10. The ARM assembler uses the prefix 0x to indicate hexadecimal; for example, 0x12AC. The prefix 2_ indicates binary; for example, 2_0000111101010011 (this is a feature of the Keil assembler).

The biggest problem with literals is that they form part of an instruction and therefore they must be shorter than the normal instruction word. Typical literals are 8, 12, or 16 bits long.

The Fetch Execute Cycle

The so-called fetch/execute cycle describes an intrinsic feature of the von Neumann architecture. Each instruction is executed in two distinct phases.

In the fetch phase, the instruction is read from memory and the program counter incremented to point at the next instruction in sequence. The instruction is then decoder or interpreted and its action carried out in the execute phase.

This sequence does indeed describe the operation of early von Neumann architectures. However, today it little more than an abstract concept.  A modern computer overlaps instruction fetch and instruction execute phases by means of pipelining; that is, the current instruction is being executed while the next instruction is being fetched.

An important feature of the von Neumann architecture is that there is only one data path between the CPU and memory and this enforced a strict fetch/execute regime. Modern processors have instruction and data caches. This means that is is possible to fetch instructions and data from different memories at the same time.

Finally, superscalar processors have multiple execution units and are even able to rearrange the sequence in which instructions are executed. Out-of-order, OOO, execution is possible.

For all these reasons, the fetch/execute concept is provides an excellent means of introducing the nature of a digital computer.