Today’s topics Architecture overview Architecture overview Machine instructions Machine instructions Instruction Execution Cycle Instruction Execution.

Slides:



Advertisements
Similar presentations
The CPU The Central Presentation Unit What is the CPU?
Advertisements

Control path Recall that the control path is the physical entity in a processor which: fetches instructions, fetches operands, decodes instructions, schedules.
Computer Organization and Architecture
Room: E-3-31 Phone: Dr Masri Ayob TK 2123 COMPUTER ORGANISATION & ARCHITECTURE Lecture 5: CPU and Memory.
Processor Technology and Architecture
CHAPTER 4 COMPUTER SYSTEM – Von Neumann Model
COMP3221: Microprocessors and Embedded Systems Lecture 2: Instruction Set Architecture (ISA) Lecturer: Hui Wu Session.
Chapter 0 Introduction to Computing
Data Manipulation Computer System consists of the following parts:
CSCE 121, Sec 200, 507, 508 Fall 2010 Prof. Jennifer L. Welch.
Topics covered: CPU Architecture CSE 243: Introduction to Computer Architecture and Hardware/Software Interface.
Chapter 4 Processor Technology and Architecture. Chapter goals Describe CPU instruction and execution cycles Explain how primitive CPU instructions are.
Informationsteknologi Friday, October 19, 2007Computer Architecture I - Class 61 Today’s class Floating point numbers Computer systems organization.
2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.
Group 5 Alain J. Percial Paula A. Ortiz Francis X. Ruiz.
CEG 320/520: Computer Organization and Assembly Language Programming1 CEG 320/520 Computer Organization and Assembly Language Programming.
Processor Structure & Operations of an Accumulator Machine
Micro-operations Are the functional, or atomic, operations of a processor. A single micro-operation generally involves a transfer between registers, transfer.
University of Texas Pan AmDr. John P. Abraham Information Technology Computer Architecture Dr. John P. Abraham.
CHAPTER 3 TOP LEVEL VIEW OF COMPUTER FUNCTION AND INTERCONNECTION
Dr Mohamed Menacer College of Computer Science and Engineering Taibah University CS-334: Computer.
Computer Systems Organization CS 1428 Foundations of Computer Science.
Introduction to Computing Systems from bits & gates to C & beyond The Von Neumann Model Basic components Instruction processing.
Multiple-bus organization
Fall 2012 Chapter 2: x86 Processor Architecture. Irvine, Kip R. Assembly Language for x86 Processors 6/e, Chapter Overview General Concepts IA-32.
Chapter 4 MARIE: An Introduction to a Simple Computer.
1Copyright © Prentice Hall 2000 The Central Processing Unit Chapter 3 What Goes on Inside the Computer.
ECE 456 Computer Architecture
Cis303a_chapt04.ppt Chapter 4 Processor Technology and Architecture Internal Components CPU Operation (internal components) Control Unit Move data and.
The Central Processing Unit (CPU) and the Machine Cycle.
General Concepts of Computer Organization Overview of Microcomputer.
Lecture 14 Today’s topics MARIE Architecture Registers Buses
Computer Architecture and Organization
Chapter 4 MARIE: An Introduction to a Simple Computer.
Computer Architecture EKT 422
Computer Hardware A computer is made of internal components Central Processor Unit Internal External and external components.
Computer Structure & Architecture 7b - CPU & Buses.
Computer Architecture Lecture 03 Fasih ur Rehman.
Kavita Bala CS 3410, Spring 2014 Computer Science Cornell University.
Stored Programs In today’s lesson, we will look at: what we mean by a stored program computer how computers store and run programs what we mean by the.
Stored Program A stored-program digital computer is one that keeps its programmed instructions, as well as its data, in read-write,
Monday, January 14 Homework #1 is posted on the website Homework #1 is posted on the website Due before class, Jan. 16 Due before class, Jan. 16.
Computer and Information Sciences College / Computer Science Department CS 206 D Computer Organization and Assembly Language.
System Unit Working of CPU. The CPU CPU The CPU CPU stands for central processing unit. it is brain of computer It is most important component of the.
Processor Structure and Function Chapter8:. CPU Structure  CPU must:  Fetch instructions –Read instruction from memory  Interpret instructions –Instruction.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Overview von Neumann Architecture Computer component Computer function
Computer operation is of how the different parts of a computer system work together to perform a task.
What is a program? A sequence of steps
Simple ALU How to perform this C language integer operation in the computer C=A+B; ? The arithmetic/logic unit (ALU) of a processor performs integer arithmetic.
Instruction Sets. Instruction set It is a list of all instructions that a processor can execute. It is a list of all instructions that a processor can.
1 Basic Processor Architecture. 2 Building Blocks of Processor Systems CPU.
The Processor & its components. The CPU The brain. Performs all major calculations. Controls and manages the operations of other components of the computer.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Chapter 20 Computer Operations Computer Studies Today Chapter 20.
The Central Processing Unit
Architecture Review Instruction Set Architecture
CSCE Fall 2013 Prof. Jennifer L. Welch.
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Computer Architecture
Chapter 9 Instruction Sets: Characteristics and Functions
CSCE Fall 2012 Prof. Jennifer L. Welch.
Introduction to Microprocessor Programming
Computer Architecture
COMPUTER ARCHITECTURE
Chapter 10 Instruction Sets: Characteristics and Functions
Presentation transcript:

