electrical engineering department engineering college prince sattam bin abdul aziz university text...

35
Microprocessor Laboratory Electrical Engineering Department Engineering College Prince Sattam bin Abdul Aziz University Text Book: - Triebel and Singh, "The 8088 and 8086 Microprocessors", Prentice Hall, Last Edition. Course Grading: Midterm # 1 : (20%) Midterm # 2 : (20%) Reports & Projects : (10%)

Upload: anabel-evans

Post on 12-Jan-2016

226 views

Category:

Documents


4 download

TRANSCRIPT

PowerPoint Presentation

Microprocessor LaboratoryElectrical Engineering DepartmentEngineering CollegePrince Sattam bin Abdul Aziz University Text Book: - Triebel and Singh, "The 8088 and 8086 Microprocessors", Prentice Hall, Last Edition.Course Grading: Midterm # 1: (20%)Midterm # 2: (20%)Reports & Projects : (10%)Lab Performance : (10%)FinalExam : (40%)Course PlanMicroprocessor architecture Instruction setsAssembly language programming and debuggingInput and Output InterfacingInterrupt controller interfacingProject. Micro-controllersIntroduction Microprocessors touch nearly every aspect of our lives. Just a few of the products which use microprocessors are:CamerasCalculatorsAutomobilesElectronic ToysElectronic Credit Card MachinesMicrowave OvensWhat is a microprocessor?Microprocessors are small electronic devices which manipulate and control digital data with great speed and accuracy. Typically, they are about 3 to 4 inches long and about 1 inch wide.Figure . Microprocessor

The list of products using microprocessors goes on and on, including extensive andelectronic systems. For instance, in automobiles, microprocessors control and monitoralmost every aspect. The car's speed, fuel intake and consumption, transmission, andeven the displays of clocks and gauges are managed by a microprocessor. Without doubt,microprocessors are powerful and indispensable.

can performmillions of operations per second.4Computer BasicsFigure . Fundamental Microcomputer

INPUT: Provides information from the outside world, acting as the eyes and ears of the computer system.

2. CONTROL: Directs the overall functioning of the computer. All information must pass through the control during its processing.

3. MEMORY: Supplies temporary storage for information to be processed and permanent storage for program instructions.

4. A.L.U.: The Arithmetic Logic Unit is the actual calculating mechanism, where operations are performed on the information that is input.

5. OUTPUT: Delivers the processed information to the outside world.

Microprocessor: Microprocessor is a simple central processing unit (CPU) on a single chip (remember the word Single Chip). It includes Arithmetic logic unit (ALU), control unit (CU), registers, instruction decoders, bus control circuit etc. but everything should be on a single chip.Microcomputer: A microcomputer is the association of microprocessor and the peripheral I/O devices, support circuitry and memory (both data and program). It is not necessary to be on a single chip (remember this point, not in a single chip).5Basic Microprocessor OperationsObjectives:How memory locations are addressed How data is stored5 basic internal registersIntroductionComputer buses:Address bus (carries location details),Control bus (carries timing and enable/disable signals), Data bus (carries instructions and information to be processed). CPU receives the signals and operates upon themHow the microprocessor uses these signals to perform its required tasks?Operational ProcessMemory contains many locations for data or instructions.Each location has a unique address. We access a location by :sending the location's address to the memory section and enabling READ (get from) or WRITE (send to).

The microprocessor then gets the data stored at that address or it moves data into that location.Operational ProcessMemory capacity: measured by the number of bytes it can hold. Recall that: control section a word to memory, it must provide the memory with the address where the word is to go. Ex. Emailing Address In a computer, this address is sent by transmitting an additional one or two words to the memory section.Internal RegistersWhere to find the data?What to do with the results?Internal Registers: Status (Flag) RegisterGeneral Purpose RegistersAddress RegistersProgram CounterStack Pointer In a computer, a register is one of a small set of data holding places that are part of a computerprocessor. A register may hold a computerinstruction, a storage address, or any kind of data (such as a bit sequence or individual characters). Some instructions specify registers as part of the instruction. For example, an instruction may specify that the contents of two defined registers be added together and then placed in a specified register. A register must be large enough to hold an instruction - for example, in a 32-bit instruction computer, a register must be 32 bits in length. In some computer designs, there are smaller registers - for example,half-registers- for shorter instructions. Depending on the processor design and language rules, registers may be numbered or have arbitrary names10Status (Flag) Registers Used to store a binary word representing the status of ALUEach bit (or flag) of the status register represents a specific condition.

