The register set differs from one computer architecture to another. It is usually a combination of general-purpose and special purpose registers

Similar documents
Digital System Design Using Verilog. - Processing Unit Design

Lecture1: introduction. Outline: History overview Central processing unite Register set Special purpose address registers Datapath Control unit

Week 4: Assignment Solutions

Lecture 11: Control Unit and Instruction Encoding

The Processing Unit. TU-Delft. in1210/01-pds 1

Basic Processing Unit (Chapter 7)

Module 5 - CPU Design


UNIT 3 - Basic Processing Unit

Basic Processing Unit: Some Fundamental Concepts, Execution of a. Complete Instruction, Multiple Bus Organization, Hard-wired Control,

MC9211Computer Organization. Unit 4 Lesson 1 Processor Design


(1) Using a different mapping scheme will reduce which type of cache miss? (1) Which type of cache miss can be reduced by using longer lines?

Introduction to CPU Design

3. (2 pts) Clock rates have grown by a factor of 1000 while power consumed has only grown by a factor of 30. How was this accomplished?

Class Notes. Dr.C.N.Zhang. Department of Computer Science. University of Regina. Regina, SK, Canada, S4S 0A2

PROBLEMS. 7.1 Why is the Wait-for-Memory-Function-Completed step needed when reading from or writing to the main memory?

Processing Unit. Unit II

PESIT Bangalore South Campus

Very short answer questions. You must use 10 or fewer words. "True" and "False" are considered very short answers.

Computer Logic II CCE 2010

Chapter 16. Control Unit Operation. Yonsei University

Chapter 3 : Control Unit

Micro-Operations. execution of a sequence of steps, i.e., cycles

MICROPROGRAMMED CONTROL

VLSI Project. Phase 1 Documentation GROUP 7

Processing Unit CS206T

The von Neumann Architecture. IT 3123 Hardware and Software Concepts. The Instruction Cycle. Registers. LMC Executes a Store.

STRUCTURE OF DESKTOP COMPUTERS

Objective now How are such control statements registers and other components Managed to ensure proper execution of each instruction

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

Chapter 4 The Von Neumann Model

Chapter 5. Computer Architecture Organization and Design. Computer System Architecture Database Lab, SANGJI University

Computer Architecture Programming the Basic Computer

William Stallings Computer Organization and Architecture

Blog -

The CPU and Memory. How does a computer work? How does a computer interact with data? How are instructions performed? Recall schematic diagram:

Computer Architecture

REGISTER TRANSFER LANGUAGE

Very short answer questions. You must use 10 or fewer words. "True" and "False" are considered very short answers.

4. MICROPROGRAMMED COMPUTERS

Microcomputer Architecture and Programming

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

Example of A Microprogrammed Computer

Faculty of Engineering Systems & Biomedical Dept. First Year Cairo University Sheet 6 Computer I

Register Transfer and Micro-operations

THE MICROPROCESSOR Von Neumann s Architecture Model

Very short answer questions. You must use 10 or fewer words. "True" and "False" are considered very short answers.

Outcomes. Lecture 13 - Introduction to the Central Processing Unit (CPU) Central Processing UNIT (CPU) or Processor

Fig: Computer memory with Program, data, and Stack. Blog - NEC (Autonomous) 1

ASSEMBLY LANGUAGE MACHINE ORGANIZATION

UNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering. EEC180B DIGITAL SYSTEMS II Fall 1999

Chapter 4 The Von Neumann Model

MCQ's on Unit-3 Control Unit

1. Fundamental Concepts

Computer Architecture Lecture No.10,11

SUBROUTINE NESTING AND THE PROCESSOR STACK:-

UNIT-II. Part-2: CENTRAL PROCESSING UNIT

Blog -

TYPES OF INTERRUPTS: -

COMPUTER ARCHITECTURE AND ORGANIZATION Register Transfer and Micro-operations 1. Introduction A digital system is an interconnection of digital

Chapter 05: Basic Processing Units Control Unit Design. Lesson 15: Microinstructions

PESIT Bangalore South Campus

Register-Level Design

Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Computing Layers

Computer Organization and Technology Processor and System Structures

Chapter 20 - Microprogrammed Control (9 th edition)

Chapter 1 : Introduction

Chapter 4 The Von Neumann Model

Author : Dalbir Singh, Computer Science Deptt. CPU Structure and Functions. 1. Processor Organization

Chapter 17. Microprogrammed Control. Yonsei University

Control unit. Input/output devices provide a means for us to make use of a computer system. Computer System. Computer.

csitnepal Unit 3 Basic Computer Organization and Design

COA. Prepared By: Dhaval R. Patel Page 1. Q.1 Define MBR.

Unit 8 - Week 7: Organization and Optimization of Micro-programmed Controlled Control Unit

CPU Organization. Hardware design. Vs. Microprogramming

