Back to Basics – Laying the Foundation

Pages: 1 2 3 4

Could I Get Your Address?

Another important feature of an architecture is how it handles memory addressing. There are two key aspects of memory addressing; addressing modes, or how the compiler refers to a particular memory location and addressable size, which is how much memory the system can handle.

The seven most common addressing modes are listed below [3]:

Table 1 – Common Addressing Modes

As mentioned before, the transition from assembly programming to compiled languages produced several important architectural changes, and one of these was the importance of addressing, particularly having as few addressing modes as possible. It should be easy to see that having more addressing modes would make life much easier on an assembly programmer, however, the performance loss is not quite as easy to discern. The problem with having many addressing modes is that there must be hardware to support these modes, which causes a performance hit for reasons that will be discussed later.

Another aspect of addressing is that certain addressing modes, namely immediate and displacement, require an upper bound on the size of the immediate or displacement. Typically, two types of constants (or immediates) are found in code;, smaller computational constants, such as 0 or 1, and addressing constants, which are often rather large (greater than 214). Similarly, displacements show a bimodal distribution, roughly centered around 5 and 14 bits of displacement.

Addressing size is now typically 32 bits for PCs, which means a maximum of 232 bytes of memory, i.e. the 4GB ceiling that you have on a PC. Some architectures, such as IA64, Power, and Alpha support up to 264 bytes of memory, which is more than enough given the density of DRAMs today.

The last addressing issue is ‘endianness’. This refers to the ordering of the bytes in a data value. Consider an n-byte number, in little-endian, it would look like so:

Byten-1 Byten-2 … Byte1 Byte0

While in big-endian, this would be reversed:

Byte0 Byte1 … Byten-2 Byten-1

This is not typically a huge issue, but worth noting, as it can cause compatibility problems between various data types.

Pages: « Prev   1 2 3 4   Next »

Discuss (18 comments)