Today’s topics Architecture overview Architecture overview Machine instructions Machine instructions Instruction Execution Cycle Instruction Execution Cycle CISC machines CISC machines Microprograms Microprograms RISC machines RISC machines Parallelism Parallelism Instruction-level Instruction-level Processor-level Processor-level Internal representation Internal representation Limits of representation Limits of representation External representation External representation Binary, octal, decimal, hexadecimal number systems Binary, octal, decimal, hexadecimal number systems

Terms CPU: Central Processing Unit CPU: Central Processing Unit ALU: Arithmetic/Logic Unit ALU: Arithmetic/Logic Unit Memory: storage for data and programs (separate from CPU) Memory: storage for data and programs (separate from CPU) Register: fast temporary storage inside the CPU Register: fast temporary storage inside the CPU Bus: parallel "wires" for transferring a set of electrical signals simultaneously Bus: parallel "wires" for transferring a set of electrical signals simultaneously Internal: Transfers signals among CPU components Internal: Transfers signals among CPU components Control: Carries signals for memory and I/O operations Control: Carries signals for memory and I/O operations Address: Links to specific memory locations Address: Links to specific memory locations Data: Carries data CPU  memory Data: Carries data CPU  memory Microprogram: sequence of micro-instructions required to execute a machine instruction Microprogram: sequence of micro-instructions required to execute a machine instruction Cache: temporary storage for faster access Cache: temporary storage for faster access Note: caching takes place at many levels in a computer system Note: caching takes place at many levels in a computer system

Registers General/Temporary: fast local memory inside the CPU General/Temporary: fast local memory inside the CPU one type of cache one type of cache Control: dictates current state of the machine Control: dictates current state of the machine Status: indicates error conditions Status: indicates error conditions IR: Instruction Register (holds current instruction) IR: Instruction Register (holds current instruction) IP: Instruction Pointer (holds memory address of next instruction) IP: Instruction Pointer (holds memory address of next instruction) MAR: Memory Address Register (holds address of memory location currently referenced) MAR: Memory Address Register (holds address of memory location currently referenced) MDR: Memory Data Register: holds data being set to or retrieved from the memory address in the MAR MDR: Memory Data Register: holds data being set to or retrieved from the memory address in the MAR

Machine instructions Each computer architecture provides a set of machine-level instructions Each computer architecture provides a set of machine-level instructions Instruction Set Architecture (ISA) Instruction Set Architecture (ISA) Specific to one particular architecture Specific to one particular architecture Like everything inside a computer, machine instructions are implemented electrically Like everything inside a computer, machine instructions are implemented electrically Micro-instructions set the switches in the control register Micro-instructions set the switches in the control register

Hypothetical CISC* machine Shows hardware components Shows hardware components Does not show digital logic level or microprograms. Does not show digital logic level or microprograms. Shows how machine-level instructions can be stored and executed. Shows how machine-level instructions can be stored and executed. Illustrates Illustrates Finite-state machine Finite-state machine *CISC *CISC Complex Instruction Set Computer Complex Instruction Set Computer VonNeumann architecture VonNeumann architecture Instruction execution cycle Instruction execution cycle

