Wednesday, February 4, Chapter 4

Size: px
Start display at page:

Download "Wednesday, February 4, Chapter 4"

Transcription

1 Wednesday, February 4, 2015 Topics for today Introduction to Computer Systems Static overview Operation Cycle Introduction to Pep/8 Features of the system Operational cycle Program trace Categories of instruction Example program Von Neumann bugs Chapter 4 Recall that we are looking at systems that use the stored program model of von Neumann. Warford (Fig. 4.1) presents an overview of a computer system having four main components: CPU (Central Processing Unit) Main memory Input Output connected by both control and data lines. An equally valid (better?) top-level model is: Address Data Control CPU Secondary Memory Input/ Output Main Memory So, for example, if the CPU wants to read the data in memory location 24, it puts the number 24 on the address lines issues a Read-from-Memory signal on the control lines The contents of memory location 24 are then sent along the data lines to the CPU. Comp 162 Notes Page 1 of 15 February 4, 2015

2 Similarly to store the number 99 into memory location 150 the CPU puts the number 99 on the data lines puts 150 on the address lines issues a Write-to-Memory signal on the control lines Looking at a CPU in more detail we can sub-divide it into two sections: Data Path Control. Data Path Control Unit Data Path The Data Path contains registers for local storage of data: the CPU can access these very quickly. A register is just an N-bit object. the Arithmetic and Logic Unit for performing operation on registers (we saw the ALU and its status bits earlier) The Control Unit The Control Unit sends control signals to the Data Path telling it what to do and when to do it. For example, certain control signals indicate which arithmetic or logical function the ALU should perform. The Control Unit gets feedback from the Data Path section, for example the values on the Status bits from the ALU. The Control unit typically contains a micromemory, clock and so on. We are not concerned with the functioning of the Control unit in this course; COMP 262 looks at how it works. Comp 162 Notes Page 2 of 15 February 4, 2015

3 The Data Path contains registers for storing data plus the Arithmetic and Logic Unit (ALU) for performing operations and appropriate connections between registers and the ALU. In the following diagram we identify registers that might exist (at least conceptually) in the Data Path. Address lines Data lines MAR MBR PC IR GP1 GPn Control lines ALU Status bits Comp 162 Notes Page 3 of 15 February 4, 2015

4 Abbreviation Register Name Purpose MAR Memory Address Register Terminator for address lines. Not normally directly accessible to programmers MBR Memory Buffer Register Terminator for data lines. Not normally directly accessible to programmers. PC Program Counter Holds address of next instruction to be executed. IR Instruction Register Holds the current instruction. Not normally directly accessible to programmers GP i General Purpose One or more registers for programmer use The size of some registers (MAR, MBR, PC) usually depend on properties of main memory: * The number of different memory addresses determines the size of the PC and the MAR because each of these registers holds a memory address. * The amount of data we can read from and write to memory at one time determines the size of the MBR because that is where the data is stored before/after a transfer. In Figure 4.2 Warford shows the registers accessible to programmers in his Pep/8 system. More on these later. So far we have just looked at the static structure of the machine. How does it run? Operation cycle Version 1.0 (generic) A top-level description of the CPU operation cycle is repeat { } fetch next instruction from memory decode it find out what kind of instruction it is execute it perform appropriate operations Comp 162 Notes Page 4 of 15 February 4, 2015

5 Operation cycle Version 2.0 (generic, more detail) The following pseudocode algorithm shows how the various registers interact (see also Fig. 4.30) Initialize PC to the address of the first instruction of the program repeat { Put Memory[PC] into IR PC = PC + 1 Decode the current instruction (in IR) what does it do? Execute the current instruction } until IR = "Halt" The PC has to be incremented after we fetch an instruction otherwise we would fetch the same instruction over and over again. Operation cycle Version 2.1 (generic, a little more detail) Knowing about the functions of the registers we can expand Put Memory{PC] into IR Initialize PC to the address of the first instruction repeat { Put PC into MAR Issue memory read signal; wait until read complete Put MBR into IR PC = PC + 1 Decode the current instruction (IR) Execute the current instruction } until IR = "Halt" When we have looked at the Pep/8 architecture we will devise an operation cycle specifically for the Pep/8 machine. Comp 162 Notes Page 5 of 15 February 4, 2015

