Memory Address Space and Data Organization The 8088












































































- Slides: 76
Memory Address Space and Data Organization • The 8088 microcomputer supports 1 Mbytes of external memory. • The memory of an 8088 -based microcomputer is organized as 8 -bit bytes, not as 16 -bit words. Memory address space of the 8088/8086 microcomputer
Memory Address Space and Data Organization The 8088 can access two consecutive bytes as word of data. Lower address byte and higher address byte The two bytes represent the word 0101000000102 = 550216
Memory Address Space and Data Organization EXAMPLE What is the data word shown in the previous figure? Express the result in hexadecimal form. Is it stored at an even- or odd addressed word boundary? Is it an aligned or misaligned word of data? Solution: 111111012 = FD 16 = FDH 10102 = AA 16 = AAH Together the two bytes give the word 1111110110102 = FDAA 16 = FDAAH Expressing the address of the least significant byte in binary form gives 0072 BH = 0072 B 16 = 00000111001010112, Therefore, it is misaligned word of data.
Memory Address Space and Data Organization • Even- or odd-addressed word • If the least significant bit of the address is 0, the word is said to be held at an even addressed boundary. • Aligned word or misaligned word
Memory Address Space and Data Organization • A double word corresponds to four consecutive bytes of data stored in memory. Example of double word data is pointer. A pointer is a two-word address element that is used to access data or code in memory
Memory Address Space and Data Organization • A pointer is a double word. The higher address word represents the segment base address while the lower address word represents the offset. Example: Segment base address = 3 B 4 C 16 = 00111011010011002 Offset value = 006516 = 0000011001012
Memory Address Space and Data Organization EXAMPLE How should the pointer with segment base address equal to A 00016 and offset address 55 FF 16 be stored at an even-address boundary starting at 0000816? Is the double word aligned or misaligned? Solution: Storage of the two-word pointer requires four consecutive byte locations in memory, starting at address 0000816. The least significant byte of the offset is stored at address 0000816 and is shown as FF 16 in the previous figure. The most significant byte of the offset, 5516, is stored at address 0000916. These two bytes are followed by the least significant byte of the segment base address, 0016, at address 0000 A 16, and its most significant byte, A 016, at address 0000 B 16. Since the double word is stored in memory starting at address 0000816, it is aligned.
Generating a Memory Address • A logical address in the 8088 microcomputer system is described by a segment base and an offset. • The physical addresses that are used to access memory are 20 bits in length. • The generation of the physical address involves combining a 16 -bit offset value that is located in the instruction pointer, a base pointer, an index register, or a pointer register and a 16 -bit segment base value that is located in one of the segment register.
Generating a Memory Address
Generating a Memory Address
Generating a Memory Address
Generating a Memory Address EXAMPLE What would be the offset required to map to physical address location 002 C 316 if the contents of the corresponding segment register are 002 A 16? Solution: The offset value can be obtained by shifting the contents of the segment register left by four bit positions and then subtracting from the physical address. Shifting left give 002 A 016 Now subtracting, we get the value of the offset: 002 C 316 – 002 A 016 = 002316
Generating a Memory Address • Different logical addresses can be mapped to the same physical address location in memory.
Hardware Organization of the Memory Address Space– 8088 Microprocessor Ø 8088 memory hardware is organized as a single bytewide memory bank Size— 1 M X 8 bits Ø Physical address range— 0 H–FFFFFH Ø Address/data bus demultiplexed in external hardware Ø Input: 20 -bit address bus— A 19 through A 0 Ø Input/Output: 8 -bit data bus—D 7 Through D 0
Hardware Organization of the Memory Address Space– 8088 Microprocessor Ø Byte access bus cycle Ø • MPU applies address of storage location to be accessed over address lines A 19 -A 0. A 19—most significant bit A 0—least significant bit Ø Byte of data written into or read from address X transferred over data lines D 0 through D 7—most significant bit D 0—least significant bit Ø Byte access takes a minimum of one bus cycle of duration @5 MHz— 800 ns @8 MHz— 500 ns Ø Word access bus cycles Ø MPU must access two consecutive storage locations in memory—X and X+1. Requires two bus cycles. Address X accessed during cycle 1. Address X+1 accessed during cycle 2 Ø Word access duration is a minimum of two bus cycle @5 MHz— 2 X 800 ns = 1600 ns Ø @8 MHz— 2 X 500 ns = 1000 ns
Hardware Organization of the Memory Address Space– 8088 Microprocessor Ø 8086 memory hardware is organized as a two byt ewide memory bank. Bank size— 512 K X 8 bits. Lowbank holds even addressed bytes— 0 H through FFFFEH Ø High-bank holds odd addressed bytes— 1 H through FFFFFH Ø Address/data bus demultiplexed in external hardware Ø Input: 20 -bit+ address bus— A 19 through A 0, and BHE*. A 1 -A 19 = selects storage location. A 0 = 0 enables low bank. BHE* = 0 enables high bank Ø Input/Output: 16 -bit data bus—D 15 Through D 0. Ø D 7 -D 0 even addressed byte accesses Ø D 15 -D 8: odd addressed byte accesses Ø D 15 -D 0: word accesses
Hardware Organization of the Memory Address Space– 8088 Microprocessor
Hardware Organization of the Memory Address Space– 8088 Microprocessor
Address Bus Status Code Ø During memory bus cycle an address bus status code s 4, s 3 is output by processor, these status code is multiplexed with address bits A 17 and A 16. Ø Bits S 4 and S 3 together forma 2 bit binary code that identifies which one of the four segment registers was used to generate the physical address that output during the address period in the current bus cycle. S 4 S 3 Address Status 0 0 ES 0 1 SS 1 0 CS 1 1 DS
Memory Control Signals– 8088 Minimum-Mode Control Signals Ø ALE = pulse to logic 1 tells bus interface circuitry to latch address Ø RD* = logic 0 tells memory subsystem that a code or data read is in progress Ø WR*= logic 0 tells memory subsystem that a data write is in progress Ø IO/M*= Logic 0 tells interface circuits that the data transfer operation is for the memory subsystem Ø DT/R* = logic 1 & 0. sets the direction of the external data bus for read(input) or write(output) operation Ø DEN*= logic 0, enables the interface between the memory subsystem and MPU data bus Ø SSO* = tells memory interface whether the memory access is a code read or data access. Logic 0 for instruction code read
Memory Control Signals– 8088 Maximum-Mode Control Signals Ø 8288 bus controller produces the control signals Ø MRDC* replaces RD* Ø MWTC* and AMWC* replace WR* Ø DEN is complement of DEN* Ø IO/M* no longer needed (bus Ø controller creates separate memory and IO read/write Ø controls) Ø • SSO* no longer part of interface
Memory Control Signals– 8088 Maximum-Mode Control Signals Ø During all memory accesses one of three bus cycle status code are output by the MPU Ø Instruction fetch • Read memory • Write memory Ø 8288 decodes to produce appropriate control command signals Ø MRDC*-- instruction fetch/memory read Ø MWTC* -- memory write Ø AMWC* -- advanced memory write
(Queue Status) The processor provides the status of queue in these lines. The queue status can be used by external device to track the internal status of the queue in 8086. The output on QS 0 and QS 1 can be interpreted as shown in the table. 24
25
Read and Write Bus Cycles– 8088 Minimum Mode Read Bus Cycle Ø T 1 state—read cycle begins • Address output on A 0 -A 19 • Pulse produced at ALE--address should be latched in external circuitry on trailing edge of ALE • IO/M* set to 0 memory bus cycle DT/R* set to 0 set external data bus control circuitry for receive mode (read)
Read and Write Bus Cycles– 8088 Minimum Mode Read Bus Cycle Ø T 2 state • Status code output on S 3 -S 6 • AD 0 through AD 7 tri-stated in preparation for data bus operation • RD* set to 0 read cycle • DEN* set to 0 enable external data bus control circuitry
Read and Write Bus Cycles– 8088 Minimum Mode Read Bus Cycle Ø T 3 state • Data on D 0 -D 7 read by the MPU
Read and Write Bus Cycles– 8088 Minimum Mode Read Bus Cycle Ø T 4 state—read cycle finishes • RD* returns to 1 inactive level • Complete address/data bus tri-stated • IO/M* returned to 1 IO bus cycle • DEN* returned to 1 inactive level • DT/R* returns to 1 transmit level
Differences of 8086 read bus cycle Ø BHE* is output along with the address in T 1 Ø Data read by the MPU can be carried over all 16 data bus lines Ø M/IO*—which replaces IO/M*—switches to 1 instead of 0 at the beginning of T 1 Ø SSO* signals is not produce
8088 Minimum Mode Write Bus Cycle • T 1 state—write cycle begins • Address output on A 0 -A 19 • Pulse produced at ALE and address latched in external circuitry on trailing edge of ALE • IO/M* set to 0 -> memory bus cycle • DT/R* remains at 1 -> external data bus control circuitry for transmit mode (write)
8088 Minimum Mode Write Bus Cycle T 2 state • Status code output on S 3 -S 6 • AD 0 through AD 7 transitioned to data bus and write data placed on bus • DEN* set to 0 -> enable external data bus control circuitry • WR* set to 0 -> write cycle
8088 Minimum Mode Write Bus Cycle T 3 or T 4 state • Data on D 0 -D 7 written into memory (memory decides when!) • T 4 state—write cycle finishes • WR* returns to 1�inactive level • Complete address/data bus tri-stated • IO/M* returned to 1 -> IO bus cycle • DEN* returned to 1 -> inactive level
8086 Maximum Mode Write Bus Cycle • Address and data transfer operation identical • Transfer may be a high-byte, lowbyte, word • Differences is the 8288 produces the bus control signals—ALE, DEN, AMWC*, and MWTC*
8086 Maximum Mode Write Bus Cycle • Bus status code S 2*-S 0* output prior to T 1 and held through T 2 • AMWC* and MWTC* replace WR* (Note timing difference) • DEN =1 produced instead of DEN* =0 (change in external circuitry!)
PROGRAM AND DATA STORAGE MEMORY Secondary storage memory is used for Ø storage of data, information, and programs that are not in use. Ø This part of the memory unit can be slow speed Ø But require very large storage capacity. Primary storage memory is used for Ø working information, such as the instructions of the program currently being run and data that it is processing. Ø This section normally requires high-speed operation Ø but does not normally require very large storage capacity.
PROGRAM AND DATA STORAGE MEMORY Primary storage memory is further partitioned into program storage memory and data storage memory. The much larger part of the program storage memory in a PC is built with dynamic random access read/write memory devices ( DRAMS). They may be either mounted on the main processor board or on an add-in memory module or board. Its purpose is to store programs that are to be executed, but in this case they are loaded into memory only when needed. Information that frequently changes is stored in the data storage part of the microcomputer‘s memory subsystem.
PROGRAM AND DATA STORAGE MEMORY
RANDOM ACCESS READ/WRITE MEMORIES RAM is similar to ROM in that its storage location can be accessed in a random order, but it is different from ROM in two important ways: Ø First. RAM can be used to save data by writing to it, and then reading back for additional processing. Ø Second. RAM is volatile that is, if power is removed from RAM, the stored data are lost
RANDOM ACCESS READ/WRITE MEMORIES Random Access Read/Write Memory (RAM) Ø Used for temporary storage of data and program information Ø Stored information can be altered by MPU—read or written Ø Information read from RAM Ø Modified by processing Ø Written back to RAM for reuse at a later time Ø Information normally more frequently randomly accessed than ROM Ø Information is volatile— lost when power turns off
RANDOM ACCESS READ/WRITE MEMORIES Types: Static RAM (SRAM)— data once entered remains valid as long as power supply is not turned off • Lower densities • Higher cost • Higher speeds DRAM—data once entered requires both the power to be maintained and a periodic refresh • Higher densities • Lower cost • Lower speeds • Refresh requires additional circuitry
RANDOM ACCESS READ/WRITE MEMORIES Static and Dynamic RAMs Ø For a Static RAM (SRAM) , data once entered, remain valid as long as the power supply is not turned off. Ø To retain data in a Dynamic RAM (DRAM), we must both keep the power supply turned on and periodically restore the data in each storage location. Ø This added requirements necessary because the storage elements in a DRAM are capacitive nodes. If the storage nodes are not recharged within a specific interval of time, data are lost. This recharging process is known as refreshing the DRAM.
Standard Dynamic RAM ICs Dynamic RAMS are available in higher densities than static RAMS Some other benefits of using DRAMS over SRAMS are that: Ø They cost less, consume less power. Ø Their 16 -and 18 -pin packages take up less space. For these reasons DRAMS are normally used in applications that require a large amount of memory. For example most systems that support at least 1 Mbyte of data memory are designed using DRAMS.
DRAM BLOCK DIAGRAM Ø DRAM signal interfaces Ø Address multiplexed in external circuitry into a separate row and column address Ø Row address = A 7 -A 0 Ø Column address = A 15 -A 8 Ø Special RAS* and CAS* inputs used to strobe address into DRAM Ø Row and column addresses applied at different times to address inputs A 0 through A 7 Ø Row address first Ø Column address second Ø Known as “RAS before CAS” Ø Address reassembled into 16 -bit address inside
DRAM BLOCK DIAGRAM Ø DRAM signal interfaces Ø Address multiplexed in external circuitry into a separate row and column address Ø Row address = A 7 -A 0 Ø Column address = A 15 -A 8 Ø Special RAS* and CAS* inputs used to strobe address into DRAM Ø Row and column addresses applied at different times to address inputs A 0 through A 7 Ø Row address first Ø Column address second Ø Known as “RAS before CAS” Ø Address reassembled into 16 -bit address inside
DRAM BLOCK DIAGRAM DRAM Ø Frequently data organizations are X 1, X 2, and X 4 Ø Separate data inputs and outputs Ø Data input labeled D Ø Data output labeled Q Ø Read/write (W) input signals read or write operation
Block diagram of 2164 DRAM
DRAM BLOCK DIAGRAM The 21648 is one of the older NMOS DRAM devices. Looking at the block diagram, we find that it has eight address inputs, A 0 through A 7, a data input and data output marked D and Q, respectivly and three control inputs, rowaddress stmbe (RAS), column addrcss stnbe (CAS), and
Types of I/O for 8088/8086 Ø Input/output system allows peripherals to: Ø Provide data or Ø Receive results after processing the data Ø Implemented using I/O ports Ø Employs two different types of I/O: Ø Isolated I/O. Ø Memory mapped I/O. Ø Method differs in how I/O ports are mapped into MPU’s address spaces. Ø Some microcomputer employs both method.
Isolated I/O Ø I/O devices treated separately from memory. Ø Hardware and software architecture of 8088/8086 support separate memory I/O address space. Ø Can be accessed as either byte-wide or word-wide. Ø Can be treated as either independent byte-wide I/O ports or word-wide I/O ports. Ø Page 0: Ø Certain I/O instructions can only perform operations to ports in this part of the address range. Ø Other I/O instructions can input/output data for ports anywhere in the address space.
Isolated I/O FFFF Port 65 535 I/O address space Page 0 00 FF Port 255 00 FE Port 254 . . . 0004 Port 4 0003 Port 3 0002 Port 2 0001 Port 1 0000 Port 1 (16 bit port) Port 0 (16 bit port)
Isolated I/O Ø Advantages: Ø 1 MByte memory address space is available for use with memory. Ø Special instructions have been provided in the instruction set of 8088/8086 to perform isolated I/O input and output operations. Ø These instructions have been tailored to maximize I/O performance. Ø Disadvantages: Ø All input and output data transfers must take place between AL or AX register and the I/O port.
Memory-mapped I/O devices is placed in memory address space of the microcomputer. Ø The memory address space is assigned to I/O devices. Ø MPU looks at the I/O port as though it is a storage location in memory. Ø Make use of instructions that affect data in memory rather than special input/output instructions.
Memory-mapped I/O FFFFF : Memory address space : E 0 FFF E 0003 : : I/O ports : : E 0002 Port 3 Port 1 E 0001 Port 2 (16 bit port) E 0000 Port 1 Port 0 (16 bit port) : : I/O addresses Port 4095 : I/O ports : : : : 00001 00000
Memory-mapped I/O Advantages: • Many more instructions and addressing modes are available to perform I/O operations. • I/O transfers can now take place between I/O port and internal registers other than just AL/AX. Disadvantages: • Memory instructions tend to execute slower than those specifically designed for isolated I/O. • Part of the memory address space is lost.
Isolated Input/Output Interface Ø The interface permits 8088/8086 microcomputers to communicate with the outside world Ø The interface between MPU and I/O is similar to MPU and memory Ø Input output data transfers also take place over the multiplexed address/data bus Ø Through this I/O interface, the MPU can input or output data in bit, byte or word (8086) formats
Isolated Input Output Interface : : Minimummode Interface Minimum-mode 8088 system I/O interface
Isolated Input Output Interface : : Minimummode Interface Minimum-mode 8086 system I/O interface
Isolated Input Output Interface : : Minimummode Interface Example of I/O device: Ø Keyboard (input). Ø Printer (output). Ø Asynchronous serial communications port (input/output) Circuits in the interface section must perform functions such as: Ø Select I/O port. Ø Latch output data. Ø Sample input data. Ø Synchronize data transfers.
Isolated Input Output Interface : : Minimummode Interface (8088) Data/Address Lines: Ø Multiplexed address/data bus. Ø Only 16 least significant lines used. Ø AD 0 -AD 7 and A 8 -A 15 Control Signals: Ø Similar to memory interface. Difference between 8088 and 8086. Ø Complete data bus used for data transfer. Ø AD 0 -AD 15. Ø M/IO complement of IO/M. Ø SSO replaced with BHE.
Isolated Input Output Interface : : Maximum-mode Interface Maximum-mode 8088 system I/O interface Maximum-mode 8086 system I/O interface
Isolated Input Output Interface : : Maximum-mode Interface (8088/86) Ø 8288 bus controller produces control signals for the I/O subsystems. Ø Decoded S 2 S 1 S 0 will determine which type of bus cycle is in progress. Ø If code corresponds to: Ø I/O read bus cycle , 8288 generates IORC. Ø I/O write bus cycle, then IOWC and AIOWC generated. Ø 8288 also produces ALE, DT/R and DEN control signals. Ø Data and addresses are transferred over AD 0 -AD 7 and A 8 -A 15. Ø 8086 differs from 8088 as follows: Ø 16 bit data bus is the path for data transfers. Ø Signal BHE is included.
Input Output Data Transfers • Data transfers: • Byte-wide or word-wide. • I/O address used to select the input/output port to be accessed. • I/O address specified as part of the instruction that performs the I/O operation. • The addresses: • 16 bits in length. • Output over AD 0 (LSb) – AD 7 and A 8 -A 15 (MSb). • The most significant address lines A 16 -A 19 = 0 during address period (T 1) of all bus cycles. • IO/M determines I/O operations. Held at 1 during the complete input/output bus cycles.
Input Output Data Transfers Data transfer (8088). Ø Performed over data bus. Ø Byte-wide transfers = 1 cycle (D 0 -D 7). Ø Word-wide transfers require two bus cycles. Ø Two consecutive byte-wide data transfers. Data transfer (8086): Ø The addresses are output on address/data bus lines AD 0 -AD 15. Ø A 0 and BHE determine whether access at odd-addressed byte-wide port, evenaddressed byte-wide port or word-wide port. Ø i. e. A 0 BHE = 10 odd-addressed byte wide I/O port is accessed.
Input Output Data Transfers Even and odd addressed byte transfer require 1 bus cycle. • Even-addressed byte transfer D 0 -D 7. • Odd-addressed byte transfer D 8 -D 15. Word data transfer can either require one or two bus cycles. • Word data transfer performed over D 0 -D 15. • One cycle word transfer I/O port is aligned at even address boundaries. • Two cycles word transfer Misaligned word.
Input Output Instructions Ø Isolated I/O mode uses special input and output instructions together with I/O port addressing modes. Ø Can either be direct or variable I/O instructions. Ø Can be used to transfer byte/word. Ø All data transfer take place over I/O device and accumulator register (AL/AX). Ø Known as accumulator I/O. Ø Byte/word wide transfer determined by AL/AX.
Input Output Instructions Mnemonic Meaning Format Operation Input direct IN Acc, Prt (Acc) (Port) Acc = AL or AX Input indirect (variable) IN Acc, DX (Acc) ((DX)) Output direct OUT Prt, Acc (Port) (Acc) Output indirect (variable) OUT DX, Acc ((DX)) (Acc) IN OUT Input/output instructions
Input Output Instructions : : Direct I/O Instructions • Address of the I/O port: • Specified as part of the instruction. • 8 bits provided for direct address, thus: • Address range is limited to 0016 -FF 16. • This range is referred as page 0 in I/O address space. • i. e. IN AL, 0 FEH • (AL) (FE 16) • Content of address FE to be input to the AL register. • Only one bus cycle.
Input Output Instructions : : Direct I/O Instructions • Example 2: • Write a sequence of instructions that will output the data 3416 to a byte-wide output port at address 8916 of the I/O address space.
Input Output Instructions • Difference between direct and variable: • The way in which the address of the I/O port is specified. • Direct 8 bit address is specified as part of the instruction. • Variable use 16 bit address in DX register. • (DX) is not an offset but actual address. • Variable I/O instructions can access ports located anywhere in the 64 K byte I/O address space. • Data/address must be loaded into or removed from AL/AX/DX before another input or output operation can be performed.
Input Output Instructions • Example 2: • Write a program that will output DA 16 to an output port located at address EA 2016 of the I/O address space. • Data are to be read in from two byte-wide input ports at address AA 16 and BA 16 and then output as a word-wide output port at address B 00016. Write a program to perform this input/output operation.
Input Output Bus Cycles Ø Signals (minimum-mode) similar to those involved in memory interface. Ø Function, logic levels and timing of all signals other than IO/M are identical to section 8. 11. Ø IO/M changes at logic level, not the timing.
Input Bus Cycles : : 8088 • T 1 : • IO/M =1 and maintained throughout the cycle. • Indicate IO operation. • ALE output together with address. • DEN =0. • Signals interface circuitry when to put data onto the bus. • 8088 reads data off the bus during period T 3. Input bus cycle of the 8088
Output Bus Cycles : : 8088 • 8088 puts data on the bus late in T 2 and maintains it during the rest of the bus cycle. • This time WR = 0. • Signals I/O system that valid data are on the bus. Output bus cycle of the 8088
Input Bus Cycles : : 8086 • Differences: • BHE output along with address in state T 1. • Used with A 0 to select even/odd address byte/word wide port. • Data transfer over 16 bit address/data bus at T 3. • M/IO replaces IO/M. • SSO = none.