Bit #7 and #6 (U): UnusedBit #5 (C): Carry Flag - Set when there is a carry of the MSBBit #4 (O): Overflow Flag - Set if the result is out of rangeBit #3 (Z): Zero Flag - Set if the result = 0Bit #2 (N): Negative Flag - Set if the result is negativeBit #1 (I): Interrupt Flag - Set if Interrupt is enabledBit #0 (P): Parity Flag - Set if the result has even parity (if there are an even number of 1's in the result)

General Purpose (GP) RegistersRequired for processors to operate as fast as they do. Accumulator is a general purpose register which the ALU often uses as the default location for an operand.

The accumulator is a general purpose register which the ALU often uses as the defaultlocation for an operand. In other words, if an instruction does not specify a particularregister as an address for the information that will be processed, the data will be placed inthe accumulator.

12GP registers store one data word Each 8-bit Mic. have 8-bit GP registersTypically, each Pair register is named with a letter, for instance, "register A", "B", or "C". Individual one-word registers named "register AL" (low word of register pair A) or "register AH" (high word of register pair A).General Purpose (GP) RegistersAddress RegistersTwice the length of the microprocessor's word size.Connected to the address bus and access the location of data in memory.Address is stored in an address registerUsed by the control unit whenever data is moved to or from the address.

Program Counter (PG)Contains the address of the next instruction to be executed.PG begins at the memory address (e.g., 00010001) and then increments to the next address (i.e., 00010010) when the instruction in the first location has been executed. The process repeats until the program re-directs the program counter or terminates.Stack Pointer Automatically adjusts to the next available (empty) location in the stack, which is a block of memory that stores data.One format of storage is FILO (First In, Last Out) The stack pointer indicates which data is to be accessed for correct execution of the program.A stack pointer is a smallregisterthat stores the address of the last program request in a stack. A stack is a specializedbufferwhich stores data from the top down. As new requests come in, they "push down" the older ones. The most recently entered request always resides at the top of the stack, and the program always takes requests from the top.Next StepsWhat is a delegate in .NET?(SearchSOA.com)Converting an adjacency list model to a nested set modelAnother way of representing trees in SQL is to ...(SearchOracle.com)A stack (also called a pushdown stack) operates in a last-in/first-out sense. When a new data item is entered or "pushed" onto the top of a stack, the stack pointer increments to the next physical memory address, and the new item is copied to that address. When a data item is "pulled" or "popped" from the top of a stack, the item is copied from the address of the stack pointer, and the stack pointer decrements to the next available item at the top of the stack.

16Computer InstructionsAn instruction consists of a mnemonic (which the human operator understands) and its binary code (which the computer actually uses).Examples of mnemonics: MOV (for "move"), ADD (for "add"), SUB (for "subtract"), CMP (for "compare"), and JMP (for "jump").

Architectures of 8080A and 8086 Microprocessors Objectives: Describe the major components of the 8080A microprocessor.Describe the major components of the 8086 microprocessor.Discuss the differences between the 8080A and the 8086 microprocessorsAs you know, the microprocessor is thecombination of the control unit, ALU(Arithmetic Logic Unit), internal registers,and input/output ports. Eachmicroprocessor is different, depending onits specific manufacturer and its intendedapplication, such as microwave ovens orcalculators.18The 8080A is an 8-bit microprocessor.Means that: its data bus and ALU are 8-bits. Address Registers 16 bits.

Address bus PortsData Bus Ports8080A MICROPROCESSORSAlthough it may not be used inmany new systems, it is still embedded in older systems.19

Accumulator : 8 bits,Program counter : 16 bits, Flag register : 5 bits.

8080A MICROPROCESSORS8080A Mic. (Internal Registers) Flag Register: The 8080A's flag register is 8 bits wide and gives the status of 5 different conditions.1- Carry Flag (CY) - Set by carry out of bit 7 (MSB)2- Zero Flag (Z) - Set if result equals zero3- Sign (S) - Set for positive numbers4- Parity (P) - Set if even parity (even number of ones)5- Auxiliary Carry (AC) - Set if carry out of bit 3 (used in BCD arithmetic)