Real computers … Use the “stored program” concept Use the “stored program” concept VonNeumann architecture VonNeumann architecture Program is stored in memory, and is executed under the control of the operating system Program is stored in memory, and is executed under the control of the operating system Operate using an Instruction Execution Cycle Operate using an Instruction Execution Cycle

Instruction Execution Cycle 1.Fetch next instruction (at address in IP) into IR. 2.Increment IP to point to next instruction. 3.Decode instruction in IR 4.If instruction requires memory access, A.Determine memory address. B.Fetch operand from memory into a CPU register, or send operand from a CPU register to memory. 5.Execute micro-program for instruction 6.Go to step 1. Note: default execution is sequential

Example CISC Instruction ADDR1, mem1 ;(Add contents of memory location mem1 to register R1) 1.Copy contents of R1 to ALU Operand_1 2.Move address of mem1 to MAR 3.Signal memory fetch (gets contents of memory address currently in MAR into MDR) 4.Copy contents of MDR into ALU Operand_2 5.Signal ALU addition 6.Check Status Register 7.Copy contents of ALU Result to R1 Example ADD Microprogram (each microinstruction executes in one clock cycle)

Improving CISC CISC speed (and convenience) is increased by CISC speed (and convenience) is increased by more efficient microprograms more efficient microprograms more powerful ISA level instructions more powerful ISA level instructions cache memory cache memory more registers more registers wider buses wider buses making it smaller making it smaller more processors more processors floating point instructions floating point instructions Etc. Etc.

Clock Cycles So how “slow” is this? So how “slow” is this? It isn’t slow It isn’t slow Execution near light-speed Execution near light-speed Clock cycle length determines CPU speed Clock cycle length determines CPU speed (mostly) (mostly)

Limitations of CISC Improving a specific architecture requires instructions to be backward compatible. So … how about a different architecture?

RISC machines Reduced Instruction Set Computer Much smaller set of instructions at ISA level Much smaller set of instructions at ISA level Instructions are like CISC micro-instructions Instructions are like CISC micro-instructions RISC assembly level programs look much longer (more instructions) than CISC assembly level programs, but they execute faster. Why? RISC assembly level programs look much longer (more instructions) than CISC assembly level programs, but they execute faster. Why?

RISC design principles Instructions executed directly by hardware (no microprograms). Instructions executed directly by hardware (no microprograms). Maximize rate of fetching instructions. Maximize rate of fetching instructions. Instruction cache Instruction cache Instructions easy to decode Instructions easy to decode Fetching operands, etc. Fetching operands, etc. Only LOAD and STORE instructions reference memory. Only LOAD and STORE instructions reference memory. Plenty of registers Plenty of registers

More speed improvement Minimize memory and I/O accesses Minimize memory and I/O accesses Cache Cache Separate I/O unit (buffers/processing) Separate I/O unit (buffers/processing) Separate network communication unit (NIC) Separate network communication unit (NIC) Etc. Etc. Parallel processing Parallel processing

Parallelism (overview) Instruction-level parallelism Instruction-level parallelism pipeline pipeline cache cache Processor-level parallelism Processor-level parallelism multiprocessor (multiple CPUs, common memory) multiprocessor (multiple CPUs, common memory) multicomputer (multiple CPUs, each with own memory) multicomputer (multiple CPUs, each with own memory)

Pipelining

Instruction Caching Hardware provides area for multiple instructions in the CPU Hardware provides area for multiple instructions in the CPU Reduces number of memory accesses Reduces number of memory accesses Instructions are available for immediate execution Instructions are available for immediate execution Might cause problems with decision, repetition, and procedure structures in programs Might cause problems with decision, repetition, and procedure structures in programs

Multiprocessor (shared memory)

Multicomputer (distributed memory)

Comparisons Cache and Pipelining Cache and Pipelining Implemented in hardware Implemented in hardware Multiprocessor Multiprocessor Difficult to build Difficult to build Relatively easy to program Relatively easy to program Multicomputer Multicomputer Easy to build (given networking technology) Easy to build (given networking technology) Extremely difficult to program Extremely difficult to program

Other types of parallelism Hybrid systems Hybrid systems Scalable architectures Scalable architectures Add more processors (nodes), without having to re-invent the system Add more processors (nodes), without having to re-invent the system Simulated parallelism Simulated parallelism

Applications of Parallelism Multi-user systems Multi-user systems Networks Networks Internet Internet Speed up single processes Speed up single processes Chess example Chess example Expert systems Expert systems Other AI applications Other AI applications