Memory General R0 Registers R1 R2. Input Register 1. Input Register 2. Program Counter. Instruction Register

DC57 COMPUTER ORGANIZATION JUNE 2013

Introduction to Computer Engineering. CS/ECE 252 Prof. Mark D. Hill Computer Sciences Department University of Wisconsin Madison

CONTROL UNIT CONTROL UNIT. CONTROL vs DATA PATH. Instruction Sequencing. Two main operations of Control Unit can be identified:

CHAPTER 8: Central Processing Unit (CPU)

Chapter 14 Design of the Central Processing Unit

Micro computer Organization

The Stored Program Computer

Computer Structure. Unit 4. Processor

2 MARKS Q&A 1 KNREDDY UNIT-I

The Itanium Bit Microprocessor Report

Micro-programmed Control Ch 15

Machine Instructions vs. Micro-instructions. Micro-programmed Control Ch 15. Machine Instructions vs. Micro-instructions (2) Hardwired Control (4)

Micro-programmed Control Ch 15

C.P.U Organization. Memory Unit. Central Processing Unit (C.P.U) Input-Output Processor (IOP) Figure (1) Digital Computer Block Diagram


Advanced Computer Architecture

CISC Processor Design

Chapter 4. The Processor

What Are The Main Differences Between Program Counter Pc And Instruction Register Ir

Introduction. Datapath Basics

ADVANCED COMPUTER ARCHITECTURE TWO MARKS WITH ANSWERS

Department of Computer Science and Engineering CS6303-COMPUTER ARCHITECTURE UNIT-I OVERVIEW AND INSTRUCTIONS PART A

CPE300: Digital System Architecture and Design

Transcription:

Part (6) CPU BASICS A typical CPU has three major components: 1- register set, 2- arithmetic logic unit (ALU), 3- control unit (CU). The figure below shows the internal structure of the CPU. The CPU fetches instructions from memory, reads and writes data from and to memory, and transfers data from and to input/output devices. 1

Instruction execution cycle: 1- fetch: fetching next instruction( using PC) from memory into IR. 2-decode:decoding the instruction. 3- execute: executing the instruction. REGISTER SET: The register set differs from one computer architecture to another. It is usually a combination of general-purpose and special purpose registers General-purpose registers can be used for multiple purposes and assigned to a variety of functions by the programmer. Special-purpose registers are restricted to only specific functions. Memory Access Registers: Two registers are essential in memory write and read operations: the memory data register (MDR) and memory address register (MAR). The MDR and MAR are used exclusively by the CPU and are not directly accessible to programmers. In order to perform a write operation into a specified memory location, the MDR and MAR are used as follows: 1. The word to be stored into the memory location is first loaded by the CPU into MDR. 2. The address of the location into which the word is to be stored is loaded by the CPU into a MAR. 3. A write signal is issued by the CPU. Similarly, to perform a memory read operation, the MDR and MAR are used as follows: 1. The address of the location from which the word is to be read is loaded into the MAR. 2. A read signal is issued by the CPU. 3. The required word will be loaded by the memory into the MDR ready for use by the CPU. Instruction Fetching Registers: Two main registers are involved in fetching an instruction for execution: the program counter (PC) and the instruction register (IR). The PC is the register that contains the address of the next instruction to be fetched. The fetched instruction is loaded in the IR. 2

Condition Register: Program status word (PSW) register contains bits that are set by the CPU to indicate the current status of an executing program. These indicators are typically for arithmetic operations, interrupts, etc. Special-Purpose Address Registers: In index addressing, the index register holds an address displacement which when added to a constant, the address of the operand is obtained. A segment register holds the address of the base of the segment. A specific register, called the stack pointer (SP), is used to indicate the stack location that can be addressed. In the stack push operation, the SP is incremented and in pop operation the SP is decremented. 3

Register transfer: For each register Ri, there are two control signals: Riin used to load the data on the bus into the register. Riout used to place the register s contents on the bus. EX: R1 R4 will be R1out, R4in To perform arithmetic/logic operation:.the ALU is a combinational circuit that has no internal storage..alu gets the two operands from MUX and bus. The result is temporarily stored in register Z. EX: What is the sequence of operation to the following instruction: ADD R1, R2 1. R1out, Yin 2.R2out,Select Y, Add, Zin 3.Zout,R2in 4

Fetching aword from memory: EX: MOVE (R1),R2 1. R1out,MARin, Read 2. WMF( wait to memory function complete) 3. MDRout,R2in Execution of a complete instruction: EX: Write the control steps to fetch and execute the following instruction: ADD (R3), R1 Note: PCnew = PCold + constant 4 5

