16
Microprocessor and Assembly Language

2 Introduction to Microprocessors

Embed Size (px)

DESCRIPTION

Introduction to MicroprocessorsPIC Simulator IDE can be used in this subject

Citation preview

  • Microprocessor and Assembly Language

  • History of MicroprocessorA microprocessor (sometimes abbreviated P) is a digital electronic component with transistors on a single semiconductor integrated circuit (IC). A Central processing unit (CPU) in a computer system or handheld device consists of one or more microprocessors.

  • A Microprocessor is essentially a set of switches.Using photographic technology a massive set of electronic switches is superimposed onto a very small piece of silicon.Through the use of binary language, which consists of only two states; one and zero (on and off), these can be used to store information and perform operations on it.

  • A bit refers to one binary digit; a zero or one.In computer memory and processing this refers to the state of one switch.The transistors are arranged into groups in order to represent complex numbers and instructions

  • The very first microprocessor is considered to be the Intel 4004.It was released in 1971 and was a 4 Bit processor.Then the 8 bit 8008 microprocessor. It was developed by Intel in 1972The first multi-chip 16 bit processor was released by National Semiconductor in 1973Intel upgraded the 8008 into a 16 bit version they called the 8086.It was the first of the x86 family by which many modern PCs are powered.

  • 32 bit designs didn't require much to improve performance since it has double the size of instructions as well as the amount of addressable memory. 68000 by Motorola was one of the first microprocessors developed to 32 bit architectures. It was released in 1979 and continued to be in use today.

  • Most of today's computers are turning to 64 bit designs to handle dealing with very large amounts of data. This is needed especially as demand for 3D Graphics and fast video has risen.E.g. AMD Athlon, Pentium i5/i7 processors.

  • Microprocessors are classified into different types on the basis of the bit of operation. Based on bit of operation at a time, the following are the types of microprocessors:==> 4 bit. e.g. Intel 4004==> 8 bit. e.g. Intel 8085, 8088, Zilog Z80, Z180==> 16 bit. e.g. Intel 8086, 80186, 80286, 80386, ==> 32 bit. e.g. Intel Pentium, Celeron, AMD Sempron==> 64 bit. e.g. AMD Athlon.

    Based on the instruction set microprocessors are classified into:RISC Reduced Instruction Set Computing. These types of processors are commonly used in ovens, air conditioners, etc.CISC Complex Instruction Set Computing. The types of processors are used in desktops, laptops and servers.

  • Microcomputer Block Diagram

  • Basic Block Diagram of MicroprocessorALU Performs all arithmetic and logical operationsRegister array Holds the data temporarily for processingControl Unit It supervises/ monitors all the operations carried out in the computer

  • The 8085 MicroprocessorThe 8085 microprocessor was introduced by Intel in the year 1976. This microprocessor is an update of 8080 microprocessor. The 8080 processor was updated with Enable/Disable instruction pins and Interrupt pins to form the 8085 microprocessor. It is an 8-bit microprocessor with a 40 pin dual in line package

  • Pin Diagram of a Basic8085 Microprocessor

  • Flag RegInstruction Reg

    Instruction decoderAddress Buffer A8-A15BC

    DEHLStack PointerProgram CounterIncrementer/ DecrementerAddress latchData/address Buffer AD0-AD7Temp. RegAccumulator

    Arithmetic and Logic Unit

    Timing and Control unit

    RAM memory

    8-bit_Internal_databusIntel 8085 Microprocessor Architecture8- bit External Data busReadWriteClock

  • The 8085 has a set of registers for performing various operations. The various registers include:Accumulator 8 bit register which holds the latest result from ALU

    B, C, D, E, H and L are general purpose registers

    HL pair can be used for indirect addressing as well

    Program counter 16 bit register which holds the address of the next instruction to be executed

    Instruction register It holds the instruction that is currently being processed.

    Stack pointer is used during subroutine calling and execution.

    Address Latch It increments/ decrements the address before sent to the address buffer

  • Various FlagsSign Flag:If the result of the latest arithmetic operation is having MSB (most- significant byte) 1 (meaning it is a negative number), then the sign flag is set. Otherwise, it is reset to 0 which means it is a positive number.

    Zero flag: If the result of the latest operation is zero, then zero flag will be set; otherwise it be reset.

    Auxiliary Carry Flag: This flag is not accessible to programmer. This flag will be used by the system during BCD (binary-coded decimal) operations.

    Parity Flag: If the result of the latest operation is having even number of 1s, then this flag will be set. Otherwise this will be reset to 0. This is used for error checking.

    Carry Flag: If the result of the latest operations exceeds 8-bits then this flag will be set. Otherwise it be reset.

  • An example assembly language programAddress Instruction

    202AMVIA, 21;Copies 21 into accumulator202CMVIB, 2A;Copies 2A into B register202EADDB;Adds B reg content with Acc and stores the result in Acc.202FSTA41 FF; Stores the Acc (the sum) into the memory location 41 FF.2032HLT; Stops the program

  • Memory storage of the Assembly languageAddressInstruction/Data

    202AMVIA, 202B21202CMVIB, 202D2A202EADDB202FSTA2030FF 412032HLT

  • Another example assembly language programAddress Instruction

    2020MVIB, 24;Copies 24 into accumulator2022INRB;Increment B reg content by 12023MOVA, B;Copies B register into Acc.2024SUBB;Subtracts B reg content from Acc and stores the result in Acc.2025STA5F FF; Stores the Acc content into the memory location 5F FF.2028HLT; Stops the program

  • Reference:http://www.brighthub.com/engineering/electrical/articles/51225.aspx

    http://www.cpu-world.com/Arch/8085.html

    http://www.ehow.com/way_5230222_8085-microprocessor-tutorial.html

    http://www.brighthub.com/engineering/electrical/articles/51225.aspx

    *ALU:it is 8-bit ALU. It can perform arithmetic and logical operations on 8-bit data. If an operation needs to be performed on 16-bit data, it needs to be broken into two 8-bit parts and each 8-bit operation should be performed on each 8-bit data. It takes operand inputs from accumulator and a temporary register. Result of the operation is stored in accumulator. Depending on the result of operation, flags in flag register values will be changed.

    Flag register:contents of flag register will be changed according to the result of ALU operation

    Timing and Control unit:This is responsible for generation of control signals, such as RD, WR to interface peripherals. It also synchronizes all microprocessor operations.

    Instruction Register and Decoding:Instruction register holds instruction that is fetched from memory. Instruction decoder decodes the opcode (which is part of fetched instruction present in instruction register). Instruction register is not accessible to the programmer.

    general purpose registers B, C, D, E, H, L. They can be used as pairs to hold 16-bit data as BC, DE, HL. Accumulator is 8-bit register which holds the results of operations as well as operand on which some operation needs to be performed. Flag register contains five flags, namely S, Z, CY, AC, P flags. 8085 has two 16- bit register PC, SP.

    Program Counter always consists of address of next instruction to be executed.

    Stack Pointer always points to top of stack. i.e. address of top memory location of stack. Stack is a data structure. It is used to store return addresses whenever call to subprograms or an interrupt occurs. Two temporary registers W, Z are also present. These are used to hold temporary results during execution. But these are not accessible to the user.

    Incrementer and decrementer address latch is for incrementing the PC content for every fetch cycle.

    Interrupt Controller:8085 has 5 external interrupts. TRAP, INTR, RST 5.5, RST 6.5, and RST 7.5. Whenever processor gets interrupt it finishes current instruction execution and issues INTA (interrupt acknowledge) signal to the peripheral which raised the interrupt and goes to execute interrupt service routine. Interrupt controller controls the interrupts.

    Serial I/O control: Serial data can be sent out using SOD pin and serial data can be read from SID pin. It controls serial IO related operations.

    *