Anda di halaman 1dari 11

Addressing and

Decoding
Kuliah Pertemuan VI
Sistem Berbasis
Mikroprosesor

Lie Jasa

Methods of address decoding


• CPU provides the address of the data desired, but it is
the job of the decoding circuitry to locate the data using
the address bits provided by the CPU.
• In this discussion we use SRAM or ROM for the sake of
simplicity.
• Memory chips have one or more pins called CS (chip
select),
– which must be activated for the memory's contents to be
accessed.
– Sometimes the chip select is also referred to as chip enable
(CE).
• In connecting a memory chip to the CPU, the data bus is
connected directly to the data pins of the memory.

1
Methods of address decoding
• Control signals MEMR and MEMW are connected to the
RD and WR pins of the memory chip, respectively.
• In the case of the address buses, while the lower bits of
the address go directly to the memory chip address pins,
the upper ones are used to activate the CS pin of the
memory chip.
• It is the CS pin that along with RD/WR allows the flow of
data in or out of the memory chip.
• In other words, no data can be written into or read from
the memory chip unless CS is activated.
• The CS input is normally active low and can be activated
using one of the following methods of address decoding.

Simple logic gate as address decoder

• The simplest method of decoding circuitry is the


use of NAND or other gates.
• The fact that the output of the NAND gate is
active low and that CS is also active low makes
them a perfect match.
• In cases where the CS input is active high, an
AND gate must be used.
• Using a combination of NAND and inverters, one
can decode any address range.

2
Simple logic gate as address decoder

Using the 74xx138 3-8 decoder


• one of the most widely used address decoders.
• The 3 inputs A, B, and C generate 8 active-low outputs
Y0 - Y7.
• Each Y output is connected to CS of a memory chip,
allowing control of 8 memory blocks by a single 74138.
• In the 74138, where A, B, and C select which output is
activated,
• there are three additional inputs, G2A, G2B, and Gl. G2A
and G2B are both active low, and Gl is active high.
• If any one of the inputs Gl, G2A, or G2B is not connected
to an address signal (sometimes they are connected to a
control signal), they must be activated permanently
either by Vcc or ground, depending on the activation
level.

3
Example

Example
• Looking at the design in prev. Figure, calculate the address range
for
• Y4,
• Solution:
• The address range for Y4 is calculated as follows.
• A19 A18 A17 A16 A15 A14 A13 A12 All A10 A9 A8 A7 A6 A5 A4 A3 A2 Al AO
• 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
• 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1
• The above shows that the range for Y4 is F0000H to F3FFFH.
• In prev. Figure notice that A19, A18, and A17 must be 1 for the
decoder to be activated.
• Y4 will be selected when A16A15A14=100(4in binary). The
remaining A13 - AO will be 0 for the lowest address and 1 for
the highest address

4
Using PAL16L8 as an address decoder

• Another widely used decoder is the PAL16L8 chip.


• One disadvantage of the 16L8 PAL is that one must
have access to a PAL burner (programmer) and
PALASM software,
• whereas the 74138 needs neither of these.
• The advantage of the 16L8 is that it is much more
versatile since it can be programmed for any
combination of address ranges.
• This plus the fact that the 16L8 has 10 inputs (instead of
6 in the 74138) means that it can accommodate more
address inputs.

IBM PC memory map


•Video Display RAM
•CPU stores information in VDR
•Video controller then displays it
on the screen
•Memory used depends on:
•Adaptor type
•Some memory is
•Resolution
used for:
•Mode of operation
• BIOS
•64KByte to 640KByte • BASIC Compiler
•(00000-003FF) interrupt • Hard disk controller
vector table • Expansion by user
•(00400-004FF) BIOS
temporary data area
•(00500-005FF) temporary
storage for DOS and BASIC
•Some memory is occupied by
DOS (depends on version)

5
Conventional memory: 640K of RAM

• In the IBM PC, PS, and compatibles, the addresses from


00000 to 9FFFFH, including location 9FFFFH (a total of
640K bytes), are set aside for RAM.
• In early PCs, only 64K to 256K bytes of RAM were on
the motherboard and the rest had to be expanded by
adding a memory expansion plug-in card.
• In newer systems, the entire 640K is already on the
mother-board.
• In those early models, when a RAM memory board was
installed, switches had to be set to inform BIOS and
DOS of the added memory

• It is important to note that when read/write


memory is installed, it must populate
addresses ranging from 00000 to 9FFFF,
contiguously.
• No fragmentation of memory is allowed. In
other words, if there are empty DRAM
sockets on the system board, they must
be filled first and the switches set;

