126 Computer Architecture and Organization
around Harvard architecture, the area earmarked for data memory cannot store any program segment. Simi-
larly, the area earmarked for program memory would not allow any data storage, not even the system stack.
If external program and data memory devices have to be interfaced with 8051, then PSEN signal has to be
used to read from external program memory and RD (alternate function of pin 17) signal has to be used
to read from external data memory. However, in majority of applications, 8051 uses its internal program
memory (4 kB) and data memory (128-bytes). Some versions of 8051 (e.g., 8052 and so on) offer 8 kB on-
chip program memory and 256-bytes of internal data memory (RAM), as we have already indicated.
Similar to 8086, 8051 also incorporated the pipeline architecture. During execution of one instruc-
tion, it pre-fetches the next byte of instruction. However, the number of bytes in its instruction queue is
only 1, which is 6 in the case of 8086.
5.9.3 Register Set
The 128-bytes of internal data memory of 8051 are divided into three functional parts, as shown in
Figure 5.27 (a). Its upper 80-bytes may be used for any general purpose usage. Lower 32-byte accom-
modates four register banks, designated as #0 to #3 [Figure 5.27 (b)]. Each of these four register banks
accommodates eight general purpose registers, as explained later in this section.
Remaining 16-bytes (from 20H to 2FH) contains 128-bits, which are directly addressable individ-
ually and designated as bit-addressable area . These bits are provided to store Boolean information,
which may be used as ags. This bit addressability feature optimizes the RAM usage, so that one full
byte is not wasted to store the information of any ag, which might have only two states of true and
false. Only one bit is suf cient in this case. The unused bytes of this bit addressable area may be used
as general purpose storage in the form of bytes, using their byte-addresses.
Each of four register banks contains eight general purpose 8-bit registers, designated as R0, R1 and
so on up to R7, as shown in Figure 5.27 (c). At any time, 8051 can use any one of the four banks and its
registers. Selection of any register bank has to be done through the special function register (SFR) des-
ignated as PSW. Apart from these 128-bytes of internal RAM area, which contains 32 general purpose
registers in four register banks, 8051 has 21 special function registers designated as SFRs. These 8-bit
SFRs of 8051 are shown in Figure 5.28 . Note that some of these SFRs (lightly shaded in Figure 5.28 )
are bit-addressable. Direct addresses of all SFRs are shown at their left. These SFRs are only directly
addressable, although 8051 offers indirect as well as indexed addressing modes.
Figure 5.27 (a) Internal RAM allocation details, (b) Register banks and (c) Registers
of 8051
M05_GHOS1557_01_SE_C05.indd 126M05_GHOS1557_01_SE_C05.indd 126 4/29/11 5:07 PM4/29/11 5:07 PM