6 Pep/8 (Warford's Virtual Machine Environment) Memory (see Fig 4.3??!) Memory is 64K bytes. Only about 2% of this is reserved for the operating system. Memory is byte-addressable so addresses are 16 bits long (64K = 2 16.) Addresses range from (decimal) which is 0..FFFF in hex A diagram of the memory (better than Fig 4.3 and Fig 4.4) is the following. Each addressable cell is an 8-bit byte FFFD FFFE FFFF The Pep/8 CPU (Fig 4.2) The Pep/8 CPU has a status register holding NZVC (Negative, Zero, overflow and Carry) bits from the ALU. (We have seen that these bits are set as a side-effect of ALU operations.) only two general purpose registers: o Register A (accumulator) o Register X (index). Each register is 16 bits long. Real computers will usually have many more general purpose registers. For many purposes the two registers have the same properties but it turns out that Register X has additional uses that we will see later. stack pointer (SP). The stack is in important run-time structure in the memory. The SP register holds the address of the item at the top of the stack. Comp 162 Notes Page 6 of 15 February 4, 2015

7 Pep/8 instructions Instructions are either 1 byte or 3 bytes long (this means the Instruction Register is 24 bits long to hold the longest possible instruction. The first (possibly only) byte of an instruction * will contain The Opcode (operation code) This indicates what type of operation the instruction performs. It varies in size from 4 bits to 8 bits. Opcodes can be thought of as a variable-length code; they must be unambiguous so that this byte can only be decoded one way by the CPU. * may contain (depending on the nature of the instruction) A 1-bit register number (r) to indicate if using register A or register X A 3-bit addressing mode (aaa) or a 1-bit addressing mode (a) (3-byte instructions only) this indicates how to use the following 2 bytes). A 3-bit number (nnn) used for various purposes A 2-bit number (nn) used for various purposes. The second and third bytes of an instruction (if present) combine to form a 16-bit number that is used in various ways that we will see later. See Figure 4.6 for a list of machine code instructions for Pep/8. Pep/8 programs Pep/8 programs always occupy locations 0, 1, 2, in the memory and the instruction at location 0 is always the first one executed when the program runs. The following is therefore a Pep/8- specific operation cycle (see also Fig. 4.31) Comp 162 Notes Page 7 of 15 February 4, 2015

8 Operation cycle Version 3.0 (Pep/8 specific) pc = 0 Repeat { firstbyte = memory[pc] pc = pc + 1 if (a 3-byte instruction) // determined by opcode bits { get next 2 bytes: mem[pc], mem[pc+1] pc = pc + 2 form two bytes into 16-bit integer (N) } action = function (opcode, register, mode, N) } until opcode=stop With this algorithm and the list of instructions in Figure 4.6 we can trace a program to see what it does. Example Suppose the first 8 bytes of the Pep/8 memory are as follows Address Contents (hex) 0 C A Here is how the program would run (note the updating of the PC) PC 0 Fetch byte 0 and update PC. In hex the byte is it is C0, in binary it is Decode the instruction. The opcode byte must match uniquely with one of the patterns in Fig 4.6. In this case the match is with 1110 r aaa Load register r from memory It is not a one-byte unary instruction so get the next two bytes (from addresses 1 and 2) and update the PC. These two bytes are the operand; in hex the operand is 0007 Comp 162 Notes Page 8 of 15 February 4, 2015

9 3 Execute the instruction. Register is A (r=0). Operand is aaa=000 The aaa bits being 000 indicates that the 0007 is the operand of the instruction (rather than, for example, the address of the operand). So this instruction loads the number 0007 into register A Register A Fetch byte 3 and update PC. In binary the byte fetched (1A) is Decode the instruction. It is unary "negate register" r 4 Execute the instruction. Register is A (r=0). So this instruction negates register A Register A F F F 9 4 Fetch byte 4 and update PC. In binary the byte fetched (70) is Decode the instruction. It is a 3-byte "add to register" 0111 r aaa It is not a unary instruction so we get bytes 5 and 6 (0003) and update the PC. 7 Execute the instruction. Register is A (r=0) Operand is 0003 aaa = 000 Operand is 0003 so Register A is now FFFC (FFF ) Register A F F F C Comp 162 Notes Page 9 of 15 February 4, 2015

10 7 Fetch byte 8 and update PC. In binary the byte fetched (00) is Decode the instruction. It is unary STOP 9 Execute the instruction stop the CPU Pep/8 users can enter either assembly code programs (discussed in Chapter 5) or programs in hexadecimal (Chapter 4). The former have to be assembled then loaded into the Pep/8 memory. The latter just need to be loaded. More on this later. The Pep/8 Instruction set Next: look at briefly at some of the instructions in the Pep/8 instruction set. There are 39 instructions in total. We can group them into 6 categories Category Number in this category Examples Stop 1 Stop Data movement 6 Load register from memory, store byte to memory Arithmetic/Logical 13 Add location to register, Negate register Input/Output 5 Output character, input decimal number Flow of Control 12 Branch if overflow Other 2 No operation Comp 162 Notes Page 10 of 15 February 4, 2015

11 Category 1: Stop/Halt instructions Every instruction set needs one instruction that stops the CPU. In Pep/8 the STOP instruction is opcode (Pep/8 is a virtual environment so when the Pep/8 program terminates, it just returns control to the user window.) is a good choice for the opcode for the STOP instruction. Many architectures use for the STOP/HALT instruction. This is because if the user forgets to include STOP in the program it will continue to execute memory locations but will probably soon encounter one containing zero and stop. Category 2: Data movement The user program (instructions and data) is in main memory but the circuits that perform arithmetic operations are in the CPU. They take inputs from registers and return restuls to registers. Thus we need instructions that move data between main memory and the CPU registers. In general, at the machine level, "load" = copy data from memory to a CPU register - see example program above "store" = copy data from a CPU register to memory. In each case the movement is only a copy operation like an assignment statement in a highlevel language - the source operand is left unchanged. Prior data in the destination location is overwritten. Computers like Pep/8 that have relatively few different instructions typically do not have instructions that move data from memory-to-memory (these are less common now anyway for efficiency reasons). There are only two Pep/8 instructions that move data from one register to another (MOVSPA and MOVFLGA) and neither is used much. Example data movement instructions. Suppose we have the following (hex) values in memory: Address Contents F 18 1C A 47 1B 32 Comp 162 Notes Page 11 of 15 February 4, 2015

12 and Register A containing 46 1A The instruction Load Register A from 18 results in Register A changing to 1C 55 Note: (1) Old data in Register A is overwritten (2) Pep/8 is a "big-endian" machine - in a multi-byte data object, such as the 16-bit word in the example above, the most significant part is stored in the lowest address. On a "little-endian" machine it is the other way round, Register A would be 551C. (3) In the Pep/8 system we can treat any pair of adjacent memory locations as a word; this is not necessarily true on all real computers. Pep/8 has instructions (such as the one above) for moving words (16-bit objects) and bytes (8-bit objects). Usually we deal with words because registers are 16 bits long. Loadbyte and storebyte are the instructions for moving bytes. They operate on the least significant half of a register leaving the most significant half unchanged. So if we follow the instruction above by Loadbyte Register A from 17 then Register A changes to 1C 5F Status bits - we will see later that many instructions affect the 4 status bits N,Z,V,C and that this is useful in creating "if" and "while" constructions. The "Load" instruction, for example, will set N if the number loaded is negative and set Z if the number loaded is zero. Category 3: Arithmetic and Logical Instructions ADD/SUB. Pep/8 has no multiply and divide instructions. If we have time later in the course we will look at register-based multiplication and division algorithms; we can do better than repeated addition/subtraction. ADD and SUB may set any of the status bits. AND/OR - logical operations. Doesn't make sense for them to affect V or C bits. SHIFT - in addition to Arithmetic Shift Right/Left (roughly equivalent to divide/multiply by 2) there are "rotate" instructions that perform circular shifts, i.e., move the bits without losing any - the bit that falls off one end goes in the other end. Comp 162 Notes Page 12 of 15 February 4, 2015

13 NOT/NEGATE - note the difference between these two. The former is a logical operation, the latter is arithmetic. The former gives you the one's complement, the latter gives you the two's complement. (Negating what number will set the V bit?) Category 4: Input/Output Input/output is actually quite complicated, even in Pep/8, but at the machine-code level there are simply two instructions: input a character output a character. These are the only input/output instructions provided at the machine level. At the assembly code level, there are three higher-order instructions: input a decimal number output a decimal number output a string We will see later how these are processed by the Operating System. Category 5: Flow of Control There are instructions that alter the flow of control so we are not limited to programs that begin at location 0 and proceed sequentially until a STOP instruction. Some of the instructions use the status bits to determine whether to transfer control to a particular location. There are also instructions that implement a simple function/subroutine mechanism. More on this when we get to Chapter 5. The number of instructions in this category could be reduced without affecting our ability to implement algorithms. Category 6: Other Sometimes it is useful to have an instruction that does nothing makes no change to memory, registers or status bits. We can use such an instruction to overwrite code and effectively delete that code without having to modify other instructions in the program. Pep/8 also allows us to modify the operating system to cause the NOP opcodes to do something more useful. Comp 162 Notes Page 13 of 15 February 4, 2015

14 In Fig is a simple program that outputs "Hi". What would happen if the programmer forgot to include a STOP instruction in this program, that is, if the memory were Location Contents Crashes after outputting Hi why? Answer: 48 is one of the few byte values that is not a valid opcode von Neumann "bugs" (p. 174 ) Because a program s instructions and data are stored in the same memory, it is possible to execute a data location as an instruction this is sometime done accidentally if we forget to include a STOP/HALT instruction in our program (see example above) or put it in the wrong place.. to treat an instruction as data. We may wish to do this deliberately see later. However, it is not considered good programming practice. Data as instruction In the following program, the programmer put STOP in the wrong place. The translation is lda 0xFFFF,I ; load all 1s anda 6,d ; now AND with 0400 (stored at location 6).word 0x0400 stop ; this should be before the data not after.end Comp 162 Notes Page 14 of 15 February 4, 2015

15 Location Contents 0 C0 1 FF 2 FF When the program runs It executes C0 FF FF ; loads register A with all 1 s Then ; ANDs with the contents of location 6 ( 0400) Then ; the data and the following byte is interpreted as the instruction BR 0 ; branch (jump) to location 0 so the program branches back to location 0 and loops forever. Instruction as data See Fig 4.36 where an ADD instruction is changed to a SUB instruction. Reading: Read up to p You can skim the step-by-step details of how particular instructions work. Next we will finish Chapter 4 and begin looking at assembly language in Chapter 5. Comp 162 Notes Page 15 of 15 February 4, 2015

Wednesday, September 13, Chapter 4

Wednesday, September 13, Chapter 4 Wednesday, September 13, 2017 Topics for today Introduction to Computer Systems Static overview Operation Cycle Introduction to Pep/9 Features of the system Operational cycle Program trace Categories of

More information

Chapter. Computer Architecture

Chapter. Computer Architecture Chapter 4 Computer Architecture Figure 4.1 Input device Central processing unit Main memory Output device Bus Data flow Control Figure 4.2 Central processing unit () Status bits ( ) Accumulator ( ) Index

More information

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

The CPU and Memory. How does a computer work? How does a computer interact with data? How are instructions performed? Recall schematic diagram: The CPU and Memory How does a computer work? How does a computer interact with data? How are instructions performed? Recall schematic diagram: 1 Registers A register is a permanent storage location within

More information

Problem Set 1 Solutions

Problem Set 1 Solutions CSE 260 Digital Computers: Organization and Logical Design Jon Turner Problem Set 1 Solutions 1. Give a brief definition of each of the following parts of a computer system: CPU, main memory, floating

More information

Course Schedule. CS 221 Computer Architecture. Week 3: Plan. I. Hexadecimals and Character Representations. Hexadecimal Representation

Course Schedule. CS 221 Computer Architecture. Week 3: Plan. I. Hexadecimals and Character Representations. Hexadecimal Representation Course Schedule CS 221 Computer Architecture Week 3: Information Representation (2) Fall 2001 W1 Sep 11- Sep 14 Introduction W2 Sep 18- Sep 21 Information Representation (1) (Chapter 3) W3 Sep 25- Sep

More information

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015 Advanced Parallel Architecture Lesson 3 Annalisa Massini - 2014/2015 Von Neumann Architecture 2 Summary of the traditional computer architecture: Von Neumann architecture http://williamstallings.com/coa/coa7e.html

More information

Mark II Aiken Relay Calculator

Mark II Aiken Relay Calculator Introduction to Embedded Microcomputer Systems Lecture 6.1 Mark II Aiken Relay Calculator 2.12. Tutorial 2. Arithmetic and logical operations format descriptions examples h 8-bit unsigned hexadecimal $00

More information

Computer Organization II CMSC 3833 Lecture 33

Computer Organization II CMSC 3833 Lecture 33 Term MARIE Definition Machine Architecture that is Really Intuitive and Easy 4.8.1 The Architecture Figure s Architecture Characteristics: Binary, two s complement Stored program, fixed word length Word

More information

Copyright 2000 N. AYDIN. All rights reserved. 1

Copyright 2000 N. AYDIN. All rights reserved. 1 Computer Architecture Prof. Dr. Nizamettin AYDIN naydin@yildiz.edu.tr http://www.yildiz.edu.tr/~naydin A virtual processor for understanding instruction cycle The Visible Virtual Machine (VVM) 1 2 The

More information

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

The von Neumann Architecture. IT 3123 Hardware and Software Concepts. The Instruction Cycle. Registers. LMC Executes a Store. IT 3123 Hardware and Software Concepts February 11 and Memory II Copyright 2005 by Bob Brown The von Neumann Architecture 00 01 02 03 PC IR Control Unit Command Memory ALU 96 97 98 99 Notice: This session

More information

Module 5 - CPU Design

Module 5 - CPU Design Module 5 - CPU Design Lecture 1 - Introduction to CPU The operation or task that must perform by CPU is: Fetch Instruction: The CPU reads an instruction from memory. Interpret Instruction: The instruction

More information

ASSEMBLY LANGUAGE MACHINE ORGANIZATION

ASSEMBLY LANGUAGE MACHINE ORGANIZATION ASSEMBLY LANGUAGE MACHINE ORGANIZATION CHAPTER 3 1 Sub-topics The topic will cover: Microprocessor architecture CPU processing methods Pipelining Superscalar RISC Multiprocessing Instruction Cycle Instruction

More information

Microcontroller Systems

Microcontroller Systems µcontroller systems 1 / 43 Microcontroller Systems Engineering Science 2nd year A2 Lectures Prof David Murray david.murray@eng.ox.ac.uk www.robots.ox.ac.uk/ dwm/courses/2co Michaelmas 2014 µcontroller

More information

SCRAM Introduction. Philipp Koehn. 19 February 2018

SCRAM Introduction. Philipp Koehn. 19 February 2018 SCRAM Introduction Philipp Koehn 19 February 2018 This eek 1 Fully work through a computer circuit assembly code Simple but Complete Random Access Machine (SCRAM) every instruction is 8 bit 4 bit for op-code:

More information

Digital System Design Using Verilog. - Processing Unit Design

Digital System Design Using Verilog. - Processing Unit Design Digital System Design Using Verilog - Processing Unit Design 1.1 CPU BASICS A typical CPU has three major components: (1) Register set, (2) Arithmetic logic unit (ALU), and (3) Control unit (CU) The register

More information

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

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng. CS 265 Computer Architecture Wei Lu, Ph.D., P.Eng. Part 3: von Neumann Architecture von Neumann Architecture Our goal: understand the basics of von Neumann architecture, including memory, control unit

More information

2.2 THE MARIE Instruction Set Architecture

2.2 THE MARIE Instruction Set Architecture 2.2 THE MARIE Instruction Set Architecture MARIE has a very simple, yet powerful, instruction set. The instruction set architecture (ISA) of a machine specifies the instructions that the computer can perform

More information

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

COSC 243. Computer Architecture 1. COSC 243 (Computer Architecture) Lecture 6 - Computer Architecture 1 1 COSC 243 Computer Architecture 1 COSC 243 (Computer Architecture) Lecture 6 - Computer Architecture 1 1 Overview Last Lecture Flip flops This Lecture Computers Next Lecture Instruction sets and addressing

More information

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

Department of Computer and Mathematical Sciences. Lab 4: Introduction to MARIE Department of Computer and Mathematical Sciences CS 3401 Assembly Language 4 Lab 4: Introduction to MARIE Objectives: The main objective of this lab is to get you familiarized with MARIE a simple computer

More information

The MARIE Architecture

The MARIE Architecture The MARIE Machine Architecture that is Really Intuitive and Easy. We now define the ISA (Instruction Set Architecture) of the MARIE. This forms the functional specifications for the CPU. Basic specifications

More information

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015 Advanced Parallel Architecture Lesson 3 Annalisa Massini - Von Neumann Architecture 2 Two lessons Summary of the traditional computer architecture Von Neumann architecture http://williamstallings.com/coa/coa7e.html

More information

CPU Structure and Function

CPU Structure and Function CPU Structure and Function Chapter 12 Lesson 17 Slide 1/36 Processor Organization CPU must: Fetch instructions Interpret instructions Fetch data Process data Write data Lesson 17 Slide 2/36 CPU With Systems

More information

Practical Malware Analysis

Practical Malware Analysis Practical Malware Analysis Ch 4: A Crash Course in x86 Disassembly Revised 1-16-7 Basic Techniques Basic static analysis Looks at malware from the outside Basic dynamic analysis Only shows you how the

More information

Introduction to Computer Science. Homework 1

Introduction to Computer Science. Homework 1 Introduction to Computer Science Homework. In each circuit below, the rectangles represent the same type of gate. Based on the input and output information given, identify whether the gate involved is

More information

Chapter 3. Z80 Instructions & Assembly Language. Von Neumann Architecture. Memory. instructions. program. data

Chapter 3. Z80 Instructions & Assembly Language. Von Neumann Architecture. Memory. instructions. program. data Von Neumann Architecture The von Neumann architecture is a computer design model that uses a processing unit and a separate storage to hold both instructions and data To run a machine, program and data

More information

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

Lecture1: introduction. Outline: History overview Central processing unite Register set Special purpose address registers Datapath Control unit Lecture1: introduction Outline: History overview Central processing unite Register set Special purpose address registers Datapath Control unit 1 1. History overview Computer systems have conventionally

More information

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

Outcomes. Lecture 13 - Introduction to the Central Processing Unit (CPU) Central Processing UNIT (CPU) or Processor Lecture 13 - Introduction to the Central Processing Unit (CPU) Outcomes What is a CPU? How are instructions prepared by the CPU before execution? What registers and operations are involved in this preparation

More information

Computer Architecture (part 2)

Computer Architecture (part 2) Computer Architecture (part 2) Topics: Machine Organization Machine Cycle Program Execution Machine Language Types of Memory & Access 2 Chapter 5 The Von Neumann Architecture 1 Arithmetic Logic Unit (ALU)

More information

Harry H. Porter, 2006

Harry H. Porter, 2006 The SPARC Computer Architecture Harry Porter Portland State University 1 CS-321 Lexer Parser Type Checking Intermediate Code Generation All semantic error checking finished in this phase IR - Intermediate

More information

Notes: The Marie Simulator

Notes: The Marie Simulator The Accumulator (AC) is the register where calculations are performed. To add two numbers together, a) load the first number into the accumulator with a Load instruction b) Add the second number to the

