Unit - 3 Interfacing Semiconductor Memories and IO Devices
Unit - 3 Interfacing Semiconductor Memories and IO Devices
Unit – 3: Chapter - 7
Topics Covered
The best known examples of main memory are RAM and ROM.
For this reason, a more permanent type of memory is required to save important data and program files.
Because of their nonvolatility, ROMs are often mapped to cover the CPU’s reset address.
In this way they can be used to “boot” the computer up from a “cold” start.
2. Field-Programmable ROMs
There are several types of ROMs that can be programmed by the user in the field.
These devices are referred to as PROMs or programmable read-only memories.
Fusible-Link PROMs This type of PROM uses a low-current fusible link in series with the
output.
By applying a current pulse to the desired output, the fuse can be
melted and a logic 1 or 0 permanently programmed.
These devices have a typical access time of 35 ns.
A typical application would be a “boot” PROM in a microcomputer
system.
UV-Light-Erasable These are the most popular type of PROM used in microcomputer
PROMs systems.
This is the erasable programmable read-only memory (EPROM).
This device can be programmed, erased, and reprogrammed many times
over by the user.
2. Byte erasure is not possible; all cells are erased when exposed to UV light.
Because of these problems much research has been devoted to developing an electrically
erasable nonvolatile memory device.
This device can be programmed and erased without removing the chip from its socket.
1. Static RAM
In the static RAM (SRAM), four to six transistors are connected to form a simple RS flip-flop.
The standard six-transistor static memory cell is shown in the figure below.
Q1 and Q2 are the active devices, while Q3 and Q4 are biased as resistive loads.
Transistors Q5 and Q6 are used to gate data onto the internal data bus.
25-04-2024
This static cell is volatile because it will lose its data if power is lost. Each cell will also
power-on in an unpredictable state.
Static memories are best known for their ease of interfacing and fast access times.
25-04-2024
2. Dynamic RAMs
For this, the six transistors per cell may not be the
best choice.
For a given integrated-circuit die size, a DRAM will be four to six times as dense as the corresponding
static die.
For example, when the first 16K-bit static RAMs were being announced, 64K-bit dynamic RAMs were
becoming available.
In addition to this density improvement, DRAMs generally require much less power than do their static
counterparts.
25-04-2024
The latest trend is to fabricate DRAMs using CMOS technology versus the older NMOS technology.
The DRAM’s greatest shortcoming is that the storage node is not perfect: it leaks.
This necessitates a refresh operation—that is, sense the charge, amplify it, and then rewrite it.
Memory Organization
From the manufacturer’s standpoint, the most important number describing a memory
component is the total bit capacity.
But from a user’s standpoint, it is just as important to know how this memory is organized.
The organization of a memory refers to the number of bits in the output word.
Most DRAMs are just 1 bit wide, to accommodate a maximum number of address lines.
The advantage of the byte-wide devices is that a single chip can be used to provide a practical
memory in a small system.
There is little we can do to change the CPU timing other than add WAIT states.
Our goal will be to come up with a set of timing “windows” (or frameworks) for transferring data between
the CPU and main memory.
The following figure shows the signals involved in a minimum-mode read cycle.
The sequence refers to the CPU reads a byte or a word from memory.
25-04-2024
The following figure shows the timing for a minimum-mode write cycle, for which the
following sequence occurs:
25-04-2024
The 8086 microprocessor provides a 20-bit memory address that allows up to 1MB of main memory.
However, most memory interfaces do not fill this entire range. That is, for a given memory design,
several of the address lines are going to be “unused.”
However, these unused lines are very important because they determine the range of addresses the
memory interface will occupy.
To examine the extra address lines and enable the memory for a specified range of addresses an
address decoder is used.
This is an important aspect of any memory design, as one block of memory must not be allowed to
overlap another.
Full Decoding
A digital decoder is a circuit that recognizes a particular binary pattern on its input lines and
produces an active output indication.
For example, a two-input NAND gate recognizes the input pattern “11” and produces an
active-low output only when this input combination is applied.
A two-input AND provides a similar function but produces an active- high output indication.
OR and NOR gates can also be used as decoders when their alternate logic symbols are used.
25-04-2024
Partial Decoding
The smaller the memory block, the more address lines there will be to decode.
All of this decoding circuitry can become meaningless if much of the memory space is
unimplemented.
This is a technique in which some of the decoded address lines are simply ignored.
In these applications, the memory configuration is fixed and the ability to expand the memory
is not required.
Block Decoding
In a practical microcomputer the memory array often consists of several blocks of memory
chips.
This will require a separate decoder for each memory block unless a special block decoder is
built.
25-04-2024
In 8086, the static memory (SRAM) is filled only about 3% of the memory space.
Because of the low bit density, SRAM chips are normally used only in systems requiring a small amount
of RAM (<32K bytes) or very fast access times.
These requirements would be met by a microcontroller-based system or a computer designed for high-
speed data acquisition and analysis, for example.
It is common to find the 8086 supported by 128K to 512K bytes of dynamic RAM memory.
The remaining memory space may be filled with a bootstrap ROM and additional RAM chips serving as
the video screen memory.
25-04-2024
Packaging
To be consistent with the dynamic RAM’s high bit density, most DRAM chips are
packaged in standard 300-mil-wide 16-pin DIPs. (15mil = 0.381mm)
However, a 16-pin package does not have enough pins for all the address lines of a 256K
memory part.
For this reason, DRAMs are organized 1 bit wide with multiplexed address pins.
The industry standard pinning for 16-pin DIP 16K, 64K, and 256K DRAMs is shown below.
It is interesting to note that the 16K and 64K chips actually have unused pins.
By adopting this standard pinning arrangement, designers are able to design memory interfaces
that can easily be upgraded.
Although the address pins are labeled AO to A6 (or A7 or A8), the high-order address lines, A7 to
A14 (or A15 or A16), are also applied to these pins via a multiplexing scheme.
25-04-2024
Unit – 3: Chapter - 8
I/O Devices
Topics Covered
1. Parallel I/O
2. Serial I/O
3. Programmed I/O
4. Interrupt Driven I/O
5. Direct Memory Access
At the most basic level there are two types of I/O ports: parallel and serial.
Because the microprocessor naturally works with data in 8- or 16-bit “chunks,” the parallel port is the
easiest to implement.
All bits comprising the data word are input or output together in parallel.
25-04-2024
In a serial I/O port, the data bits are lined up and transmitted one bit at a time.
It should be apparent that this technique will be slower than the parallel port design, but it does have
certain advantages.
The serial data bits can also be converted to audio tones (using a circuit called a modem) and
transmitted over the telephone network. A receiving modem converts the tones back into digital l’s
and 0’s.
In this way one computer can communicate with another thousands of miles away.
Regardless of the I/O port design (parallel or serial), the microprocessor must be synchronized to the
speed of the peripheral.
Some peripherals, like printers and plotters, cannot accept data as fast as the microprocessor would
like to output it.
On the other hand, floppy-disk drives and Winchester disks may require data faster than the processor
can supply it.
1. Parallel I/O
The hardware requirements for a parallel I/O port are similar to those of a RAM or ROM interface.
When the CPU performs an output instruction (I/O write cycle), the data on the bus must be stored
by the port.
Similarly, when an input instruction is executed (I/O read cycle), the I/O port must gate its data onto
the data bus lines.
Just as each memory location has its own (memory) address, each I/O port has its own (port)
address.
25-04-2024
Direct IN AL (or AX), port Here, the I/O port address is supplied
OUT port, AL (or within the instruction and restricts the
AX) access to ports with addresses between 0
and 255.
Indirect IN AL (or AX), DX It uses register DX to hold the port address.
OUT DX, AL (or AX) This allows access to full range of I/O ports
from 0 to 65,535.
The advantage of the indirect form is that an I/O procedure can be set up and shared between
several peripherals by passing the port address (in register DX) to the procedure.
The output of IC2 is the port select signal SEL 30- 31H.
Memory-Mapped I/O
The address space of the 8086 is divided into 1,048,576 bytes of memory space and 65,536 bytes of
I/O space.
These two regions do not overlap because memory addresses are selected with the memory
commands (MEMR, MRDC, MEMW, MWTC), while the I/O addresses are selected with the I/O
commands (IOR, IORC, 10W, IOWC).
We would use latches (or flip-flops) to store the data written during a memory write cycle, and tri-
state gates to drive the bus during a memory read cycle.
The advantage of memory-mapped I/O is the availability of large number of instructions and
addressing modes for memory referencing.
2. Serial I/O
One of the most common applications for a serial I/O port is to interface the keyboard on a video
display terminal (VDT).
In this circuit, each keystroke generates a 7-bit ASCII code which is converted to bit-by-bit serial and
then transmitted to a computer over a two- or three-conductor cable.
Because even the fastest typist cannot exceed data rates of 60 to 100 words per minute, it is a good
match for the (relatively) slow transmission rate of the serial port.
An important characteristic of this interface is that, at some times, the serial port will be required to
transfer data at 10 to 20 characters/s, but at other times the data rate may be only 1 or 2 characters/s.
Indeed, most of the time the keyboard is not in use and the data rate is zero.
Because of this uncertain data rate, an asynchronous communications protocol must be established.
The accepted technique for asynchronous serial communications is to hold the serial output line at a
logic 1 level (a “mark”) until data is to be transmitted.
Each character is required to begin with a logic 0 (a “space”) for one bit time.
This first bit is called the start bit and is used to synchronize the transmitter and receiver.
25-04-2024
The following figure illustrates how the data byte 7BH would look when transmitted in the
asynchronous serial format.
The data is sent least significant bit first and framed between a start bit (always a 0) and one or two
stop bits (always a 1).
The start and stop bits carry no information but are required because of the asynchronous nature of
the data.
All microprocessors are capable of generating serial data without special hardware.
Each bit to be transmitted is rotated to the bit 0 position of the accumulator and output.
Protocols define certain rules that should be followed to help standardize the communications
technique.
An example is the adoption of a logic 0 for a start bit and a logic 1 for a stop bit.
When setting up a serial port several parameters must be specified. The most common are:
The start and stop bits of asynchronous serial data represent wasted overhead bytes that reduce the
overall character rate no matter what the baud rate.
Even adding a parity bit can reduce the transfer rate by 10%.
But giving up the start and stop bits will require some means of synchronizing the data.
How will we know when the data starts and when to sample it?
Here, we examine two common synchronous serial protocols that answer these questions.
25-04-2024
1. Bisync protocol
As there is no start bit, a special sync character is required in all synchronous serial formats.
This character tells the receiver that data is about to follow. The USART, accordingly, must have a special
“hunt” or “search” mode so that the sync character can be found.
As there is no stop bit, a clock signal usually accompanies the synchronous data to maintain
synchronization.
When synchronous serial data is to be transmitted over the telephone network, it is not possible to
provide a separate clock channel.
In this case, a special synchronous modem is used that encodes the data and clock into a single signal. The
receiving modem separates the data and clock signals.
Another difference when compared to asynchronous serial is that the clock rate is the same as the baud
rate.
In the bisync protocol, several special (ASCII) characters are used to control the data transfer as shown in
the following table.
25-04-2024
In the above frame, two sync characters are output followed by the start of text (STX).
The data bytes follow. This block may consist of 100 or more data bytes or simply be other control codes.
PAD is the character output when no data is being transmitted and corresponds to the “mark” output in
asynchronous serial.
This format was developed by IBM for use with their Systems Network Architecture (SNA)
communications package.
The following figure illustrates one frame of data using this protocol.
The SDLC receiver searches for the beginning flag (01111110) as its sync character.
An 8-bit address field follows, allowing each frame to be addressed to a particular station among a
network of stations.
The transmitter will automatically insert 0’s in this field if five or more logic l’s should appear in
sequence.
This will avoid inadvertent control characters appearing in the information field.
The 16-bit frame check is used for error detection, similar to the BCC character in bisync.
3. Programmed I/O
Regardless of the type of I/O port, serial or parallel, a strategy must be developed to control or
synchronize the flow of data through that port.
Example
Assume that a 100-character/s (cps) printer is interfaced to a parallel output port.
This printer is capable of printing a new character every 10 ms (1/100 cps).
Consider the following 8086 output routine, which might be used to supply data to the printer.
The numbers in brackets represent the number of T states required for each instruction.
T-states refers to the portion of an operation carried out in one clock period.
Using the above routine, the 8086 can output a new byte to the printer every 39 T-states.
At 5 MHz this is a new character every 7.8 ms and corresponds to 1,28,205 characters/s!
There is an obvious mismatch in the data rates of the printer and microprocessor.
We can calculate the maximum rate at which the program can transfer data by assuming the
peripheral will be ready after only one loop through the polling instructions.
In this example 30 T states are required to test the BUSY flag, and 49 T states to fetch the data byte,
advance the pointer, generate the strobe pulse, and test for done.
In all, 79 T states are required or 15.8 ms at 5 MHz. This corresponds to a data transfer rate of 63,291
characters/s.
To put this number into perspective, an 8-inch double-density disk drive reads and writes data to a
floppy disk at 62,500 bytes/s.
When interfacing a peripheral to a microprocessor the real problem for the microprocessor is not
knowing when the peripheral is READY.
That is, the peripheral operates asynchronously with respect to the microprocessor.
One solution is to program the CPU to repeatedly poll the peripheral’s BUSY/READY flag.
However, this has a built-in disadvantage in that all the resources of the processor are devoted to waiting
for this flag. No other tasks can be performed.
If the peripheral is READY only once every 10,000 ms, the CPU will spend most of its time waiting.
A more logical approach would be to have the peripheral “tell the CPU” when it is READY.
At the end of each instruction the processor examines the line. If the line active, control is transferred to a
special interrupt service routine (ISR).
25-04-2024
If we assume that 100 ms is required to respond to the interrupt and supply the peripheral with data, then
in the case of the 10,000 ms/character printer, 9,900 ms will be available to the processor for its main task.
In effect, the processor can perform two jobs at the same time.
The 8086 has two interrupt pins, labeled INTR and NMI.
25-04-2024
Types of Interrupts
Response Time
The interrupt response time or interrupt latency consists of the time to perform the following:
To appreciate the DMA concept, you must understand that the real bottleneck in the data
transfer process is the microprocessor itself.
When a text file is output to a disk drive, we are concerned with transferring data from memory
to that drive.
Yet with the programmed or interrupt-driven I/O approaches, that data must first be read from
memory into the CPU and then transferred to the disk drive.
The microprocessor is an unnecessary “middleman” in this process, with the result that the
transfer rate is decreased.
In the direct memory access (DMA), the peripheral is synchronized to main memory, not the
microprocessor.
The DMA approach is to “turn off” the processor and let the disk drive directly access the data file in
memory itself.
If the memory can supply a new byte of data every 200 ns, data can potentially be transferred at a
rate of 5 million bytes per second, directly to the disk drive!
The 8086 has protocols for transferring control of its buses to the DMA controller (DMAC).
Once the DMAC takes over the buses, there are several different types of DMA operations that can
be performed.
25-04-2024
DMA Protocols
DMA Protocols
The term protocol represents the handshaking mechanism used by the processor to
release control of its buses to another processor.
In the minimum mode two control signals are available: HOLD and HLDA.
25-04-2024
DMA Protocols
1. Minimum mode protocol (Contd …)
The following figure shows how the HOLD and HDLA signals are used by the DMAC.
DMA Protocols
DMA Protocols
Upon receiving HLDA, the DMAC applies DMACK (DMA acknowledge) to the peripheral
requesting service. This is done via the chip select input of the peripheral.
The DMAC is now in control of the system, outputting all the control and address bus
signals.
The DMAC is normally programmed by the 8086 prior to the DMA operation for a
particular type of transfer.
DMA Protocols
This is a more sophisticated technique that the HOLD-HLDA scheme used in the minimum
mode and can be used to allow three processors (including the 8086) to access the local
buses.
Upon receipt of a request pulse, the 8086 open circuits its address/data lines, the SO, SI,
and S2 status signals, and the RD and LOCK control signals.
25-04-2024
Types of DMA
Two types of DMA cycles are possible: sequential and simultaneous DMA.
Sequential DMA Here, the DMAC first performs a read operation, fetching the data byte into
the DMAC.
Next, a write operation is performed, transferring the data byte to the I/O
port.
The opposite sequence is also possible: read a byte from the I/O port, write
the byte to memory.
Simultaneous DMA Here, the fastest transfers are provided.
With this technique the read and write operations are performed at the
same time to be active simultaneously.
In this way data does not flow through the DMAC at all, but directly from
memory to the I/O port (or vice versa).
In either case the data transfer is done completely in hardware involving only the DMAC, the
peripheral, and main memory.
1. Memory to peripheral
2. Peripheral to memory
3. Memory to memory
4. Peripheral to peripheral
Before the data transfer can occur, the CPU must program the DMAC for the type of transfer
that is to take place, the destination and source addresses, and the number of bytes to be
transferred.
25-04-2024