Execution of Branch instructions: A branch instruction replaces the content of PC with the: branch target address(pcnew)= offset X + PCold offset X ( given in the branch instruction). The required control steps to fetch and execute unconditional branch as follows: 1 PCout, MARin, Read, Select 4, Add, Zin 2 Zout, PCin, Yin, WMFC 3 MDRout, IRin 4 offset Xout,Select y, Add, Zin 5 Zout, PCin, End. EX: The required control steps to fetch and execute a conditional branch( Br<0) is illustrated bellow: Note: N=0 (positive) N=1 ( negative) 1 PCout, MARin, Read, Select 4, Add, Zin 2 Zout, PCin, Yin, WMFC 3 MDRout, IRin 4 Branch to 25 25 If N=0 then branch to 1 26 offset Xout, Select y, Add, Zin 27 Zout, PCin, End. H.W= Br > 0 6

Multiple Bus Organization: Example: Write the control steps to fetch and execute the following instruction in multiple- bus CPU: 1 PCout, R=B, MARin, Read, Inc PC 2 WMFC 3 MDRout B, R=B, IRin 4 R4out A, R5out B, Select A, Add, R6in, End. 7

EX: Write the control steps to fetch and execute the following instruction in multiple- bus CPU: Add (R4), R5,R6 1 PCout, R=B, MARin, Read, Inc PC 2 WMFC 3 MDRout B, R=B, IRin 4 R4out B, R=B, MARin, Read 5 WMFC 6 MDRout B, R5out A, Select A, Add, R6in, End. Control Unit: The control unit is the main component that directs the system operation by sending control signals to the control buses. The system clock produces a continuous sequence of pulses (t0, t1,t2 ) in a specified duration and frequency. The decoder takes the op- code and provide the control signal generator with information about the instruction to be executed. 8

The logic circuit module is used with other inputs to generate control signals. The signal generator can be specified simply by a set of Boolean equations for its output in terms of its inputs. There are mainly two different types of control units: micro programmed and hardwired. Hardwired control: Fixed logic circuits that correspond directly to the Boolean expressions are used to generate the control signals. Hardwired control is faster than micro programmed control. Hardwired control could be very expensive and complicated for complex systems, but more economical for small systems. Hardwired control will require a redesign of the entire systems in the case of any change. In hardwired control, a direct implementation is accomplished using logic circuits. For each control line, one must find the Boolean expression in terms of the input to the control signal generator. EX: Assume that the instruction set of a machine has the three instructions: Inst-x, Inst-y, and Inst-z; and A, B, C, D, E, F,G, and H are control lines. The following table shows the control lines that should be activated for the three instructions at the three steps t0, t1, and t2. The Boolean expressions for control lines A, B, and C can be obtained as follows 9

The figure below shows the logic circuits for these control lines. Boolean expressions for the rest of the control lines can be obtained in a similar way. Micro programmed Control Unit The idea of micro programmed control is to store the control signals associated with the implementation of an instruction as a micro program in a special memory called a control memory (CM). A control word is a microinstruction that specifies one or more micro operations(control signals). A sequence of microinstructions is called a micro program It should also be noted that micro programmed control could adapt easily to changes in the system design. We can easily add new instructions without changing hardware A microinstruction is a vector of bits, where each bit is a control signal, condition code, or the address of the next microinstruction. 10

When an instruction is fetched from memory, the op-code is mapped to a microinstruction address in the control memory. The microinstruction processor uses that address to fetch the first microinstruction in the micro program. After fetching each microinstruction, the appropriate control lines will be enabled. Every control line that corresponds to a 1 bit should be turned on. Every control line that corresponds to a 0 bit should be left off. After completing the execution of one microinstruction, a new microinstruction will be fetched and executed.in the following is an example of a micro program: 1 PCout, MARin, Read, Select 4, Add, Zin 2 Zout, PCin, Yin, WMFC 3 MDRout, IRin 4 Branch to 25 25 If N=0 then branch to 1 26 offset Xout, Select y, Add, Zin 27 Zout, PCin, End. 11

Horizontal Versus Vertical Microinstructions Micro instructions can be classified as horizontal or vertical: Individual bits in horizontal microinstructions correspond to individual control lines. Horizontal microinstructions are long and allow maximum parallelism since each bit controls a single control line. In vertical microinstructions, control lines are coded into specific fields within a microinstruction. Decoders are needed to map a field of k bits to 2 k possible combinations of control lines. For example, a 3-bit field in a microinstruction could be used to specify any one of eight possible lines. Because of the encoding, vertical microinstructions are much shorter than horizontal ones. Control lines encoded in the same field cannot be activated simultaneously. Therefore, vertical microinstructions allow only limited parallelism. 12

Example: Consider the three-bus data path shown in the figure below. In addition to the PC, IR, MAR, and MDR, assume that there are 16 generalpurpose registers numbered R0 R15. Also, assume that the ALU supports eight functions (add, subtract, multiply, divide, AND, OR, shift left, and shift right). Consider the add operation Add R1, R2, R0, which adds the contents of source registers R1, R2, and store the results in destination register R0. The format of the microinstruction under horizontal organization: The format of the microinstruction under vertical organization: 13