A3 Computer Architecture

Similar documents
Microcontroller Systems

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

3A35 Computer Architecture

The MARIE Architecture

Department of Computer and Mathematical Sciences. Lab 4: Introduction to MARIE

CPU ARCHITECTURE. QUESTION 1 Explain how the width of the data bus and system clock speed affect the performance of a computer system.

SCRAM Introduction. Philipp Koehn. 19 February 2018

COSC 243. Computer Architecture 1. COSC 243 (Computer Architecture) Lecture 6 - Computer Architecture 1 1

Introduction to Computers - Chapter 4

ASSEMBLY LANGUAGE MACHINE ORGANIZATION

Computer Organization II CMSC 3833 Lecture 33

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

Fundamentals of Computer Architecture. 8. Bringing It All Together The Hardware Engineer s Perspective

MARIE: An Introduction to a Simple Computer

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

CS 101, Mock Computer Architecture

General purpose registers These are memory units within the CPU designed to hold temporary data.

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

Chapter 4. MARIE: An Introduction to a Simple Computer. Chapter 4 Objectives. 4.1 Introduction. 4.2 CPU Basics

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

Digital System Design Using Verilog. - Processing Unit Design

EXPERIMENT NO. 1 THE MKT 8085 MICROPROCESSOR TRAINER

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

Chapter 4. MARIE: An Introduction to a Simple Computer

MARIE: An Introduction to a Simple Computer

Chapter 16. Control Unit Operation. Yonsei University

Wednesday, September 13, Chapter 4

CC312: Computer Organization

Segment 1A. Introduction to Microcomputer and Microprocessor

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

A3 Computer Architecture

CHAPTER ASSEMBLY LANGUAGE PROGRAMMING

1. Internal Architecture of 8085 Microprocessor

Wednesday, February 4, Chapter 4

CHAPTER SIX BASIC COMPUTER ORGANIZATION AND DESIGN

Microcontroller Systems

address ALU the operation opcode ACC Acc memory address

COSC 243. Instruction Sets And Addressing Modes. Lecture 7&8 Instruction Sets and Addressing Modes. COSC 243 (Computer Architecture)

CS 31: Intro to Systems Digital Logic. Kevin Webb Swarthmore College February 2, 2016

William Stallings Computer Organization and Architecture

Microcomputer Architecture and Programming

Unit II Basic Computer Organization

Processing Unit CS206T

AS/A Level Computing Syllabus 2011

CS311 Lecture: The Architecture of a Simple Computer

In this lecture, we will look at how storage (or memory) works with processor in a computer system. This is in preparation for the next lecture, in

The Stored Program Computer

EE 3170 Microcontroller Applications

CPU. Fall 2003 CSE 207 Digital Design Project #4 R0 R1 R2 R3 R4 R5 R6 R7 PC STATUS IR. Control Logic RAM MAR MDR. Internal Processor Bus

DC57 COMPUTER ORGANIZATION JUNE 2013

Microprocessors. Microprocessors and rpeanut. Memory. Eric McCreath

csitnepal Unit 3 Basic Computer Organization and Design

Microprocessors and rpeanut. Eric McCreath

( input = α output = λ move = L )

session 7. Datapath Design

Computer Organization and Technology Processor and System Structures

CPU Structure and Function. Chapter 12, William Stallings Computer Organization and Architecture 7 th Edition

4. MICROPROGRAMMED COMPUTERS

1. INTRODUCTION TO MICROPROCESSOR AND MICROCOMPUTER ARCHITECTURE:

CS 31: Intro to Systems Digital Logic. Kevin Webb Swarthmore College February 3, 2015

The Itanium Bit Microprocessor Report

2.2 THE MARIE Instruction Set Architecture

Basics of Microprocessor

Where Does The Cpu Store The Address Of The

The Von Neumann Architecture. Designing Computers. The Von Neumann Architecture. CMPUT101 Introduction to Computing - Spring 2001

Implementing the Control. Simple Questions

Computer Architecture

