010.133 Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.

Slides:



Advertisements
Similar presentations
Chapter 2: Data Manipulation
Advertisements

Stored Program Architecture
Microprocessors.
Chapter 2 Data Manipulation Dr. Farzana Rahman Assistant Professor Department of Computer Science James Madison University 1 Some sldes are adapted from.
ARITHMETIC LOGIC SHIFT UNIT
The CPU Revision Typical machine code instructions Using op-codes and operands Symbolic addressing. Conditional and unconditional branches.
TK 2633 Microprocessor & Interfacing
Room: E-3-31 Phone: Dr Masri Ayob TK 2123 COMPUTER ORGANISATION & ARCHITECTURE Lecture 5: CPU and Memory.
CHAPTER 4 COMPUTER SYSTEM – Von Neumann Model
Execution of an instruction
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
Stored Program Concept: The Hardware View
Henry Hexmoor1 Chapter 10- Control units We introduced the basic structure of a control unit, and translated assembly instructions into a binary representation.
Group 5 Alain J. Percial Paula A. Ortiz Francis X. Ruiz.
The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP
CS 1308 Computer Literacy and the Internet Computer Systems Organization.
Machine Instruction Characteristics
Computer Systems Organization CS 1428 Foundations of Computer Science.
Charles Kime & Thomas Kaminski © 2004 Pearson Education, Inc. Terms of Use (Hyperlinks are active in View Show mode) Terms of Use ECE/CS 352: Digital Systems.
Chapter 4 MARIE: An Introduction to a Simple Computer.
Chapter 4 The Von Neumann Model
Chap 7. Register Transfers and Datapaths. 7.1 Datapaths and Operations Two types of modules of digital systems –Datapath perform data-processing operations.
Introduction to Computer Engineering CS/ECE 252, Fall 2009 Prof. Mark D. Hill Computer Sciences Department University of Wisconsin – Madison.
General Concepts of Computer Organization Overview of Microcomputer.
Computer Architecture And Organization UNIT-II General System Architecture.
Execution of an instruction
Module : Algorithmic state machines. Machine language Machine language is built up from discrete statements or instructions. On the processing architecture,
Lecture 14 Today’s topics MARIE Architecture Registers Buses
Computer Architecture Memory, Math and Logic. Basic Building Blocks Seen: – Memory – Logic & Math.
Computer Hardware A computer is made of internal components Central Processor Unit Internal External and external components.
Electronic Analog Computer Dr. Amin Danial Asham by.
The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP
Computer Organization CDA 3103 Dr. Hassan Foroosh Dept. of Computer Science UCF © Copyright Hassan Foroosh 2002.
Lecture 15 Microarchitecture Level: Level 1. Microarchitecture Level The level above digital logic level. Job: to implement the ISA level above it. The.
Von Neumann Model Computer Organization I 1 September 2009 © McQuain, Feng & Ribbens The Stored Program Computer 1945: John von Neumann –
1 The Instruction Set Architecture September 27 th, 2007 By: Corbin Johnson CS 146.
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.
Chapter 4 The Von Neumann Model
بسم الله الرحمن الرحيم MEMORY AND I/O.
Elements of Datapath for the fetch and increment The first element we need: a memory unit to store the instructions of a program and supply instructions.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Datapath.
Control units In the last lecture, we introduced the basic structure of a control unit, and translated our assembly instructions into a binary representation.
8085 INTERNAL ARCHITECTURE.  Upon completing this topic, you should be able to: State all the register available in the 8085 microprocessor and explain.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Block diagram of a computer system Basic components of a computer system using block diagrams: Cpu Memory Input and output unit Evolution of microprocessor.
1 Chapter 1 Basic Structures Of Computers. Computer : Introduction A computer is an electronic machine,devised for performing calculations and controlling.
Computer Architecture. Instruction Set “The collection of different instructions that the processor can execute it”. Usually represented by assembly codes,
Control Unit Lecture 6.
Chapter 4 The Von Neumann Model
Introduction of microprocessor
Chapter 4 The Von Neumann Model
Introduction to Computer Engineering
Chapter 4 The Von Neumann Model
Chapter 4 The Von Neumann Model
MARIE: An Introduction to a Simple Computer
Unit 12 CPU Design & Programming
Computer Architecture
Chapter 4 The Von Neumann Model
Control units In the last lecture, we introduced the basic structure of a control unit, and translated our assembly instructions into a binary representation.
ECE 352 Digital System Fundamentals
The Stored Program Computer
Basic components Instruction processing
Information Representation: Machine Instructions
Computer Architecture Assembly Language
Introduction to Computer Engineering
Introduction to Computer Engineering
Introduction to Computer Engineering
Introduction to Computer Engineering
Chapter 4 The Von Neumann Model
Presentation transcript:

Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit

Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee 2 Machine Instructions Machine instruction A group of bits that specifies an operation and the registers or memory words in which the operands are found and the result is stored Either all the same size or different sizes Operation code (opcode) A group of bits in an instruction that specifies an operation N-bit opcode can represent 2 n different operations The way how bits are organized in a machine instruction varies with the type of the instruction and the machine

Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee 3 Instruction Set Instruction set A complete collection of instructions for a computer Instruction set architecture (ISA) A thorough description of the instruction set Micro-architecture The design techniques used to implement the instruction set

Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee 4 Data Transfer Instructions Load and store instructions that move data to and from memory and CPU registers Input and output instructions that moves data to and from CPU registers and I/O devices

Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee 5 Arithmetic, Logic, and Shift Instructions Addition, subtraction, multiply, and division instructions Bitwise AND, OR, and NOT instructions Logical and arithmetic shift instructions Comparison instructions that compare two values

Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee 6 Control Flow Instructions Unconditional branch instructions that jump to another location in the program to execute instructions there Conditional branch instructions that jump to another location in the program when a certain condition holds

Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee 7 Stored Program Concept The key idea of the von Neumann architecture Not only are all data values used in the program stored in memory, but also are machine instructions in the program Machine instructions are placed in adjacent locations and fetched by the CU one by one

Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee 8 Instruction Cycle Fetch-decode-execute cycle Repeated until the computer is powered down Fetch The CU fetches an instruction from memory Decode The CU (instruction decoder) determines what operations the instruction requires Execute The CU activates the necessary sequence of microoperations (i.e., control words) to provide timing and control signals to the datapath and memory The decoder converts the instruction to control signals to the datapath and to the CU itself

Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee 9 Program Counter A register to specify the address of the next instruction to be executed To execute instructions in sequence Either automatically incremented or loaded with a new address by the CU

Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee 10 Branch Instructions Modify the PC to skip over some sequence of instructions or to go back to repeat the previous instruction sequence Contain an offset This offset is added to the current PC to go to the branch target address Conditional branches Modify the PC when a certain condition is true The CU evaluates the condition by checking the status signals from the datapath Unconditional branches Always modify the PC Always jumps to the branch target address

Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee 11 A Simple CPU

Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee 12 Instruction Register and Processor Status Register The IR contains the current instruction fetched from memory The PSR is used by the CU to keep track of various aspects of the CPU state Status flags are set by a comparison instruction PSR[31] ← N PSR[30] ← Z PSR[29] ← C PSR[28] ← V

Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee 13 Status Flags N (negative) The result of the last ALU operation is negative (MSB = 1) Z (zero) The result of the last ALU operation is zero C (carry) The result of the last ALU operation has a carry-out V (oVerflow) The result of the last ALU operation overflows

Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee 14 Memory Map Initially, the PC is loaded with 0x8000 0x8000 is the address of the first instruction to be executed The CPU repeats the fetch-decode-execute cycle

Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee 15 Fetch IR ← M[PC]

Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee 16 Decode and Execute The instruction decoder in the CU reads the content of the IR, and the opcode and operands are being decoded The CU generates appropriate control words to perform the operation specified by the opcode

Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee 17 Addition Instruction An addition instruction that adds the contents of two registers R1 and R2 and stores the result to the register R3

Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee 18 Addition Instruction (contd.) IR ← M[PC] R3 ← R1 + R2; PSR[31:28] ← NZCV; PC ← PC + 1 Instruction cycle time Total two clock cycles

Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee 19 Immediate Addition Instruction An addition instruction that adds the content of register R1 and a constant 34, and stores the result to destination register R3 34 An immediate or an immediate constant 8-bit signed binary number

Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee 20 Immediate Addition Instruction (contd.) IR ← M[PC] R3 ← R1 + Constant in ; PSR[31:28] ← NZCV; PC ← PC + 1

Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee 21 Load and Store Instructions Rn Contains the address of the memory location Rd The destination register when the instruction is a load instruction The source register when the instruction is a store instruction

Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee 22 Load and Store Instructions (contd.) Load IR ← M[PC] Rd ← M[Rn]; PC ← PC + 1 Store IR ← M[PC] M[Rn] ← Rd; PC ← PC + 1

Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee 23 Branch Instructions Branch instruction alters the content of the PC 24-bit offset Signed binary number in the two’s complement representation Target address = the content of PC + offset

Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee 24 Branch Instructions (contd.) Unconditional branch IR ← M[PC] PC ← PC + Constant in Conditional branch IR ← M[PC] Taken PC ← PC + Constant in Not taken PC ← PC + 1

Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee 25 Assembly Language A low-level language and relatively easy to write a program compared to the machine language Symbolic names for opcode (mnemonics), locations in the program (labels), variables, and constants Humans almost never write programs directly in machine code Very difficult to understand and write a program in patterns of 0 and 1 Very much error prone

Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee 26 Assembly Language (contd.) An assembler directive is a command to the assembler that tells the assembler something to do in the assembly process A pseudo-instruction does not actually exist in the machine instruction set An easy way of representing a group of machine instructions (possibly a single machine instruction)

Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee 27 Adding 10 Arbitrary Numbers Stored in Memory

Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee 28 Microoperations for the Assembly Code

Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee 29 Input and Output I/O devices attached to a computer is also called peripherals Keyboards, mice, display units, speakers, printers, hard disk drives, optical disk drives, solid state disk drives, network interface cards, etc. Peripherals that communicate with people typically transfer alphanumeric information to/from the CPU The standard binary code for the alphanumeric information is ASCII

Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee 30 I/O Bus An interface is required to resolve differences between the peripheral and CPU Contains an address decoder, a control unit, and registers for the device Has a distinct address To communicate with a specific peripheral device The CPU places the address of the device on the address lines Address lines are continuously monitored by the interface for each device If the interface for a device detects its own address on the bus, a communication link is established All other devices are disabled for the bus

Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee 31 Memory-mapped I/O Makes all I/O devices look exactly the same to the CPU Each I/O device is allocated to an exclusive portion of the CPU's address space When a CPU has n-bit addresses, its address space is the set of 2 n possible addresses Normal load or store instructions are used to communicate with I/O devices The instruction set of the CPU does not need to include special I/O instructions

Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee 32 Memory-mapped I/O (contd.) To enable memory-mapped I/O, Each I/O device needs to provide a hardware interface similar to that of memory Each I/O device is required to define an interaction contract (protocol) The exclusive portion of the address space allocated to an I/O device continuously reflects the physical state of the device Pressing a key on the keyboard makes a certain value (e.g., ASCII code of the key) to be written in the area allocated to the keyboard Whenever a bit is changed in the area allocated to a physical screen, the associated pixel is drawn on the screen