More information

DC57 COMPUTER ORGANIZATION JUNE 2013

DC57 COMPUTER ORGANIZATION JUNE 2013 Q2 (a) How do various factors like Hardware design, Instruction set, Compiler related to the performance of a computer? The most important measure of a computer is how quickly it can execute programs.

More information

COMP2121: Microprocessors and Interfacing. Instruction Set Architecture (ISA)

COMP2121: Microprocessors and Interfacing. Instruction Set Architecture (ISA) COMP2121: Microprocessors and Interfacing Instruction Set Architecture (ISA) http://www.cse.unsw.edu.au/~cs2121 Lecturer: Hui Wu Session 2, 2017 1 Contents Memory models Registers Data types Instructions

More information

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

Memory General R0 Registers R1 R2. Input Register 1. Input Register 2. Program Counter. Instruction Register CPU Organisation Central Processing Unit (CPU) Memory General R0 Registers R1 R2 ALU R3 Output Register Input Register 1 Input Register 2 Internal Bus Address Bus Data Bus Addr. $ 000 001 002 Program Counter

More information

Wednesday, April 22, 2015

Wednesday, April 22, 2015 Wednesday, April 22, 2015 Topics for today Topics for Exam 3 Process management (Chapter 8) Loader Traps Interrupts, Time-sharing Storage management (Chapter 9) Main memory (1) Uniprogramming (2) Fixed-partition