CMPUT101 Introduction to Computing - Summer 2002

Lecture 5: Computer Organization Instruction Execution. Computer Organization Block Diagram. Components. General Purpose Registers.

There are four registers involved in the fetch cycle: MAR, MBR, PC, and IR.

Designing Computers. The Von Neumann Architecture. The Von Neumann Architecture. The Von Neumann Architecture

Computer Architecture 2/26/01 Lecture #

Darshan Institute of Engineering & Technology for Diploma Studies Unit - 1

Chapter 2 Instruction Set Architecture

M. Sc (CS) (II Semester) Examination, Subject: Computer System Architecture Paper Code: M.Sc-CS-203. Time: Three Hours] [Maximum Marks: 60

Chapter 1 : Introduction

Chapter 3 : Control Unit

Introduction to CPU architecture using the M6800 microprocessor

the SAP-2 I. Intro cmpt-150-arc Sections 8-8, 8-9, 9-4, 9-5, 9.6, We ll do this in bits and pieces, doing the beginning of each section first.

Chapter 4. MARIE: An Introduction to a Simple Computer 4.8 MARIE 4.8 MARIE A Discussion on Decoding

Systems Architecture

E3940 Microprocessor Systems Laboratory. Introduction to the Z80

Chapter 4. Chapter 4 Objectives. MARIE: An Introduction to a Simple Computer

The Institution of Engineers - Sri Lanka

STRUCTURE OF DESKTOP COMPUTERS

(Advanced) Computer Organization & Architechture. Prof. Dr. Hasan Hüseyin BALIK (3 rd Week)

von Neumann Architecture Basic Computer System Early Computers Microprocessor Reading Assignment An Introduction to Computer Architecture

Basic Computer System. von Neumann Architecture. Reading Assignment. An Introduction to Computer Architecture. EEL 4744C: Microprocessor Applications

Lecture-15 W-Z: Increment-Decrement Address Latch:

1 MALP ( ) Unit-1. (1) Draw and explain the internal architecture of 8085.

Register Are Two Names For The Same Place

Computers and Microprocessors. Lecture 34 PHYS3360/AEP3630

The functional block diagram of 8085A is shown in fig.4.1.

Computer Architecture

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

Instruction : A command to the microprocessor to perform a given task on specified data. Each instruction has two parts

For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to

5-1 Instruction Codes


CHAPTER 5 Basic Organization and Design Outline Instruction Codes Computer Registers Computer Instructions Timing and Control Instruction Cycle

Transcription:

A3 Computer Architecture Engineering Science 3rd year A3 Lectures Prof David Murray david.murray@eng.ox.ac.uk www.robots.ox.ac.uk/ dwm/courses/3co Michaelmas 2000 1 / 1

2: Introduction to the CPU 3A3 Michaelmas 2000 2 / 1

What is a computation? Simply the evaluation of some output O, given some input I. O and I are a collections of symbols of some sort in a binary computer we would have them as strings of 0 s and 1 s Denoting a computation f as O = f (I), it can be broken down into elemental steps: O 1 = f 1 (I) O 2 = f 2 (O 1 )... O = f n (O n 1 ) 3 / 1

Can everything be computed? First impose two constraints on a reasonable computing machine 1 It should not merely store the answers to all possible problems 2 It should not compute at infinite speed. Gödel showed that there were very reasonable questions to which the reasonable computer could not give answers. Turing devised a model reasonable computer that he proved could compute anything that was computable. 4 / 1

The Turing Machine Processor R/W Tape The machine comprises: a sectioned tape a processor can move tape right or left and can read and write from a finite set of symbols σ off and onto the tape. The processor itself has a finite number of of states s. With the processor in some state s a, and the symbol σ b under the read/write head, the processor takes one of a finite number of actions: f 1 : write a symbol σ c onto the tape f 2 : move the tape left one section f 3 : move the tape right one section f 4 : halt and then sets itself into some other state s d. 5 / 1

The Turing Machine Eg adding two numbers: Before State Tape f New state Comment s0 s0 s1 R R R s0 s1 s1 Moving right from Moving right from ditto s1 s2 Replace in middle s2 s2 s2 s3 s4 L L R H s2 s2 s3 s4 s0 Moving left ditto Gone too far Delete leftmost Halt After Several things to note here: The notion of storage on the tape The notion of processes f the elemental operations The processor has a finite number of states (a fsm) Data on the tape is separate from control processes Computation takes place with symbols 6 / 1

von Neumann Architecture The work of Turing and others laid the foundation for the development of computers in the early 1940 s...... within the framework of the von Neumann architecture, a digital binary machine with cpu and memory separated by a bus along which data flows. Registers Controller Bus Central Processor Main Memory 7 / 1

Data, Control; what about the program? A Problem: Our computer has to be general purpose, but electronics have to do something specific... The Solution: is to make the control stage run a bland loop of RTL. The loop Fetches instructions from memory Executes instructions by configuring the data section appropriately. This set of instructions is the program. So, the program is data but data which is pulled in to the control section to affect its operation. Registers Controller Bus Central Processor Main Memory 8 / 1

Our Bog Standard Architecture MAR Inc(PC) PC SP Memory IR IR(opcode) IR(address) MBR CU AC Control Lines Status 9 / 1

Principal Registers on the CPU Inc(PC) PC IR IR(opcode) IR(address) CU Status Control Lines SP AC MAR Memory MBR MAR The two memory registers, MAR and MBR, are gatekeepers for the two buses to the memory. The Memory Address Register is used to store the address that is currently being accessed in memory. MBR The Memory Buffer Register (also sometimes called the memory data register MDR or MD) stores information that is being sent to or received from the memory along the data bus. 10 / 1

Principal Registers on the CPU Inc(PC) PC IR IR(opcode) IR(address) CU Status Control Lines SP AC MAR Memory MBR AC The Accumulator is used to store data that is being worked on by the, and is the key register in the data section of the cpu. Notice that the memory can t access the AC directly. The MBR is an intermediary. PC Connected to the address bus, the Program Counter holds the address in memory of the next program instruction. Notice that it doesn t connect directly to the memory, but must go via the the MAR. 11 / 1

Principal Registers on the CPU Inc(PC) PC IR IR(opcode) IR(address) CU Status Control Lines SP AC MAR Memory MBR IR When memory is addressed, the data first goes to the MBR. If the data is an instruction it gets moved to the Instruction Register. The instruction register has two parts. 1 IR (opcode). The most significant bits of the instruction tell the cpu what to do. IR (opcode) gets decoded and executed by the control unit, CU. 2 IR (address). The least significant bits of the instruction are actually data. They get moved to IR (address). As the name suggests they (usually) form all or part of an address for later use in the MAR. 12 / 1

Principal Registers on the CPU Inc(PC) PC IR IR(opcode) IR(address) CU Status Control Lines SP AC MAR Memory MBR SR The Status Register or Condition Control Word or Status Word is not quite the same as the other registers in that it really just a collection of 1bit flags that indicate the outcome of operations that the has just carried out. There are the Carry C, and Overflow V flags you have already met, a negative flag N, and a zero flag Z. These are monitored by the CU. SP The Stack Pointer is connected to the address bus is used to hold the address of a special chunk of memory used for temporary storage during program execution. (Lecture 6.) 13 / 1

CPU Registers are nothing too fancy... They are just registers on the CPU D3 D2 D1 D0 D Q D Q D Q D Q CK Q3 Q2 Q1 Q0 14 / 1

CU and Inc(PC) PC IR IR(opcode) IR(address) CU Status Control Lines SP AC MAR Memory MBR CU The Control Unit is the nerve centre of the cpu, responsible for the timing and execution of the various register transfers required to fulfill an instruction held in the IR. It has a number of control lines coming out of it, which transmit CSL and CSP levels and pulses to the various registers and logic units. The Arithmetic Logic Unit is where bit crunching is carried out. It is responsible for bit operations on data held in the AC and MBR and for storing the results. We shall see that is contains arithmetic adders, logical OR-ers and so on. 15 / 1

Main memory. The memory comprises mostly RAM with some ROM. It is not on the the cpu chip, but is connected to the cpu via two buses, the data bus and the address bus. MAR Inc(PC) PC SP Memory IR IR(opcode) IR(address) MBR CU AC Control Lines Status 16 / 1

Buses The buses carry words of information which are many bits wide. The data bus The data bus width ranges from 4bits for the simplest control microprocessor to 64bits the most sophisticated cpu. The width in the standard desktop micro has increased from 8bits, through 16bits and is now 32bits. Register and bus widths are same ideally, but this is sometimes not the case. (Recall 386 s 32bit cpu sitting on a 16bit bus) Address Bus Sends memory addresses to memory. No need to have same width as the data bus. Again the size has increased figures between 24 and 32 are now commonplace. 17 / 1

Some important points... IR IR(opcode) CU Control Lines IR(address) Status Inc(PC) PC SP AC MAR Memory MBR Our architecture is a much simplified version of the real thing. However, none of the principle has been lost. We will sometimes choose specific widths for various buses and registers. Eg, we shall often assume that the data bus is 16bits (= 2Bytes) wide. All the registers on the data side are 16bits wide, except the IR. The IR (opcode) part should be wide enough to take the largest opcode. We assume the opcode is a fixed 8bits wide. The IR (address) part has to have the same width as the address bus. We shall use an address bus which is 24bits wide, so the MAR, IR (address) PC and SP are 24 bits wide. 18 / 1

The overall aim is simply... IR IR(opcode) CU Control Lines IR(address) Status Inc(PC) PC SP AC MAR Memory MBR to move information from memory to register to move it between registers sometimes pass it through the and then to stuff it back into the memory all in some nicely ordered sequence Helpful analogy? We want to play trains with chunks of information. We, or rather the control section, needs to set the points so that the information is correctly routed. 19 / 1

Instruction Fetch: Step 1 To start, an instruction has to be read from memory. Instruction Fetch: step 1 The PC is the important register in fetching the instruction. It holds the address of the next program instruction in memory. It is said to point to the next instruction. (Any memory address points to the memory contents at that address.) Remember though that the memory address register acts as a gatekeeper to the memory So! the first thing to happen is that the program counter gets copied into the memory address register. Using RTL we have MAR PC Remember that this transfer leaves PC unaltered. 20 / 1

Instruction Fetch: Step 1 MAR PC MAR Inc(PC) PC SP Memory IR IR(opcode) IR(address) MBR CU AC Control Lines Status 21 / 1

Instruction Fetch: step 2 Now we read the memory. MBR MAR where x denotes the contents pointed to by x. MAR Inc(PC) PC SP Memory IR IR(opcode) IR(address) MBR CU AC Control Lines Status 22 / 1

Instruction Fetch: Step 3 The next step is to move the instruction to the instruction register. IR MBR In the BSA, IR is split into two parts, IR (opcode) and IR (address). As far as the instruction fetch is concerned it the IR (opcode) that is important. The opcode is decoded by the control unit MAR Inc(PC) PC SP Memory IR IR(opcode) IR(address) MBR CU AC Control Lines Status 23 / 1

Instruction Fetch: Step 4 Inc(PC) IR IR(opcode) IR(address) CU Status Control Lines PC SP AC MAR Memory MBR Finally we do a touch of housekeeping. It is a reasonable assumption that the next instruction the cpu will fetch is in the next memory location, so the program counter is incremented. PC PC + 1 NB This incrementation is in units of the memory word length. 24 / 1

IR(opcode) IR(address) The Instruction Fetch Inc(PC) IR CU Status Control Lines PC SP AC MAR Memory MBR Summary MAR PC MBR MAR IR MBR; PC PC + 1 decode IR (opcode) 25 / 1

Instruction Description Opcode Meaning LDA x AC x 00000000 Load the accumula STA x x AC 00000001 Store accumulator i ADD x AC AC + x 00000010 Add mem contents AND x AC =AC x 00000011 Logical and... JMP x PC x 00000100 Jump to instruction BEQ x if Z-flag=1 then PC x 00000101 if Z-flag is set then CMP AC AC 00000110 Two s complement t RSH AC RightShift(AC) 00000111 Shift the AC 1bit to Assembler Language is a language designed around a particular cpu, and so there is no standard set of mnemonics. However, once you understand the purpose of the instructions, it is trivial to convert between languages. For example, the above set is similar to those you will use on a 6502 cpu on the computing lab course, but had we chosen to use Motorola 68000 assembler we would use the following. 26 / 1 The example instruction set We give a few members of a model instruction set using Assembler Language mnemonics, together with overall RTL-ish description and binary value of the opcode.

Executing an instruction Let us look at LDA x. The opcode is %00000000. During the instruction fetch this opcode gets places in the IR (opcode), and is decoded by the control unit (CU). The CU then tweaks its output control lines to effect the desired the register transfers etc. Its action is to copy the contents of memory at address x into the accumulator. The variable x is called the operand. At its simplest in our BSA, the operand comprises the remaining 8 bits of the 16 bit instruction after removing the 8 bit opcode. These are the 8 bits in IR (address). In detail: LDA x MAR IR (address) MBR MAR AC MBR 27 / 1

Example of LDA LDA x MAR IR (address) MBR MAR AC MBR MAR Inc(PC) PC SP Memory IR IR(opcode) IR(address) MBR CU AC Control Lines Status Note that no computation has been done by this instruction. Information has been moved around, from memory to accumulator, but not altered. The only part of the cpu that can alter data is the. 28 / 1

Example of LDA The figure gives an example of the information flows in the entire fetch and execute of LDA x, where we assume that an 8bit operand is sufficient. It starts with PC =2. PC=2 a MAR=2 b Memory PC=3 INC e2 IR(opcode) 00000000 MAR=5 f 5 4 3 2 e1 1 0 IR(address) 00000101 MBR 00000010 00001111 00000000 00000101 c c 00000000 00000101 g LDA x d So, MAR< IR(address) MBR< M<MAR> AC< MBR MBR h AC=527 dec 00000010 00001111 AC< MBR 29 / 1

Lengths of operands A Problem At its simplest in our standard architecture, the operand comprises the least significant 8bits originally in the MBR and then transferred to IR (address) at the same time that the most significant bits were transferred to IR (opcode). But this appears to restrict operands in general to 8 bits, and to restrict the available range of addresses to 0 255 which is obviously non-sensical, given that the address bus is 24bits wide! A Solution In our architecture the obvious solution is to make the LDA instruction read the next word of memory into the MBR, and then into the IR (address), building up a 24 bit address for transferral to the MAR. The detail of this step is often missed out in the simplified explanations given in books, and the recommended text is no exception. It is just assumed in the first line of the execute phase that the operand in IR (address) has the required length. 30 / 1

Lengths of operands/ ctd The reason for this sleight is to avoid blurring the distinction between instruction fetch and instruction execute. Clearly, because many instructions don t require long operands it would be very wasteful if every instruction had to make an extra memory read to generate a redundant 24bit operand. This could be solved by opcodes containing a bit that indicated that a futher read should be made to complete the operand. Unfortunately it then appears that part of the instruction execute phase is being used to complete the instruction fetch, and immediately the neat distinction is lost. 31 / 1

Summary: We have seen... 1 that computation required transferring words from memory to register between registers sometimes via the then back to memory. 2 how transfers of information in our BSA could be described using assembler mnemonics which described several lines of RTL 3 how the Instruction Fetch sequence was described, and how the LDA operation was executed. 4 an 8-membered toy instruction set 5 that the Control Unit (CU) is responsible for generating the CSLs and CSPs 32 / 1