300 likes | 625 Views
Computers Organization & Assembly Language. Chapter 1 THE 80x86 MICROPROCESSOR. The 80x86 Microprocessor. Brief History of the 80x86 Family Inside the 8088/8086 Introduction to Assembly Language Assembly and Machine Language. Brief History of the 80x86 Family. Intel Microprocessors.
E N D
Computers Organization& Assembly Language Chapter 1 THE 80x86 MICROPROCESSOR
The 80x86 Microprocessor • Brief History of the 80x86 Family • Inside the 8088/8086 • Introduction to Assembly Language • Assembly and Machine Language
Brief History of the 80x86 Family Intel Microprocessors • 8080/8085: • The world’s first general-purpose microprocessor. • 8-bit machine, with an 8-bit data bus to memory. • The 8080 was used in the first personal computer. • 8-bit registers and 64KB Memory. • Nonpipelined. • 8086 in 1979 : • 16-bit machine, with an 16-bit data bus to memory. • 16-bit registers and 1 MB Memory. • Pipelined. • 8088: • 16-bit machine, with an 8-bit data bus to memory. • 16-bit registers and 1 MB Memory. • Pipelined.
Brief History of the 80x86 Family Intel Microprocessors • 80286 was introduced in 1982 : • Identical to the 8086 and 8088, except I6 MB Memory. • Two modes of operations: • Real mode (DOS) with max memory 1 MB. • Protected mode(WINDOWS) with 16 MB memory. • 80386 was introduced in 1985 : • First 32-bit machine. • This was the first Intel processor to support multitasking. • Memory 4 GB. • 80486 was introduced 1989 : • Full cache technology and pipelining. • Built-in math coprocessor.
Intel 80486 and Pentium Processors • 80486 • Improved version of Intel 80386 • On-chip Floating-Point unit (DX versions) • On-chip unified Instruction/Data Cache (8 KB) • Uses Pipelining: can execute up to 1 instruction per clock cycle
Pentium (80586) was introduced in 1993 • Wider 64-bit data bus, but address bus is still 32 bits • Two execution pipelines: U-pipe and V-pipe • Superscalar performance: can execute 2 instructions per clock cycle • Separate 8 KB instruction and 8 KB data caches • MMX instructions (later models) for multimedia applications
Intel P6 Processor Family • P6 Processor Family: Pentium Pro, Pentium II and III • Pentium Pro was introduced in 1995 • Three-way superscalar: can execute 3 instructions per clock cycle • 36-bit address bus up to 64 GB of physical address space • Introduced dynamic execution • Out-of-order and speculative execution • Integrates a 256 KB second level L2 cache on-chip • Pentium II was introduced in 1997 • Added MMX instructions (already introduced on Pentium MMX) • Pentium III was introduced in 1999 • Added SSE instructions and eight new 128-bit XMM registers
Pentium 4 and Xeon Family • Pentium 4 is a seventh-generation x86 architecture • Introduced in 2000 • New micro-architecture design called Intel Netburst • Very deep instruction pipeline, scaling to very high frequencies • Introduced the SSE2 instruction set (extension to SSE) • Tuned for multimedia and operating on the 128-bit XMM registers • In 2002, Intel introduced Hyper-Threading technology • Allowed 2 programs to run simultaneously, sharing resources • Xeon is Intel's name for its server-class microprocessors • Xeon chips generally have more cache • Support larger multiprocessor configurations
Pentium-M and EM64T • Pentium M (Mobile) was introduced in 2003 • Designed for low-power laptop computers • Modified version of Pentium III, optimized for power efficiency • Large second-level cache (2 MB on later models) • Runs at lower clock than Pentium 4, but with better performance • Extended Memory 64-bit Technology (EM64T) • Introduced in 2004 • 64-bit superset of the IA-32 processor architecture • 64-bit general-purpose registers and integer support • Number of general-purpose registers increased from 8 to 16 • 64-bit pointers and flat virtual address space • Large physical address space: up to 240 = 1 Terabytes
Intel Core MicroArchitecture • 64-bit cores • Wide dynamic execution (execute four instructions simultaneously) • Intelligent power capability (power gating) • Advanced smart cache (shares L2 cache between cores) • Smart memory access (memory disambiguation) • Advanced digital media boost See the demo at http://www.intel.com/technology/architecture/coremicro/demo/demo.htm?iid=tech_core+demo
Some Important Questions to Ask • What is Assembly Language? • Why Learn Assembly Language? • What is Machine Language? • How is Assembly related to Machine Language? • What is an Assembler? • How is Assembly related to High-Level Language? • Is Assembly Language portable?
Assembly and Machine Language • Machine language • Native to a processor: executed directly by hardware • Instructions consist of binary code: 1s and 0s • Assembly language • A programming language that uses symbolic names to represent operations, registers and memory locations. • Slightly higher-level language • Readability of instructions is better than machine language • One-to-one correspondence with machine language instructions • Assemblers translate assembly to machine code • Compilers translate high-level programs to machine code • Either directly, or • Indirectly via an assembler
Instructions and Machine Language • Each command of a program is called an instruction (it instructs the computer what to do). • Computers only deal with binary data, hence the instructions must be in binary format (0s and 1s) . • The set of all instructions (in binary form) makes up the computer's machine language. This is also referred to as the instruction set.
Instruction Fields • Machine language instructions usually are made up of several fields. Each field specifies different information for the computer. The major two fields are: • Opcode field which stands for operation code and it specifies the particular operation that is to be performed. • Each operation has its unique opcode. • Operands fields which specify where to get the source and destination operands for the operation specified by the opcode. • The source/destination of operands can be a constant, the memory or one of the general-purpose registers.
Translating Languages English: D is assigned the sum of A times B plus 10. High-Level Language: D = A * B + 10 A statement in a high-level language is translated typically into several machine-level instructions Intel Assembly Language: moveax, A mul B add eax, 10 mov D, eax Intel Machine Language: A1 00404000 F7 25 00404004 83 C0 0A A3 00404008
Mapping Between Assembly Language and HLL • Translating HLL programs to machine language programs is not a one-to-one mapping • A HLL instruction (usually called a statement) will be translated to one or more machine language instructions
Advantages of High-Level Languages • Program development is faster • High-level statements: fewer instructions to code • Program maintenance is easier • For the same above reasons • Programs are portable • Contain few machine-dependent details • Can be used with little or no modifications on different machines • Compiler translates to the target machine language • However, Assembly language programs are not portable
Why Learn Assembly Language? • Accessibility to system hardware • Assembly Language is useful for implementing system software • Also useful for small embedded system applications • Space and Time efficiency • Understanding sources of program inefficiency • Tuning program performance • Writing compact code • Writing assembly programs gives the computer designer the needed deep understanding of the instruction set and how to design one • To be able to write compilers for HLLs, we need to be expert with the machine language. Assembly programming provides this experience
Assembly vs. High-Level Languages • Some representative types of applications:
Assembler • Software tools are needed for editing, assembling, linking, and debugging assembly language programs • An assembler is a program that converts source-code programs written in assembly language into object files in machine language • Popular assemblers have emerged over the years for the Intel family of processors. These include … • TASM (Turbo Assembler from Borland) • NASM (Netwide Assembler for both Windows and Linux), and • GNU assembler distributed by the free software foundation
Application Programs High-Level Language Level 5 Assembly Language Level 4 Operating System Level 3 Instruction Set Level 2 Architecture Microarchitecture Level 1 Digital Logic Level 0 Programmer’s View of a Computer System Increased level of abstraction Each level hides the details of the level below it
Programmer's View – 2 • Application Programs (Level 5) • Written in high-level programming languages • Such as Java, C++, Pascal, Visual Basic . . . • Programs compile into assembly language level (Level 4) • Assembly Language (Level 4) • Instruction mnemonics are used • Have one-to-one correspondence to machine language • Calls functions written at the operating system level (Level 3) • Programs are translated into machine language (Level 2) • Operating System (Level 3) • Provides services to level 4 and 5 programs • Translated to run at the machine instruction level (Level 2)
Programmer's View – 3 • Instruction Set Architecture (Level 2) • Specifies how a processor functions • Machine instructions, registers, and memory are exposed • Machine language is executed by Level 1 (microarchitecture) • Microarchitecture (Level 1) • Controls the execution of machine instructions (Level 2) • Implemented by digital logic (Level 0) • Digital Logic (Level 0) • Implements the microarchitecture • Uses digital logic gates • Logic gates are implemented using transistors
Instruction Set Architecture (ISA) • Collection of assembly/machine instruction set of the machine • Machine resources that can be managed with these instructions • Memory • Programmer-accessible registers. • Provides a hardware/software interface
Summary • Assembly language helps you learn how software is constructed at the lowest levels • Assembly language has a one-to-one relationship with machine language • Each layer in a computer's architecture is an abstraction of a machine • layers can be hardware or software