Parallelism Parallelism … more later … more later Internal representation Internal representation Data Data Instructions Instructions Addresses Addresses

Internal representation Just like everything else in a computer, the representation of numbers is implemented electrically Just like everything else in a computer, the representation of numbers is implemented electrically switches set to off or on switches set to off or on with open/closed gates. with open/closed gates. There are two states for each gate There are two states for each gate The binary number system uses two digits (0 and 1) The binary number system uses two digits (0 and 1) In order to simplify discussion, we use the standard shorthand to transcribe the computer representation: In order to simplify discussion, we use the standard shorthand to transcribe the computer representation: off is written as digit 0 off is written as digit 0 on is written as digit 1 on is written as digit 1

External representation Use the binary number system to represent numeric values electrically. Use the binary number system to represent numeric values electrically. Switches (gates) are grouped into bytes, words, etc., to represent the digits of a binary number. Switches (gates) are grouped into bytes, words, etc., to represent the digits of a binary number. Note: The number of gates in a group depends on the computer architecture and the type of data represented. E.G., Note: The number of gates in a group depends on the computer architecture and the type of data represented. E.G., For Intel-based architectures For Intel-based architectures byte = 8-bits, word = 2 bytes (16 bits) byte = 8-bits, word = 2 bytes (16 bits) integers use 2, 4, 8, or 10 bytes integers use 2, 4, 8, or 10 bytes

Binary number system has 2 digits: 0 and 1 (binary digit) has 2 digits: 0 and 1 (binary digit) has places and place values determined by powers of 2. has places and place values determined by powers of 2. (in theory) can uniquely represent any integer value (in theory) can uniquely represent any integer value A binary representation is just another way of writing a number that we are accustomed to seeing in decimal form. A binary representation is just another way of writing a number that we are accustomed to seeing in decimal form. (in practice, inside the computer) representation is finite (in practice, inside the computer) representation is finite Representations with too many digits get chopped. Representations with too many digits get chopped.

Internal representation Place values (right-to-left) are 2 0,2 1,2 2,2 3,2 4, etc. Place values (right-to-left) are 2 0,2 1,2 2,2 3,2 4, etc. Bits are numbered (right-to-left) starting at 0 Bits are numbered (right-to-left) starting at 0 Place value depends on number of "bits" defined for the type. Place value depends on number of "bits" defined for the type. Example: Example: A 16-bit integer might be(red is "on") A 16-bit integer might be(red is "on") (bit numbers) … transcribed by a human as To convert to its familiar decimal representation, just add up the place values of the places that are "on".

in decimal form: = 178 How many different codes (integers) can be represented using 16 bits? What is the largest (unsigned) integer that can be represented using 16 bits? What is the largest (unsigned) integer that can be represented using 32 bits? Prove that for n-bit representation, number of codes is 2 n, largest unsigned integer is 2 n – 1, and largest signed integer is 2 n Converting binary to decimal

Converting decimal to binary Method 1:Removing largest powers of 2 Method 1:Removing largest powers of 2 Method 2:Successive division by 2 Method 2:Successive division by 2

Converting decimal to binary Example: 157 Example: 157 Method 1:Removing largest powers of 2 Method 1:Removing largest powers of – 128 = – 16 = – 8 = 5 5 – 4 = 1 1 – 1 = Method 2:Successive division by 2 Method 2:Successive division by ÷ 2 =78 R 1 78 ÷ 2 =39 R 0 39 ÷ 2 =19 R 1 19 ÷ 2 =9 R 1 9 ÷ 2 =4 R 1 4 ÷ 2 =2 R 0 2 ÷ 2 =1 R 0 1 ÷ 2 =0 R

Numeric representation We will show (later) exactly how an electrical operation can be performed on two electrical numeric representations to give an electrical result that is consistent with the rules of arithmetic. We will show (later) exactly how an electrical operation can be performed on two electrical numeric representations to give an electrical result that is consistent with the rules of arithmetic.