More information

Chapter 10 - Computer Arithmetic

Chapter 10 - Computer Arithmetic Chapter 10 - Computer Arithmetic Luis Tarrataca luis.tarrataca@gmail.com CEFET-RJ L. Tarrataca Chapter 10 - Computer Arithmetic 1 / 126 1 Motivation 2 Arithmetic and Logic Unit 3 Integer representation

More information

SISTEMI EMBEDDED. Basic Concepts about Computers. Federico Baronti Last version:

SISTEMI EMBEDDED. Basic Concepts about Computers. Federico Baronti Last version: SISTEMI EMBEDDED Basic Concepts about Computers Federico Baronti Last version: 20170307 Embedded System Block Diagram Embedded Computer Embedded System Input Memory Output Sensor Sensor Sensor SENSOR CONDITIONING

More information

UNIT- 5. Chapter 12 Processor Structure and Function

UNIT- 5. Chapter 12 Processor Structure and Function UNIT- 5 Chapter 12 Processor Structure and Function CPU Structure CPU must: Fetch instructions Interpret instructions Fetch data Process data Write data CPU With Systems Bus CPU Internal Structure Registers

More information

2010 Summer Answers [OS I]

2010 Summer Answers [OS I] CS2503 A-Z Accumulator o Register where CPU stores intermediate arithmetic results. o Speeds up process by not having to store these results in main memory. Addition o Carried out by the ALU. o ADD AX,