6
• then more memory can be added through the expansion
slot.
• Of the 640K bytes of memory, some is used by the MS
DOS operating system (the amount depends on the
version of DOS)
• and the rest of the available RAM is used by utilities and
application programs. Some utilities are resident and
therefore take the memory away from applications.
• This 640K bytes of memory is commonly referred to as
conventional memory.
• Of the total amount of RAM installed (anywhere between
64K and 640K bytes),
• the first 1K (00000 to 003FF =1024 bytes) is set aside for
the interrupt vector table.
• From 00400 to 004FF is set aside for the BIOS
temporary data area.
• From 00500 to 005FF is set aside for DOS and the
BASIC language for temporary storage

7
• Partial Listing of IBM PC RAM Memory Map for Interrupt, BIOS Data
• Memory Location Bytes Description
• 0000:0000 to 0000:03FF 1024 interrupt table
• 0000:0400 to 0000:0401 2 port address of com1
• 0000:0402 to 0000:0403 2 port address of com2
• 0000:0404 to 0000:0405 2 port address of com3
• 0000:0406 to 0000:0407 2 port address of com4
• 0000:0408 to 0000:0409 2 port address of Lpt1
• 0000:040A to 0000:040B 2 port address of Lpt2
• 0000:040C to 0000:040D 2 port address of Lpt3
• 0000:040E to 0000:040F 2 port address of Lpt4
• 0000:0410 to 0000:0411 2 list of installed hardware
• 0000:0412 to 0000:0412 1 initialization flag
• 0000:0413 to 0000:0414 2 memory size (K bytes)
• 0000:0415 to 0000:0416 2 memory in I/O channel (if
any)
• 0000:0417 to 0000:0418 2 keyboard status flag
• 0000:0419 to 0000:0419 1 alternate key entry
storage
• 0000:041A to 0000:041B 2 keyboard buffer pointer
(head)
• 0000:041C to 0000:041D 2 keyboard buffer pointer
(tail)

8
• 0000:041E to 0000:043D 32 keyboard buffer
• 0000:043E to 0000:0448 11 diskette data area
• 0000:0449 to 0000:0449 1 current video mode
• 0000:044A to 0000:044B 2 number of columns on
screen
• 0000:044C to 0000:044D 2 regen buffer length
(bytes)
• 0000:044E to 0000:044F 2 regen buffer starting
offset
• 0000:0450 to 0000:045F 16 cursor position, pages 1-
8
• 0000:0460 to 0000:0460 1 cursor end line
• 0000:0461 to 0000:0461 1 cursor start line
• 0000:0462 to 0000:0462 1 currently displayed page
number
• 0000:0463 to 0000:0464 2 active display base
address
• 0000:0465 to 0000:0465 1 CRT mode register for
MDA or CGA
• 0000:0466 to 0000:0466 1 register for CGA
• 0000:0467 to 0000:046B 5 cassette data area
• 0000:046C to 0000:0470 5 timer data area

Example
• Show the calculation which verifies that addresses
00000 to 9FFFFH comprise 640K bytes.
• Solution:
• To calculate the total number of bytes for a given
memory address range, subtract the two addresses and
add 1 to get the total bytes in hex. Then the hex number
is converted to decimal and divided by 1024 to get
Kbytes.
• 9FFFF 9FFFF
• - 00000 + 00001
• 9FFFF A0000 hex = 655,360 decimal = 640K

9
Video display RAM (VDR) map
• To display information on the monitor of the PC,
• the CPU must first store that information in memory called video
display RAM (VDR);
• it is the job of the video controller to display it on the screen.
• Therefore, the address of the VDR must be within the CPU address
range.
• In the IBM PC, PS, and compatibles, from A0000 to BFFFFH, a total
of 128K bytes of the CPU's addressable memory is allocated for
video.
• Of that 128K, only a portion is used for VDR,
• the amount used depending on:
– which type of video adapter card is installed in the system;
– the mode that the video system used, text or graphics;
– and the resolution.
• For example, the monochrome video adapter uses only from B0000
up to 4K bytes of RAM, color graphics mode uses addresses
starting at B8000, and VGA has a starting address of A0000.

Adapters Number of Starting


Bytes Used Address

CGA,EGA,MCGA.VGA 2048 B8000H


CGA,EGA,MCGA,VGA 4096 B8000H
CGA,EGA,MCGA,VGA 16.384 B8000H
MDA,EGA,VGA 4096 B0000H
EGA,VGA 32,768 A0000H
EGA, VGA 65,536 a0000h

10
ROM memory map
• From C0000H to FFFFFH, a total of 256K bytes, is set
aside for ROM.
• Of these 256K bytes, some is used for BIOS ROM, some
for the BASIC language compiler ROM,
• some for the hard disk controller and other peripheral
board ROMs,
• and the rest for expansion by the user.
• The memory map for the 256K bytes allocated to ROM is
shown bellow:

ROM memory map of IBM PC


Memory Location Description
C000:0000 – C000:7FFF ROM Memory expansion

C000:8000 – C000:CFFF area Fixed (hard) disk



D000:0000 – E000:FFFF control ROM Memory
expansion area (XT)

F000:0000 - FOOO:FFFF BIOS ROM

11

Anda mungkin juga menyukai