Lecture (02) x86 programming 1 By: Dr. Ahmed ElShafee ١ TOC Historical Perspective Basic component of microprocessor based system Types of instruction set The Memory Map of a Personal Computers The 80x86 Registers ٢
Historical Perspective 1st generation: 1945-1955 Tubes, punchcards 2nd generation: 1955-1965 transistors 3rd generation: 1965 1980 Integrated circuits 4th generation: 1980 1990 PCs and workstations 5 th generation: 1990 now Networks and distributed systems ٣ >1st generation (1945-1955) Programming was done in machine language No operating system Programming and maintenance done by one group of people ٤
ENIAC The first electronic computer (1946) 18,000 tubes 300 Tn 170 KWatt ٥ ٦
٧ > 2nd generation (1955-1965) Transistor-based Fairly reliable Clear distinction between designers, manufacturers, users, programmers, and support personnel. Only afforded by governments, universities or large companies (millions $) Program was first written on paper (FORTRAN) and then punched into cards Cards were then delivered to the user. Mostly used for scientific and technical calculations Solving differential equations ٨
٩ ١٠
> 3rd generation (1965-1980) IC-based operation IBM develops compatible systems Tradeoffs in performance, memory, I/O etc). Very expensive ١١ ١٢
١٣ > 4th generation (1980-1990) VLSI-based PCs Significantly cheaper User-friendly software 2 dominant operating systems: MS DOS: IBM PC (8088, 80286, 80386, 80486) UNIX: RISC workstations ١٤
> 5th generation (1990-till now) PC networks Network operating systems Each machine runs its own operating system Users don t care where their programs are being executed ١٥ > Moore's law Moore's law is the observation that the number of transistors in a dense integrated circuit doubles approximately every two years ١٦
١٧ > Intel x86 Evolution: Milestones Name Date Transistors MHz 8086 1978 29K 5 10 First 16 bit Intel processor. Basis for IBM PC & DOS 1MB address space 386 1985 275K 16 33 First 32 bit Intel processor, referred to as IA32 Added "flat addressing", capable of running Unix IA32 is an abbreviation of "Intel Architecture 32 bit"; it refers to common 32 bit computer architectures. where "architecture" means [hardware] + [appropriate Operating System]; ١٨
Name Date Transistors MHz Pentium 4E 2004 125M 2800 3800 First 64 bit Intel x86 processor, referred to as x86 64 Core 2 2006 291M 1060 3333 First multi core Intel processor Core i7 2008 731M 1600 4400 Four cores ١٩ > Machine Evolution 386 1985 0.3M Pentium 1993 3.1M Pentium/MMX 1997 4.5M PentiumPro 1995 6.5M Pentium Ill 1999 8.2M Pentium 4 2000 42M Core 2 Duo 2006 291M Core i7 2008 731M ٢٠
Past Generations year Process technology 1st Pentium Pro 1995 600 nm 1st Pentium Ill 1999 250 nm 1st Pentium 4 2000 180 nm 1st Core 2 Duo 2006 65 nm Process technology dimension = width of narrowest wires (10 nm == 100 atoms wide) ٢١ Recent & Upcoming Generations 1. Nehalem 2008 45 nm 2. Sandy Bridge 2011 32 nm 3. Ivy Bridge 2012 22 nm 4. Haswell 2013 22 nm 5. Broadwell 2014 14 nm 6. Skylake 2015 14 nm 7. Kaby Lake 2016 14 nm 8. Coffee Lake 2017 14 nm 9. Cannonlake 2018? 10 nm ٢٢
> x86 Clones: Advanced Micro Devices (AMD) Historically AMD has followed just behind Intel A little bit slower, a lot cheaper Then Recruited top circuit designers from Digital Equipment Corp. and other downward trending companies Built Opteron: tough competitor to Pentium 4 Developed x86 64, their own extension to 64 bits ٢٣ Recent Years Intel got its act together Leads the world in semiconductor technology AMD has fallen behind Relies on external semiconductor manufacturer ٢٤
> Intel's 64 Bit History 2001: Intel Attempts Radical Shift from IA32 to IA64 Totally different architecture (ltanium) Executes IA32 code only as legacy Performance disappointing 2003: AMD Steps in with Evolutionary Solution x86 64 (now called "AMD64") Intel Felt Obligated to Focus on IA64 Hard to admit mistake or that AMD is better ٢٥ 2004: Intel Announces EM64T extension to IA32 Extended Memory 64 bit Technology Almost identical to x86 64! All but low end x86 processors support x86 64 But, lots of code still runs in 32 bit mode ٢٦
Basic component of micro processor based system ٢٧ > 86x in action; Fetching & Execution Cycles Fetching Cycles The fetch cycle takes the instruction required from memory, stores it in the instruction register, and moves the program counter on one so that it points to the next instruction. ٢٨
Execute cycle The actual actions which occur during the execute cycle of an instruction. depend on both the instruction itself and the addressing mode specified to be used to access the data that may be required. ٢٩ > Fetching an instruction Step 1 Instruction pointer (program counter) hold the address of the next instruction to be fetch. 30
Step 2 31 Step 3 32
Step 4 33 Step 5 34
Step 6 35 ٣٦
> ALU Arithmetic and Logic Unit The component that performs the arithmetic and logical operations the most important components in a microprocessor, and is typically the part of the processor that is designed first. able to perform the basic logical operations (AND, OR), including the other additional operation. The inclusion of inverters on the inputs enables the same ALU hardware to perform the subtraction operation (adding an inverted operand), and the operations NAND and NOR. ٣٧ 2 bits of ALU 4 bits of ALU ٣٨
> Control Unit The circuitry that controls the flow of information through the processor, and coordinates the activities of the other units within it. In a way, it is the "brain within the brain", as it controls what happens inside the processor, which in turn controls the rest of the PC. On a regular processor, the control unit performs the tasks of fetching, decoding, managing execution and then storing results. ٣٩ > Internal structure of control unit ٤٠
> Register sets The register section/array consists completely of circuitry used to temporarily store data or program codes until they are sent to the ALU or to the control section or to memory. The number of registers are different for any particular CPU and the more register a CPU have will result in easier programming tasks. Registers are normally measured by the number of bits they can hold, for example, an "8 bit register" or a "32 bit register". ٤١ > IA32 Registers ٤٢
> x86 64 Integer Registers ٤٣ ** Accumulator a register in which intermediate arithmetic and logic results are stored. example for accumulator use is summing a list of numbers. The accumulator is initially set to zero, then each number in turn is added to the value in the accumulator. Only when all numbers have been added is the result held in the accumulator written to main memory or to another, nonaccumulator, CPU register. ٤٤
** Program counter (PC) a register, used to store the next address of the operation code to be fetched by the CPU. Not much use in programming, but as an indicator to user only. Purpose of PC in a Microprocessor to store address of next instruction to be executed. ٤٥ > Bus system a subsystem that transfers data between computer components inside a computer or between computers. ٤٦ 4 PCI Express bus card slots (from top to bottom: x4, x16, x1 and x16), compared to a traditional 32-bit PCI bus card slot (very bottom).
٤٧ > Data bus The data bus is 'bi directional' data or instruction codes from memory or input/output are transferred into the microprocessor the result of an operation or computation is sent out from the microprocessor to the memory or input/output. Depending on the particular microprocessor, the data bus can handle 8 bit or 16 bit data. ٤٨
> Address bus The address bus is 'unidirectional', over which the microprocessor sends an address code to the memory or input/output. The size (width) of the address bus is specified by the number of bits it can handle. The more bits there are in the address bus, the more memory locations a microprocessor can access. A 16 bit address bus is capable of addressing 65,536 (64K) addresses. ٤٩ > Control bus The control bus is used by the microprocessor to send out or receive timing and control signals in order to coordinate and regulate its operation and to communicate with other devices, i.e. memory or input/output. ٥٠
Thanks,.. ٥١