More information

CMPUT101 Introduction to Computing - Summer 2002

CMPUT101 Introduction to Computing - Summer 2002 7KH9RQ1HXPDQQ$UFKLWHFWXUH 2GGVDQG(QGV Chapter 5.1-5.2 Von Neumann Architecture CMPUT101 Introduction to Computing (c) Yngvi Bjornsson & Vadim Bulitko 1 'HVLJQLQJ&RPSXWHUV All computers more or less based

More information

Chapter 1 Microprocessor architecture ECE 3120 Dr. Mohamed Mahmoud http://iweb.tntech.edu/mmahmoud/ mmahmoud@tntech.edu Outline 1.1 Computer hardware organization 1.1.1 Number System 1.1.2 Computer hardware

More information

William Stallings Computer Organization and Architecture. Chapter 11 CPU Structure and Function

William Stallings Computer Organization and Architecture. Chapter 11 CPU Structure and Function William Stallings Computer Organization and Architecture Chapter 11 CPU Structure and Function CPU Structure CPU must: Fetch instructions Interpret instructions Fetch data Process data Write data Registers

More information

Extra-credit QUIZ Pipelining -due next time-

Extra-credit QUIZ Pipelining -due next time- QUIZ Pipelining A computer pipeline has 4 processors, as shown above. Each processor takes 15 ms to execute, and each instruction must go sequentially through all 4 processors. A program has 10 instructions.

More information

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

CPU Structure and Function. Chapter 12, William Stallings Computer Organization and Architecture 7 th Edition CPU Structure and Function Chapter 12, William Stallings Computer Organization and Architecture 7 th Edition CPU must: CPU Function Fetch instructions Interpret/decode instructions Fetch data Process data

More information

CHAPTER SIX BASIC COMPUTER ORGANIZATION AND DESIGN

CHAPTER SIX BASIC COMPUTER ORGANIZATION AND DESIGN CHAPTER SIX BASIC COMPUTER ORGANIZATION AND DESIGN 6.1. Instruction Codes The organization of a digital computer defined by: 1. The set of registers it contains and their function. 2. The set of instructions

More information

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

Chapter 4. MARIE: An Introduction to a Simple Computer. Chapter 4 Objectives. 4.1 Introduction. 4.2 CPU Basics Chapter 4 Objectives Learn the components common to every modern computer system. Chapter 4 MARIE: An Introduction to a Simple Computer Be able to explain how each component contributes to program execution.

More information

What is an Addressing Mode?

What is an Addressing Mode? Addressing Modes 1 2 What is an Addressing Mode? An addressing mode is a way in which an operand is specified in an instruction. There are different ways in which an operand may be specified in an instruction.

More information

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

Lecture 5: Computer Organization Instruction Execution. Computer Organization Block Diagram. Components. General Purpose Registers. Lecture 5: Computer Organization Instruction Execution Computer Organization Addressing Buses Fetch-Execute Cycle Computer Organization CPU Control Unit U Input Output Memory Components Control Unit fetches

More information

Chapter 7 Central Processor Unit (S08CPUV2)

Chapter 7 Central Processor Unit (S08CPUV2) Chapter 7 Central Processor Unit (S08CPUV2) 7.1 Introduction This section provides summary information about the registers, addressing modes, and instruction set of the CPU of the HCS08 Family. For a more

More information

Processing Unit CS206T

Processing Unit CS206T Processing Unit CS206T Microprocessors The density of elements on processor chips continued to rise More and more elements were placed on each chip so that fewer and fewer chips were needed to construct

More information

THE MICROPROCESSOR Von Neumann s Architecture Model

THE MICROPROCESSOR Von Neumann s Architecture Model THE ICROPROCESSOR Von Neumann s Architecture odel Input/Output unit Provides instructions and data emory unit Stores both instructions and data Arithmetic and logic unit Processes everything Control unit

More information

A3 Computer Architecture

A3 Computer Architecture 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

More information

AS/A Level Computing Syllabus 2011

AS/A Level Computing Syllabus 2011 AS/A Level Computing Syllabus 2011 Section 3 - System Software Mechanisms - - Machine Architecture - - Database Theory - - Programming Paradigms - Chapter 3.3 Computer Architectures & Fetch-Execute Cycle

More information

Summary of Computer Architecture

Summary of Computer Architecture Summary of Computer Architecture Summary CHAP 1: INTRODUCTION Structure Top Level Peripherals Computer Central Processing Unit Main Memory Computer Systems Interconnection Communication lines Input Output

More information

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

The Von Neumann Architecture Odds and Ends. Designing Computers. The Von Neumann Architecture. CMPUT101 Introduction to Computing - Spring 2001 The Von Neumann Architecture Odds and Ends Chapter 5.1-5.2 Von Neumann Architecture CMPUT101 Introduction to Computing (c) Yngvi Bjornsson & Vadim Bulitko 1 Designing Computers All computers more or less

More information

UNIT-II. Part-2: CENTRAL PROCESSING UNIT

UNIT-II. Part-2: CENTRAL PROCESSING UNIT Page1 UNIT-II Part-2: CENTRAL PROCESSING UNIT Stack Organization Instruction Formats Addressing Modes Data Transfer And Manipulation Program Control Reduced Instruction Set Computer (RISC) Introduction:

More information

William Stallings Computer Organization and Architecture 8 th Edition. Chapter 12 Processor Structure and Function

William Stallings Computer Organization and Architecture 8 th Edition. Chapter 12 Processor Structure and Function William Stallings Computer Organization and Architecture 8 th Edition Chapter 12 Processor Structure and Function CPU Structure CPU must: Fetch instructions Interpret instructions Fetch data Process data

More information

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

CPU ARCHITECTURE. QUESTION 1 Explain how the width of the data bus and system clock speed affect the performance of a computer system. CPU ARCHITECTURE QUESTION 1 Explain how the width of the data bus and system clock speed affect the performance of a computer system. ANSWER 1 Data Bus Width the width of the data bus determines the number

More information

Register Transfer and Micro-operations

Register Transfer and Micro-operations Register Transfer Language Register Transfer Bus Memory Transfer Micro-operations Some Application of Logic Micro Operations Register Transfer and Micro-operations Learning Objectives After reading this

More information

Wednesday, January 28, 2018

Wednesday, January 28, 2018 Wednesday, January 28, 2018 Topics for today History of Computing (brief) Encoding data in binary Unsigned integers Signed integers Arithmetic operations and status bits Number conversion: binary to/from

More information

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

COMPUTER ARCHITECTURE AND ORGANIZATION Register Transfer and Micro-operations 1. Introduction A digital system is an interconnection of digital Register Transfer and Micro-operations 1. Introduction A digital system is an interconnection of digital hardware modules that accomplish a specific information-processing task. Digital systems vary in

More information

Dec Hex Bin ORG ; ZERO. Introduction To Computing

Dec Hex Bin ORG ; ZERO. Introduction To Computing Dec Hex Bin 0 0 00000000 ORG ; ZERO Introduction To Computing OBJECTIVES this chapter enables the student to: Convert any number from base 2, base 10, or base 16 to any of the other two bases. Add and

More information

Wednesday, April 19, 2017

Wednesday, April 19, 2017 Wednesday, April 19, 2017 Topics for today Process management (Chapter 8) Loader Traps Interrupts, Time-sharing Storage management (Chapter 9) Main memory (1) Uniprogramming (2) Fixed-partition multiprogramming

More information

The Stored Program Computer

The Stored Program Computer The Stored Program Computer 1 1945: John von Neumann Wrote a report on the stored program concept, known as the First Draft of a Report on EDVAC also Alan Turing Konrad Zuse Eckert & Mauchly The basic

More information

Memory Models. Registers

Memory Models. Registers Memory Models Most machines have a single linear address space at the ISA level, extending from address 0 up to some maximum, often 2 32 1 bytes or 2 64 1 bytes. Some machines have separate address spaces

More information

Wednesday, February 7, 2018

Wednesday, February 7, 2018 Wednesday, February 7, 2018 Topics for today The Pep/9 memory Four example programs The loader The assembly language level (Chapter 5) Symbolic Instructions Assembler directives Immediate mode and equate

More information

COSC345 Software Engineering. Basic Computer Architecture and The Stack

COSC345 Software Engineering. Basic Computer Architecture and The Stack COSC345 Software Engineering Basic Computer Architecture and The Stack Outline Architectural models A little about the 68HC11 Memory map Registers A little bit of assembly (never did us any harm) The program

More information

Menu Computer Organization Programming Model for the an example microprocessors (the G-CPU & Motorola 68HC11) Assembly Programming Look into my...

Menu Computer Organization Programming Model for the an example microprocessors (the G-CPU & Motorola 68HC11) Assembly Programming Look into my... Menu Computer Organization Programming Model for the an example microprocessors (the G-CPU & Motorola 68HC11) Assembly Programming Look into my... See examples on web: DirAddr.asm, ExtAddr.asm, IndAddr.asm,

More information

Introduction to MiniSim A Simple von Neumann Machine

Introduction to MiniSim A Simple von Neumann Machine Math 121: Introduction to Computing Handout #19 Introduction to MiniSim A Simple von Neumann Machine Programming languages like C, C++, Java, or even Karel are called high-level languages because they

More information

CPU Structure and Function

CPU Structure and Function Computer Architecture Computer Architecture Prof. Dr. Nizamettin AYDIN naydin@yildiz.edu.tr nizamettinaydin@gmail.com http://www.yildiz.edu.tr/~naydin CPU Structure and Function 1 2 CPU Structure Registers

More information

COMPUTER SYSTEM. COMPUTER SYSTEM IB DP Computer science Standard Level ICS3U. COMPUTER SYSTEM IB DP Computer science Standard Level ICS3U

COMPUTER SYSTEM. COMPUTER SYSTEM IB DP Computer science Standard Level ICS3U. COMPUTER SYSTEM IB DP Computer science Standard Level ICS3U C A N A D I A N I N T E R N A T I O N A L S C H O O L O F H O N G K O N G 5.1 Introduction 5.2 Components of a Computer System Algorithm The Von Neumann architecture is based on the following three characteristics:

More information

Assembly Language Programming of 8085

Assembly Language Programming of 8085 Assembly Language Programming of 8085 Topics 1. Introduction 2. Programming model of 8085 3. Instruction set of 8085 4. Example Programs 5. Addressing modes of 8085 6. Instruction & Data Formats of 8085

More information

EE 109 Unit 6 Binary Arithmetic

EE 109 Unit 6 Binary Arithmetic EE 109 Unit 6 Binary Arithmetic 1 2 Semester Transition Point At this point we are going to start to transition in our class to look more at the hardware organization and the low-level software that is

More information

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

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng. CS 265 Computer Architecture Wei Lu, Ph.D., P.Eng. Part 3: von Neumann Architecture von Neumann Architecture Our goal: understand the basics of von Neumann architecture, including memory, control unit

More information

Chapter 2 Instruction Set Architecture

Chapter 2 Instruction Set Architecture Chapter 2 Instruction Set Architecture Course Outcome (CO) - CO2 Describe the architecture and organization of computer systems Program Outcome (PO) PO1 Apply knowledge of mathematics, science and engineering

More information

Chapter 4. MARIE: An Introduction to a Simple Computer

Chapter 4. MARIE: An Introduction to a Simple Computer Chapter 4 MARIE: An Introduction to a Simple Computer Chapter 4 Objectives Learn the components common to every modern computer system. Be able to explain how each component contributes to program execution.

More information

When an instruction is initially read from memory it goes to the Instruction register.

When an instruction is initially read from memory it goes to the Instruction register. CS 320 Ch. 12 Instruction Sets Computer instructions are written in mnemonics. Mnemonics typically have a 1 to 1 correspondence between a mnemonic and the machine code. Mnemonics are the assembly language

More information

Rui Wang, Assistant professor Dept. of Information and Communication Tongji University.

Rui Wang, Assistant professor Dept. of Information and Communication Tongji University. Instructions: ti Language of the Computer Rui Wang, Assistant professor Dept. of Information and Communication Tongji University it Email: ruiwang@tongji.edu.cn Computer Hierarchy Levels Language understood

More information

Computer Organization and Technology Processor and System Structures

Computer Organization and Technology Processor and System Structures Computer Organization and Technology Processor and System Structures Assoc. Prof. Dr. Wattanapong Kurdthongmee Division of Computer Engineering, School of Engineering and Resources, Walailak University

More information

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

von Neumann Architecture Basic Computer System Early Computers Microprocessor Reading Assignment An Introduction to Computer Architecture Reading Assignment EEL 4744C: Microprocessor Applications Lecture 1 Part 1 An Introduction to Computer Architecture Microcontrollers and Microcomputers: Chapter 1, Appendix A, Chapter 2 Software and Hardware

More information

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

Basic Computer System. von Neumann Architecture. Reading Assignment. An Introduction to Computer Architecture. EEL 4744C: Microprocessor Applications Reading Assignment EEL 4744C: Microprocessor Applications Lecture 1 Part 1 An Introduction to Computer Architecture Microcontrollers and Microcomputers: Chapter 1, Appendix A, Chapter 2 Software and Hardware

More information

QUIZ. Name all the 4 parts of the fetch-execute cycle.

QUIZ. Name all the 4 parts of the fetch-execute cycle. QUIZ Name all the 4 parts of the fetch-execute cycle. 1 Solution Name all the 4 parts of the fetch-execute cycle. 2 QUIZ Name two fundamental differences between magnetic drives and optical drives: 3 QUIZ

More information

17. Instruction Sets: Characteristics and Functions

17. Instruction Sets: Characteristics and Functions 17. Instruction Sets: Characteristics and Functions Chapter 12 Spring 2016 CS430 - Computer Architecture 1 Introduction Section 12.1, 12.2, and 12.3 pp. 406-418 Computer Designer: Machine instruction set

More information

Shift and Rotate Instructions

Shift and Rotate Instructions Shift and Rotate Instructions Shift and rotate instructions facilitate manipulations of data (that is, modifying part of a 32-bit data word). Such operations might include: Re-arrangement of bytes in a

More information

1. INTRODUCTION TO MICROPROCESSOR AND MICROCOMPUTER ARCHITECTURE:

1. INTRODUCTION TO MICROPROCESSOR AND MICROCOMPUTER ARCHITECTURE: 1. INTRODUCTION TO MICROPROCESSOR AND MICROCOMPUTER ARCHITECTURE: A microprocessor is a programmable electronics chip that has computing and decision making capabilities similar to central processing unit

More information

Computer Organization CS 206 T Lec# 2: Instruction Sets

Computer Organization CS 206 T Lec# 2: Instruction Sets Computer Organization CS 206 T Lec# 2: Instruction Sets Topics What is an instruction set Elements of instruction Instruction Format Instruction types Types of operations Types of operand Addressing mode

More information

CPE300: Digital System Architecture and Design

CPE300: Digital System Architecture and Design CPE300: Digital System Architecture and Design Fall 2011 MW 17:30-18:45 CBC C316 Arithmetic Unit 10032011 http://www.egr.unlv.edu/~b1morris/cpe300/ 2 Outline Recap Chapter 3 Number Systems Fixed Point

More information

COSC 122 Computer Fluency. Computer Organization. Dr. Ramon Lawrence University of British Columbia Okanagan

COSC 122 Computer Fluency. Computer Organization. Dr. Ramon Lawrence University of British Columbia Okanagan COSC 122 Computer Fluency Computer Organization Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Key Points 1) The standard computer (von Neumann) architecture consists