General Purpose (GP) Registers: Six 8-bit GP registers. These registers can be paired to form three 16-bit registers. The register pairs are B&C, D&E, and H&L. Address Register:Contains the address of the memory location or I/O device to be enabled. This register is 16 bits wide. This means that the 8080A can access up to 64 KB (2^16) of memory.8080A MICROPROCESSORSProgram Counter:contains the address of the next instruction to be executed.same width (16 bits) as the address register Stack Pointer: The stack can be located any place in memory. Therefore, the stack pointer must be able to locate any place in memory. Because the memory is 64 KB, the stack pointer is 16 bits wide.8080A MICROPROCESSORS8080A INTERNAL BUS SYSTEM:Data Bus: 8 bits wide.transmits information (data or instructions) to and receives information from any specified device. Address Bus :16-bit select one memory location or I/O device.Control Bus : synchronizes and enables the devices and operations

8080A MICROPROCESSORSFigure . Block Diagram of the 8086Exercise 1: 8080A Microprocessor.1. What is the length of the 8080A's data bus?2. What is the length of the 8080A's address bus?3. How many locations can the 8080A address?4. What is the length of the 8080A's ALU?248086 Microprocessor Figure. The 8086 I/O PortThe lowest 16 bits of this port act as both the data bus port and the address bus port. The highest 4 bits are dedicated to the address bus.The I/O port has sequential pin numbers.

One of the biggest improvements is thesingle power supply of the 8086. The 8080A required3 separate power supplies (+5V, 5V, +12V), whichadd to the complexity of the external circuitry.25

Figure . Block Diagram of the 80868086 Microprocessor ALU: Unlike the 8080A, the ALU in the 8086 can work directly with any register or memory location.Means that: nearly all arithmetic and logic instructions (except division) can be performed without first loading the accumulator with one of the operands, as is required in the 8080A.

8080A INTERNAL BUS SYSTEM:The 8086 uses one bus for both the data and address buses.8086 Microprocessor

Flag Registers:16 flag registers available in the 8086. Nine flags are used: six status flags and three control flags.Status Flags1- Carry Flag (CF): Set when there is a carry out of the high order bit (8 or 16 bit) of the result.2- Parity Flag (PF): Set if result contains an even number of 1's.3- Auxiliary Carry Flag (AF): Set when there is a carry out of the low nibble.4- Zero Flag (ZF): Set if the result equals zero.5- Sign Flag (SF): Set if the result is a negative number.6- Overflow Flag (OF): Set if the size of the result exceeds the size of the ALU.8086 Microprocessor: Control Flags:Trap Flag (TF)Interrupt Flag (IF)Direction Flag (DF) 8086 Microprocessor: Flag Registers:The 8086 contains four 16-bit GP registers named AX (accumulator), BX, CX, and DX. Each of these registers can be split into its High (H) and Low (L) byte to form eight 8-bit registers named AL, AH, BL, BH, and so on.

Figure. General Purpose Registers in the 80868086 Microprocessor: General Purpose (GP) Registers: The 8086 also contains pointer, segment, and index registers.

Figure . Pointer and Segment Registers in the 8086The Instruction Pointer :Points to the next instruction to be executed. This register is similar to the 8080A's program counter. 8086 has a 20-bit address bus Segment Registers is required. 8086 Microprocessor: General Purpose (GP) Registers: Index registers : used for various types of addressing. Because the 8086 has a 20-bit address bus, it can access up to 1 MB (220) of memory.Code Segment register :in combination with the instruction pointer allows the entire memory to be addressed. 8086 Microprocessor: General Purpose (GP) Registers: Exercise 2: 8086 Microprocessor.1. What is the length of the 8086's data bus?2. What is the length of the 8086's address bus?3. How many locations can the 8086 address?4. What is the length of the 8086's ALU?32SUMMARYThe major parts of a typical microprocessor are: Control ALU Internal registers I/O PortsThe 8080A is an 8-bit microprocessor an 8-bit flag Register, an 8-bit ALU, a16-bit address bus, an 8-bit data bus.The 8086 is a 16-bit microprocessor a 16-bit flag registera 16-bit ALU.Its 20-bit address bus shares 16 bits with the data bus.

SUMMARYInternal registers of the 8080A include: ALU, accumulator, flag register, GP registers, address register, program counter, and stack pointer.Internal registers of the 8086 include: ALU, flag register, GP registers, instruction pointer, code segment register, and index registers. The flag register of the 8080A uses 5 of its 8 bits: Carry flag, zero flag, sign flag, parity flag, and auxiliary carry flag.The flag register of the 8086 uses 9 of its 16 bits: 6 are status flags (parity flag, auxiliary carry flag, zero flag, sign flag, and overflow flag) 3 control flags (trap flag, interrupt flag, and direction flag).Both the 8080A and the 8086 microprocessors have 3 buses: data bus, address bus, and control bus.The 8080A ALU always works with the accumulator. SUMMARY