… but not quite consistent … Since the number of gates in each group (byte, word, etc.) is finite, computers can represent numbers with finite precision only. Since the number of gates in each group (byte, word, etc.) is finite, computers can represent numbers with finite precision only. Example: Example: Suppose that signed integer data is represented using 16 gates. Then the largest integer that can be represented is What happens if we add 1 ? Suppose that signed integer data is represented using 16 gates. Then the largest integer that can be represented is What happens if we add 1 ? If necessary, representations are truncated; overflow / underflow can occur, and the Status Register will be set If necessary, representations are truncated; overflow / underflow can occur, and the Status Register will be set

Representing negative integers Must specify size! Must specify size! Specify n: number of bits (8, 16, 32, etc.) Specify n: number of bits (8, 16, 32, etc.) There are 2 n possible "codes" There are 2 n possible "codes" Separate the "codes" so that half of them represent negative numbers. Separate the "codes" so that half of them represent negative numbers. Note that exactly half of the codes have 1 in the "leftmost" bit.) Note that exactly half of the codes have 1 in the "leftmost" bit.)

Binary form of negative numbers Several methods, each with disadvantages. Several methods, each with disadvantages. We will focus on twos-complement form We will focus on twos-complement form For a negative number x : For a negative number x : specify number of bits specify number of bits start with binary representation of |x| start with binary representation of |x| change every bit to its opposite, then add 1 to the result. change every bit to its opposite, then add 1 to the result.

Binary form of negative numbers Example: -13 in 16-bit twos-complement Example: -13 in 16-bit twos-complement |-13| = 13 = |-13| = 13 = ones-complement is ones-complement is add 1 to get = -13 add 1 to get = -13 Note that -(-13) should give 13. Try it. Note that -(-13) should give 13. Try it. Hexadecimal representation? Hexadecimal representation? Convert binary to hex in the usual way Convert binary to hex in the usual way -13 = = FFF3 H = 0xfff3 -13 = = FFF3 H = 0xfff3 Note: For byte, word, etc., if the first hex digit is greater than or equal to 8, the value is negative. Note: For byte, word, etc., if the first hex digit is greater than or equal to 8, the value is negative. Convert negative binary to decimal? Convert negative binary to decimal? Find twos complement, convert, and prepend a minus sign. Find twos complement, convert, and prepend a minus sign.

Signed numbers using 4-bit twos-complement form Notice that all of the negative numbers have 1 in the leftmost bit. All of the non-negative numbers have 0 in the leftmost bit. Notice that all of the negative numbers have 1 in the leftmost bit. All of the non-negative numbers have 0 in the leftmost bit. For this reason, the leftmost bit is called the sign bit For this reason, the leftmost bit is called the sign bit Note: Nobody uses 4-bit representations (“nibble”), but there’s not enough room to show 8-bit representations here. Note: Nobody uses 4-bit representations (“nibble”), but there’s not enough room to show 8-bit representations here. You can extend this diagram to 8-bit, 16-bit, etc. You can extend this diagram to 8-bit, 16-bit, etc

n-bit twos-complement form The 2 n possible codes give The 2 n possible codes give all zero all zero 2 n positive numbers 2 n positive numbers 2 n-1 negative numbers 2 n-1 negative numbers Note: zero is its own complement Note: zero is its own complement Note: there is one “weird” number Note: there is one “weird” number = = = = -128 (inconsistent with rules of arithmetic) (inconsistent with rules of arithmetic) 127 is the largest number that can be represented in 8 bits. This means that -(-128) cannot be represented with 8 bits. 127 is the largest number that can be represented in 8 bits. This means that -(-128) cannot be represented with 8 bits. i.e., the 2's-complement of is i.e., the 2's-complement of is

Signed or Unsigned? A 16-bit representation could be used for signed or unsigned numbers A 16-bit representation could be used for signed or unsigned numbers 16-bit signed range is bit signed range is bit unsigned range is bit unsigned range is Both forms use the same 2 16 codes Both forms use the same 2 16 codes Example: Example: unsigned is decimal unsigned is decimal signed is signed is Programmer must tell the computer which form is being used. Programmer must tell the computer which form is being used.

Other representations Every integer number has a unique representation in each "base"  2 Every integer number has a unique representation in each "base"  2 Hexadecimal is commonly used for easily converting binary to a more manageable form. Hexadecimal is commonly used for easily converting binary to a more manageable form. example 16-bit binary  hexadecimal: example 16-bit binary  hexadecimal: Binary Hexadecimal 1 7 B D Write it as 0x17BD or 17BDh

Questions? Read Irvine Chapter 17.1