More information

Monday, October 17, 2016

Monday, October 17, 2016 Monday, October 17, 2016 Topics for today C functions and Pep/8 subroutines Passing parameters by reference Globals Locals Reverse Engineering II Representation of Booleans C Functions and Pep/8 Subroutines

More information

MARIE: An Introduction to a Simple Computer

MARIE: An Introduction to a Simple Computer MARIE: An Introduction to a Simple Computer Outline Learn the components common to every modern computer system. Be able to explain how each component contributes to program execution. Understand a simple

More information

QUIZ. Name all the 4 parts of the fetch-execute cycle.

QUIZ. Name all the 4 parts of the fetch-execute cycle. QUIZ Name all the 4 parts of the fetch-execute cycle. 1 Solution Name all the 4 parts of the fetch-execute cycle. 2 QUIZ Name two fundamental differences between magnetic drives and optical drives: 3 Solution

More information

MARIE: An Introduction to a Simple Computer

MARIE: An Introduction to a Simple Computer MARIE: An Introduction to a Simple Computer 4.2 CPU Basics The computer s CPU fetches, decodes, and executes program instructions. The two principal parts of the CPU are the datapath and the control unit.

More information

CHAPTER 4: Register Transfer Language and Microoperations

CHAPTER 4: Register Transfer Language and Microoperations CS 224: Computer Organization S.KHABET CHAPTER 4: Register Transfer Language and Microoperations Outline Register Transfer Language Register Transfer Bus and Memory Transfers Arithmetic Microoperations

More information

IA-32 architecture. PDP8/e architecture Arithmetic. IA-32 architecture (cont)

IA-32 architecture. PDP8/e architecture Arithmetic. IA-32 architecture (cont) PDP8/e architecture Arithmetic CS207, Fall 2004 September 27, 2004 1 IA-32 architecture 20-year development cycle (!) First version: 8086 architecture (16-bit), 1978 Moved to 32-bit in 1985 (80386) Now:

More information

Hardware Level Organization

Hardware Level Organization Hardware Level Organization Intro MIPS 1 Major components: - memory - central processing unit - registers - the fetch/execute cycle CPU PC IR Ex Unit MAR MBR I/O AR I/O BR System Bus Main Memory 0 (the

More information

11. A Computing Machine

11. A Computing Machine COMPUTER SCIENCE S E D G E W I C K / W A Y N E Computer Science Including Programming in Java 11. A Computing Machine Section 5.1 http://introcs.cs.princeton.edu COMPUTER SCIENCE S E D G E W I C K / W

More information

Chapter 3 - Top Level View of Computer Function

Chapter 3 - Top Level View of Computer Function Chapter 3 - Top Level View of Computer Function Luis Tarrataca luis.tarrataca@gmail.com CEFET-RJ L. Tarrataca Chapter 3 - Top Level View 1 / 127 Table of Contents I 1 Introduction 2 Computer Components

More information

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.

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. I. Intro the SAP-2 cmpt-150-arc Sections 8-8, 8-9, 9-4, 9-5, 9.6, 9.8 1. We ll do this in bits and pieces, doing the beginning of each section first. 1. The SAP-2 adds a lot of functionality to the SAP-1

More information

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

The Von Neumann Architecture. Designing Computers. The Von Neumann Architecture. CMPUT101 Introduction to Computing - Spring 2001 The Von Neumann Architecture Chapter 5.1-5.2 Von Neumann Architecture Designing Computers All computers more or less based on the same basic design, the Von Neumann Architecture! CMPUT101 Introduction

More information

Chapter 1. Microprocessor architecture ECE Dr. Mohamed Mahmoud.

Chapter 1. Microprocessor architecture ECE Dr. Mohamed Mahmoud. Chapter 1 Microprocessor architecture ECE 3130 Dr. Mohamed Mahmoud The slides are copyright protected. It is not permissible to use them without a permission from Dr Mahmoud http://www.cae.tntech.edu/~mmahmoud/

More information

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

Basic Processing Unit: Some Fundamental Concepts, Execution of a. Complete Instruction, Multiple Bus Organization, Hard-wired Control, UNIT - 7 Basic Processing Unit: Some Fundamental Concepts, Execution of a Complete Instruction, Multiple Bus Organization, Hard-wired Control, Microprogrammed Control Page 178 UNIT - 7 BASIC PROCESSING

More information